From 814f5d77c15cdfbf01d55ef1385c975623ccfa30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20S=C4=99k?= Date: Wed, 27 Jan 2021 16:32:16 +0100 Subject: [PATCH] Fix scheme-doc-gen Makefile goal --- Makefile | 2 +- api/v1alpha2/doc.go | 5 ++++ api/v1alpha2/groupversion_info.go | 36 ------------------------ api/v1alpha2/jenkins_types.go | 27 +++++++----------- api/v1alpha2/register.go | 10 +++++++ config/crd/bases/jenkins.io_jenkins.yaml | 4 +-- 6 files changed, 28 insertions(+), 56 deletions(-) create mode 100644 api/v1alpha2/doc.go delete mode 100644 api/v1alpha2/groupversion_info.go diff --git a/Makefile b/Makefile index 350494e7..62fdcefd 100644 --- a/Makefile +++ b/Makefile @@ -284,7 +284,7 @@ ifndef HAS_GEN_CRD_API_REFERENCE_DOCS @tar -C $(GEN_CRD_API) -zxf $(GEN_CRD_API)_linux_amd64.tar.gz @rm $(GEN_CRD_API)_linux_amd64.tar.gz endif - $(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md + $(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir $(PKG)/api/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md .PHONY: check-minikube check-minikube: ## Checks if KUBERNETES_PROVIDER is set to minikube diff --git a/api/v1alpha2/doc.go b/api/v1alpha2/doc.go new file mode 100644 index 00000000..62442c14 --- /dev/null +++ b/api/v1alpha2/doc.go @@ -0,0 +1,5 @@ +// Package v1alpha2 contains API Schema definitions for the jenkins.io v1alpha2 API group +// +k8s:deepcopy-gen=package,register +// +kubebuilder:object:generate=true +// +groupName=jenkins.io +package v1alpha2 diff --git a/api/v1alpha2/groupversion_info.go b/api/v1alpha2/groupversion_info.go deleted file mode 100644 index 93674fa3..00000000 --- a/api/v1alpha2/groupversion_info.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2021. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package v1alpha2 contains API Schema definitions for the jenkins.io v1alpha2 API group -// +kubebuilder:object:generate=true -// +groupName=jenkins.io -package v1alpha2 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "jenkins.io", Version: "v1alpha2"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/api/v1alpha2/jenkins_types.go b/api/v1alpha2/jenkins_types.go index 7b130633..0895cd96 100644 --- a/api/v1alpha2/jenkins_types.go +++ b/api/v1alpha2/jenkins_types.go @@ -1,19 +1,3 @@ -/* -Copyright 2021. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - package v1alpha2 import ( @@ -23,6 +7,7 @@ import ( ) // JenkinsSpec defines the desired state of Jenkins +// +k8s:openapi-gen=true type JenkinsSpec struct { // Master represents Jenkins master pod properties and Jenkins plugins. // Every single change here requires a pod restart. @@ -449,6 +434,7 @@ type Service struct { } // JenkinsStatus defines the observed state of Jenkins +// +k8s:openapi-gen=true type JenkinsStatus struct { // OperatorVersion is the operator version which manages this CR // +optional @@ -497,17 +483,24 @@ type JenkinsStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // Jenkins is the Schema for the jenkins API +// +k8s:openapi-gen=true type Jenkins struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec JenkinsSpec `json:"spec,omitempty"` + // Spec defines the desired state of the Jenkins + Spec JenkinsSpec `json:"spec,omitempty"` + + // Status defines the observed state of Jenkins Status JenkinsStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // JenkinsList contains a list of Jenkins type JenkinsList struct { diff --git a/api/v1alpha2/register.go b/api/v1alpha2/register.go index 8013c209..d3e4c040 100644 --- a/api/v1alpha2/register.go +++ b/api/v1alpha2/register.go @@ -6,6 +6,7 @@ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" ) const ( @@ -14,8 +15,17 @@ const ( ) var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "jenkins.io", Version: "v1alpha2"} + // SchemeGroupVersion is group version used to register these objects SchemeGroupVersion = schema.GroupVersion{Group: "jenkins.io", Version: "v1alpha2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme ) // GetObjectKind returns Jenkins object kind diff --git a/config/crd/bases/jenkins.io_jenkins.yaml b/config/crd/bases/jenkins.io_jenkins.yaml index 1f86fe9a..0ecdbf00 100644 --- a/config/crd/bases/jenkins.io_jenkins.yaml +++ b/config/crd/bases/jenkins.io_jenkins.yaml @@ -34,7 +34,7 @@ spec: metadata: type: object spec: - description: JenkinsSpec defines the desired state of Jenkins + description: Spec defines the desired state of the Jenkins properties: backup: description: 'Backup defines configuration of Jenkins backup More @@ -3321,7 +3321,7 @@ spec: - master type: object status: - description: JenkinsStatus defines the observed state of Jenkins + description: Status defines the observed state of Jenkins properties: appliedGroovyScripts: description: AppliedGroovyScripts is a list with all applied groovy