From 110b750ab3361d0ad1dfc57c3cee807a6e088317 Mon Sep 17 00:00:00 2001 From: Avni Sharma <16avnisharma@gmail.com> Date: Sat, 28 Mar 2020 03:29:12 +0530 Subject: [PATCH] Mark Master as required and omitempty fields as +optional --- deploy/crds/jenkins.io_jenkins_crd.yaml | 1 + pkg/apis/jenkins/v1alpha2/jenkins_types.go | 6 ++- .../jenkins/v1alpha2/zz_generated.openapi.go | 49 +++++++++---------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/deploy/crds/jenkins.io_jenkins_crd.yaml b/deploy/crds/jenkins.io_jenkins_crd.yaml index cdf62adc..db1ef67a 100644 --- a/deploy/crds/jenkins.io_jenkins_crd.yaml +++ b/deploy/crds/jenkins.io_jenkins_crd.yaml @@ -2939,6 +2939,7 @@ spec: type: object required: - jenkinsAPISettings + - master type: object status: description: Status defines the observed state of Jenkins diff --git a/pkg/apis/jenkins/v1alpha2/jenkins_types.go b/pkg/apis/jenkins/v1alpha2/jenkins_types.go index 1f917108..385b10bc 100644 --- a/pkg/apis/jenkins/v1alpha2/jenkins_types.go +++ b/pkg/apis/jenkins/v1alpha2/jenkins_types.go @@ -11,7 +11,7 @@ import ( type JenkinsSpec struct { // Master represents Jenkins master pod properties and Jenkins plugins. // Every single change here requires a pod restart. - Master JenkinsMaster `json:"master,omitempty"` + Master JenkinsMaster `json:"master"` // SeedJobs defines list of Jenkins Seed Job configurations // More info: https://github.com/jenkinsci/kubernetes-operator/blob/master/docs/getting-started.md#configure-seed-jobs-and-pipelines @@ -20,6 +20,7 @@ type JenkinsSpec struct { // Notifications defines list of a services which are used to inform about Jenkins status // Can be used to integrate chat services like Slack, Microsoft Teams or Mailgun + // +optional Notifications []Notification `json:"notifications,omitempty"` // Service is Kubernetes service of Jenkins master HTTP pod @@ -294,6 +295,7 @@ type JenkinsMaster struct { // List of containers belonging to the pod. // Containers cannot currently be added or removed. // There must be at least one container in a Pod. + // +optional // Defaults to: // - image: jenkins/jenkins:lts // imagePullPolicy: Always @@ -344,6 +346,7 @@ type JenkinsMaster struct { Tolerations []corev1.Toleration `json:"tolerations,omitempty"` // BasePlugins contains plugins required by operator + // +optional // Defaults to : // - name: kubernetes // version: 1.15.7 @@ -386,6 +389,7 @@ type Service struct { // modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. // Ignored if type is ExternalName. // More info: https://kubernetes.io/docs/concepts/services-networking/service/ + // +optional Labels map[string]string `json:"labels,omitempty"` // Type determines how the Service is exposed. Defaults to ClusterIP. Valid diff --git a/pkg/apis/jenkins/v1alpha2/zz_generated.openapi.go b/pkg/apis/jenkins/v1alpha2/zz_generated.openapi.go index bb674748..77ada573 100644 --- a/pkg/apis/jenkins/v1alpha2/zz_generated.openapi.go +++ b/pkg/apis/jenkins/v1alpha2/zz_generated.openapi.go @@ -9,16 +9,15 @@ import ( common "k8s.io/kube-openapi/pkg/common" ) -// GetOpenAPIDefinitions return OpenAPI definitions func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "./pkg/apis/jenkins/v1alpha2.Jenkins": schemaPkgApisJenkinsV1alpha2Jenkins(ref), - "./pkg/apis/jenkins/v1alpha2.JenkinsSpec": schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref), - "./pkg/apis/jenkins/v1alpha2.JenkinsStatus": schemaPkgApisJenkinsV1alpha2Jenkinsstatus(ref), + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Jenkins": schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref), + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec": schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref), + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus": schema_pkg_apis_jenkins_v1alpha2_JenkinsStatus(ref), } } -func schemaPkgApisJenkinsV1alpha2Jenkins(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -47,24 +46,24 @@ func schemaPkgApisJenkinsV1alpha2Jenkins(ref common.ReferenceCallback) common.Op "spec": { SchemaProps: spec.SchemaProps{ Description: "Spec defines the desired state of the Jenkins", - Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsSpec"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "Status defines the observed state of Jenkins", - Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsStatus"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus"), }, }, }, }, }, Dependencies: []string{ - "./pkg/apis/jenkins/v1alpha2.JenkinsSpec", "./pkg/apis/jenkins/v1alpha2.JenkinsStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } -func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -74,7 +73,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo "master": { SchemaProps: spec.SchemaProps{ Description: "Master represents Jenkins master pod properties and Jenkins plugins. Every single change here requires a pod restart.", - Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsMaster"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsMaster"), }, }, "seedJobs": { @@ -84,7 +83,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("./pkg/apis/jenkins/v1alpha2.SeedJob"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.SeedJob"), }, }, }, @@ -97,7 +96,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("./pkg/apis/jenkins/v1alpha2.Notification"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Notification"), }, }, }, @@ -106,37 +105,37 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo "service": { SchemaProps: spec.SchemaProps{ Description: "Service is Kubernetes service of Jenkins master HTTP pod Defaults to : port: 8080 type: ClusterIP", - Ref: ref("./pkg/apis/jenkins/v1alpha2.Service"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service"), }, }, "slaveService": { SchemaProps: spec.SchemaProps{ Description: "Service is Kubernetes service of Jenkins slave pods Defaults to : port: 50000 type: ClusterIP", - Ref: ref("./pkg/apis/jenkins/v1alpha2.Service"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service"), }, }, "backup": { SchemaProps: spec.SchemaProps{ Description: "Backup defines configuration of Jenkins backup More info: https://github.com/jenkinsci/kubernetes-operator/blob/master/docs/getting-started.md#configure-backup-and-restore", - Ref: ref("./pkg/apis/jenkins/v1alpha2.Backup"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Backup"), }, }, "restore": { SchemaProps: spec.SchemaProps{ Description: "Backup defines configuration of Jenkins backup restore More info: https://github.com/jenkinsci/kubernetes-operator/blob/master/docs/getting-started.md#configure-backup-and-restore", - Ref: ref("./pkg/apis/jenkins/v1alpha2.Restore"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Restore"), }, }, "groovyScripts": { SchemaProps: spec.SchemaProps{ Description: "GroovyScripts defines configuration of Jenkins customization via groovy scripts", - Ref: ref("./pkg/apis/jenkins/v1alpha2.GroovyScripts"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.GroovyScripts"), }, }, "configurationAsCode": { SchemaProps: spec.SchemaProps{ Description: "ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin", - Ref: ref("./pkg/apis/jenkins/v1alpha2.ConfigurationAsCode"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.ConfigurationAsCode"), }, }, "roles": { @@ -155,25 +154,25 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo "serviceAccount": { SchemaProps: spec.SchemaProps{ Description: "ServiceAccount defines Jenkins master service account attributes", - Ref: ref("./pkg/apis/jenkins/v1alpha2.ServiceAccount"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.ServiceAccount"), }, }, "jenkinsAPISettings": { SchemaProps: spec.SchemaProps{ Description: "JenkinsAPISettings defines configuration used by the operator to gain admin access to the Jenkins API", - Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsAPISettings"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsAPISettings"), }, }, }, - Required: []string{"jenkinsAPISettings"}, + Required: []string{"master", "jenkinsAPISettings"}, }, }, Dependencies: []string{ - "./pkg/apis/jenkins/v1alpha2.Backup", "./pkg/apis/jenkins/v1alpha2.ConfigurationAsCode", "./pkg/apis/jenkins/v1alpha2.GroovyScripts", "./pkg/apis/jenkins/v1alpha2.JenkinsAPISettings", "./pkg/apis/jenkins/v1alpha2.JenkinsMaster", "./pkg/apis/jenkins/v1alpha2.Notification", "./pkg/apis/jenkins/v1alpha2.Restore", "./pkg/apis/jenkins/v1alpha2.SeedJob", "./pkg/apis/jenkins/v1alpha2.Service", "./pkg/apis/jenkins/v1alpha2.ServiceAccount", "k8s.io/api/rbac/v1.RoleRef"}, + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Backup", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.ConfigurationAsCode", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.GroovyScripts", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsAPISettings", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsMaster", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Notification", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Restore", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.SeedJob", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service", "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.ServiceAccount", "k8s.io/api/rbac/v1.RoleRef"}, } } -func schemaPkgApisJenkinsV1alpha2Jenkinsstatus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_pkg_apis_jenkins_v1alpha2_JenkinsStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -261,7 +260,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsstatus(ref common.ReferenceCallback) com Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("./pkg/apis/jenkins/v1alpha2.AppliedGroovyScript"), + Ref: ref("github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.AppliedGroovyScript"), }, }, }, @@ -271,6 +270,6 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsstatus(ref common.ReferenceCallback) com }, }, Dependencies: []string{ - "./pkg/apis/jenkins/v1alpha2.AppliedGroovyScript", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.AppliedGroovyScript", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, } }