Mark Master as required and omitempty fields as +optional

This commit is contained in:
Avni Sharma 2020-03-28 03:29:12 +05:30
parent a445c0e3ab
commit 110b750ab3
3 changed files with 30 additions and 26 deletions

View File

@ -2939,6 +2939,7 @@ spec:
type: object type: object
required: required:
- jenkinsAPISettings - jenkinsAPISettings
- master
type: object type: object
status: status:
description: Status defines the observed state of Jenkins description: Status defines the observed state of Jenkins

View File

@ -11,7 +11,7 @@ import (
type JenkinsSpec struct { type JenkinsSpec struct {
// Master represents Jenkins master pod properties and Jenkins plugins. // Master represents Jenkins master pod properties and Jenkins plugins.
// Every single change here requires a pod restart. // 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 // 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 // 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 // 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 // Can be used to integrate chat services like Slack, Microsoft Teams or Mailgun
// +optional
Notifications []Notification `json:"notifications,omitempty"` Notifications []Notification `json:"notifications,omitempty"`
// Service is Kubernetes service of Jenkins master HTTP pod // Service is Kubernetes service of Jenkins master HTTP pod
@ -294,6 +295,7 @@ type JenkinsMaster struct {
// List of containers belonging to the pod. // List of containers belonging to the pod.
// Containers cannot currently be added or removed. // Containers cannot currently be added or removed.
// There must be at least one container in a Pod. // There must be at least one container in a Pod.
// +optional
// Defaults to: // Defaults to:
// - image: jenkins/jenkins:lts // - image: jenkins/jenkins:lts
// imagePullPolicy: Always // imagePullPolicy: Always
@ -344,6 +346,7 @@ type JenkinsMaster struct {
Tolerations []corev1.Toleration `json:"tolerations,omitempty"` Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// BasePlugins contains plugins required by operator // BasePlugins contains plugins required by operator
// +optional
// Defaults to : // Defaults to :
// - name: kubernetes // - name: kubernetes
// version: 1.15.7 // version: 1.15.7
@ -386,6 +389,7 @@ type Service struct {
// modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. // modify. Only applies to types ClusterIP, NodePort, and LoadBalancer.
// Ignored if type is ExternalName. // Ignored if type is ExternalName.
// More info: https://kubernetes.io/docs/concepts/services-networking/service/ // More info: https://kubernetes.io/docs/concepts/services-networking/service/
// +optional
Labels map[string]string `json:"labels,omitempty"` Labels map[string]string `json:"labels,omitempty"`
// Type determines how the Service is exposed. Defaults to ClusterIP. Valid // Type determines how the Service is exposed. Defaults to ClusterIP. Valid

View File

@ -9,16 +9,15 @@ import (
common "k8s.io/kube-openapi/pkg/common" common "k8s.io/kube-openapi/pkg/common"
) )
// GetOpenAPIDefinitions return OpenAPI definitions
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{ return map[string]common.OpenAPIDefinition{
"./pkg/apis/jenkins/v1alpha2.Jenkins": schemaPkgApisJenkinsV1alpha2Jenkins(ref), "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Jenkins": schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref),
"./pkg/apis/jenkins/v1alpha2.JenkinsSpec": schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref), "github.com/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec": schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref),
"./pkg/apis/jenkins/v1alpha2.JenkinsStatus": schemaPkgApisJenkinsV1alpha2Jenkinsstatus(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{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
@ -47,24 +46,24 @@ func schemaPkgApisJenkinsV1alpha2Jenkins(ref common.ReferenceCallback) common.Op
"spec": { "spec": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Spec defines the desired state of the Jenkins", 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": { "status": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Status defines the observed state of Jenkins", 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{ 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{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
@ -74,7 +73,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo
"master": { "master": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Master represents Jenkins master pod properties and Jenkins plugins. Every single change here requires a pod restart.", 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": { "seedJobs": {
@ -84,7 +83,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo
Items: &spec.SchemaOrArray{ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{ Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{ 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{ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{ Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{ 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": { "service": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Service is Kubernetes service of Jenkins master HTTP pod Defaults to : port: 8080 type: ClusterIP", 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": { "slaveService": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "Service is Kubernetes service of Jenkins slave pods Defaults to : port: 50000 type: ClusterIP", 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": { "backup": {
SchemaProps: spec.SchemaProps{ 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", 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": { "restore": {
SchemaProps: spec.SchemaProps{ 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", 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": { "groovyScripts": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "GroovyScripts defines configuration of Jenkins customization via groovy scripts", 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": { "configurationAsCode": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin", 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": { "roles": {
@ -155,25 +154,25 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsspec(ref common.ReferenceCallback) commo
"serviceAccount": { "serviceAccount": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "ServiceAccount defines Jenkins master service account attributes", 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": { "jenkinsAPISettings": {
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
Description: "JenkinsAPISettings defines configuration used by the operator to gain admin access to the Jenkins API", 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{ 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{ return common.OpenAPIDefinition{
Schema: spec.Schema{ Schema: spec.Schema{
SchemaProps: spec.SchemaProps{ SchemaProps: spec.SchemaProps{
@ -261,7 +260,7 @@ func schemaPkgApisJenkinsV1alpha2Jenkinsstatus(ref common.ReferenceCallback) com
Items: &spec.SchemaOrArray{ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{ Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{ 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{ 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"},
} }
} }