Generate OpenAPI validation schema

This commit is contained in:
Shoubhik Bose 2020-02-10 15:06:59 -05:00 committed by GitHub
parent 018c8cc709
commit 11231b690c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3038 additions and 44 deletions

File diff suppressed because it is too large Load Diff

View File

@ -629,7 +629,7 @@ type AppliedGroovyScript struct {
// Name is the name of the groovy script
Name string `json:"name"`
// Hash is the hash of the groovy script and secrets which it uses
Hash string
Hash string `json:"hash"`
}
// SecretRef is reference to Kubernetes secret
@ -650,10 +650,10 @@ type Customization struct {
// GroovyScripts defines configuration of Jenkins customization via groovy scripts
type GroovyScripts struct {
Customization
Customization `json:",inline"`
}
// ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin
type ConfigurationAsCode struct {
Customization
Customization `json:",inline"`
}

View File

@ -1,7 +1,5 @@
// +build !ignore_autogenerated
// Code generated by openapi-gen. DO NOT EDIT.
// This file was autogenerated by openapi-gen. Do not edit it manually!
package v1alpha2
@ -13,9 +11,9 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Jenkins": schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref),
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec": schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref),
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus": schema_pkg_apis_jenkins_v1alpha2_JenkinsStatus(ref),
"./pkg/apis/jenkins/v1alpha2.Jenkins": schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref),
"./pkg/apis/jenkins/v1alpha2.JenkinsSpec": schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref),
"./pkg/apis/jenkins/v1alpha2.JenkinsStatus": schema_pkg_apis_jenkins_v1alpha2_JenkinsStatus(ref),
}
}
@ -24,6 +22,7 @@ func schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref common.ReferenceCallback) comm
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Jenkins is the Schema for the jenkins API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
@ -46,19 +45,21 @@ func schema_pkg_apis_jenkins_v1alpha2_Jenkins(ref common.ReferenceCallback) comm
},
"spec": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec"),
Description: "Spec defines the desired state of the Jenkins",
Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus"),
Description: "Status defines the observed state of Jenkins",
Ref: ref("./pkg/apis/jenkins/v1alpha2.JenkinsStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsSpec", "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
"./pkg/apis/jenkins/v1alpha2.JenkinsSpec", "./pkg/apis/jenkins/v1alpha2.JenkinsStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
@ -66,21 +67,36 @@ func schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref common.ReferenceCallback)
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JenkinsSpec defines the desired state of Jenkins",
Description: "JenkinsSpec defines the desired state of the Jenkins",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"master": {
SchemaProps: spec.SchemaProps{
Description: "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file",
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsMaster"),
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"),
},
},
"seedJobs": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Description: "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",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.SeedJob"),
Ref: ref("./pkg/apis/jenkins/v1alpha2.SeedJob"),
},
},
},
},
},
"notifications": {
SchemaProps: spec.SchemaProps{
Description: "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",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("./pkg/apis/jenkins/v1alpha2.Notification"),
},
},
},
@ -88,29 +104,71 @@ func schema_pkg_apis_jenkins_v1alpha2_JenkinsSpec(ref common.ReferenceCallback)
},
"service": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service"),
Description: "Service is Kubernetes service of Jenkins master HTTP pod Defaults to : port: 8080 type: ClusterIP",
Ref: ref("./pkg/apis/jenkins/v1alpha2.Service"),
},
},
"slaveService": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service"),
Description: "Service is Kubernetes service of Jenkins slave pods Defaults to : port: 50000 type: ClusterIP",
Ref: ref("./pkg/apis/jenkins/v1alpha2.Service"),
},
},
"backup": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Backup"),
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"),
},
},
"restore": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.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"),
},
},
"groovyScripts": {
SchemaProps: spec.SchemaProps{
Description: "GroovyScripts defines configuration of Jenkins customization via groovy scripts",
Ref: ref("./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"),
},
},
"roles": {
SchemaProps: spec.SchemaProps{
Description: "Roles defines list of extra RBAC roles for the Jenkins Master pod service account",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/api/rbac/v1.RoleRef"),
},
},
},
},
},
"serviceAccount": {
SchemaProps: spec.SchemaProps{
Description: "ServiceAccount defines Jenkins master service account attributes",
Ref: ref("./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"),
},
},
},
Required: []string{"jenkinsAPISettings"},
},
},
Dependencies: []string{
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Backup", "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.JenkinsMaster", "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Restore", "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.SeedJob", "github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service"},
"./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"},
}
}
@ -119,63 +177,99 @@ func schema_pkg_apis_jenkins_v1alpha2_JenkinsStatus(ref common.ReferenceCallback
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "JenkinsStatus defines the observed state of Jenkins",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"operatorVersion": {
SchemaProps: spec.SchemaProps{
Description: "INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file",
Description: "OperatorVersion is the operator version which manages this CR",
Type: []string{"string"},
Format: "",
},
},
"provisionStartTime": {
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
Description: "ProvisionStartTime is a time when Jenkins master pod has been created",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"baseConfigurationCompletedTime": {
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
Description: "BaseConfigurationCompletedTime is a time when Jenkins base configuration phase has been completed",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"userConfigurationCompletedTime": {
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
Description: "UserConfigurationCompletedTime is a time when Jenkins user configuration phase has been completed",
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
"builds": {
"restoredBackup": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Description: "RestoredBackup is the restored backup number after Jenkins master pod restart",
Type: []string{"integer"},
Format: "int64",
},
},
"lastBackup": {
SchemaProps: spec.SchemaProps{
Description: "LastBackup is the latest backup number",
Type: []string{"integer"},
Format: "int64",
},
},
"pendingBackup": {
SchemaProps: spec.SchemaProps{
Description: "PendingBackup is the pending backup number",
Type: []string{"integer"},
Format: "int64",
},
},
"backupDoneBeforePodDeletion": {
SchemaProps: spec.SchemaProps{
Description: "BackupDoneBeforePodDeletion tells if backup before pod deletion has been made",
Type: []string{"boolean"},
Format: "",
},
},
"userAndPasswordHash": {
SchemaProps: spec.SchemaProps{
Description: "UserAndPasswordHash is a SHA256 hash made from user and password",
Type: []string{"string"},
Format: "",
},
},
"createdSeedJobs": {
SchemaProps: spec.SchemaProps{
Description: "CreatedSeedJobs contains list of seed job id already created in Jenkins",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Build"),
Type: []string{"string"},
Format: "",
},
},
},
},
},
"restoredBackup": {
"appliedGroovyScripts": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"lastBackup": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"pendingBackup": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
Description: "AppliedGroovyScripts is a list with all applied groovy scripts in Jenkins by the operator",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: ref("./pkg/apis/jenkins/v1alpha2.AppliedGroovyScript"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Build", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
"./pkg/apis/jenkins/v1alpha2.AppliedGroovyScript", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}