From 9a257d32c6ae2ad70f471f028f54f047a4097880 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Mon, 28 Mar 2022 09:40:58 -0700 Subject: [PATCH] Add secret fields for cluster templates --- .../v3/cluster_template_types.go | 36 ++++++++++++++++++- apis/management.cattle.io/v3/schema/schema.go | 5 ++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/apis/management.cattle.io/v3/cluster_template_types.go b/apis/management.cattle.io/v3/cluster_template_types.go index e4aeef36..f6cd135a 100644 --- a/apis/management.cattle.io/v3/cluster_template_types.go +++ b/apis/management.cattle.io/v3/cluster_template_types.go @@ -1,10 +1,31 @@ package v3 import ( + "github.com/rancher/norman/condition" "github.com/rancher/norman/types" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ClusterTemplateRevisionConditionSecretsMigrated condition.Cond = "SecretsMigrated" + +type ClusterTemplateRevisionConditionType string + +type ClusterTemplateRevisionCondition struct { + // Type of cluster template revision condition. + Type ClusterTemplateRevisionConditionType `json:"type"` + // Status of the condition, one of True, False, Unknown. + Status v1.ConditionStatus `json:"status"` + // The last time this condition was updated. + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + // Last time the condition transitioned from one status to another. + LastTransitionTime string `json:"lastTransitionTime,omitempty"` + // The reason for the condition's last transition. + Reason string `json:"reason,omitempty"` + // Human-readable message indicating details about last transition + Message string `json:"message,omitempty"` +} + type ClusterTemplate struct { types.Namespaced @@ -33,7 +54,8 @@ type ClusterTemplateRevision struct { metav1.ObjectMeta `json:"metadata,omitempty"` // Specification of the desired behavior of the the cluster. More info: // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status - Spec ClusterTemplateRevisionSpec `json:"spec"` + Spec ClusterTemplateRevisionSpec `json:"spec"` + Status ClusterTemplateRevisionStatus `json:"status"` } type ClusterTemplateRevisionSpec struct { @@ -45,6 +67,18 @@ type ClusterTemplateRevisionSpec struct { ClusterConfig *ClusterSpecBase `json:"clusterConfig" norman:"required"` } +type ClusterTemplateRevisionStatus struct { + PrivateRegistrySecret string `json:"privateRegistrySecret,omitempty" norman:"nocreate,noupdate"` + S3CredentialSecret string `json:"s3CredentialSecret,omitempty" norman:"nocreate,noupdate"` + WeavePasswordSecret string `json:"weavePasswordSecret,omitempty" norman:"nocreate,noupdate"` + VsphereSecret string `json:"vsphereSecret,omitempty" norman:"nocreate,noupdate"` + VirtualCenterSecret string `json:"virtualCenterSecret,omitempty" norman:"nocreate,noupdate"` + OpenStackSecret string `json:"openStackSecret,omitempty" norman:"nocreate,noupdate"` + AADClientSecret string `json:"aadClientSecret,omitempty" norman:"nocreate,noupdate"` + AADClientCertSecret string `json:"aadClientCertSecret,omitempty" norman:"nocreate,noupdate"` + Conditions []ClusterTemplateRevisionCondition `json:"conditions,omitempty"` +} + type ClusterTemplateQuestionsOutput struct { Questions []Question `json:"questions,omitempty"` } diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 82cfafc5..7e60bc4e 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -907,7 +907,10 @@ func clusterTemplateTypes(schemas *types.Schemas) *types.Schemas { TypeName("clusterTemplate", v3.ClusterTemplate{}). TypeName("clusterTemplateRevision", v3.ClusterTemplateRevision{}). AddMapperForType(&Version, v3.ClusterTemplate{}, m.Drop{Field: "namespaceId"}, m.DisplayName{}). - AddMapperForType(&Version, v3.ClusterTemplateRevision{}, m.Drop{Field: "namespaceId"}, m.DisplayName{}). + AddMapperForType(&Version, v3.ClusterTemplateRevision{}, + m.Drop{Field: "namespaceId"}, + &m.Embed{Field: "status"}, + m.DisplayName{}). MustImport(&Version, v3.ClusterTemplateQuestionsOutput{}). MustImport(&Version, v3.ClusterTemplate{}). MustImportAndCustomize(&Version, v3.ClusterTemplateRevision{}, func(schema *types.Schema) {