k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/apis/kubermatic/v1/cluster_templates.go (about) 1 /* 2 Copyright 2023 The Kubermatic Kubernetes Platform contributors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 const ( 24 ClusterTemplateScopeUserCluster = "user" 25 ClusterTemplateScopeProjectCluster = "project" 26 ClusterTemplateScopeGlobalCluster = "global" 27 ClusterTemplateScopeSeed = "seed" 28 ) 29 30 const ( 31 ClusterTemplateLabelKey = "template-id" 32 ClusterTemplateInstanceLabelKey = "template-instance-id" 33 ClusterTemplateScopeLabelKey = "scope" 34 ClusterTemplateUserAnnotationKey = "user" 35 ClusterTemplateProjectLabelKey = "project-id" 36 ClusterTemplateHumanReadableNameLabelKey = "name" 37 ) 38 39 // +genclient 40 // +kubebuilder:resource:scope=Cluster 41 // +kubebuilder:object:generate=true 42 // +kubebuilder:object:root=true 43 // +kubebuilder:printcolumn:JSONPath=".spec.humanReadableName",name="HumanReadableName",type="string" 44 // +kubebuilder:printcolumn:JSONPath=".spec.version",name="Version",type="string" 45 // +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date" 46 47 // ClusterTemplate is the object representing a cluster template. 48 type ClusterTemplate struct { 49 metav1.TypeMeta `json:",inline"` 50 metav1.ObjectMeta `json:"metadata,omitempty"` 51 52 ClusterLabels map[string]string `json:"clusterLabels,omitempty"` 53 InheritedClusterLabels map[string]string `json:"inheritedClusterLabels,omitempty"` 54 Credential string `json:"credential"` 55 UserSSHKeys []ClusterTemplateSSHKey `json:"userSSHKeys,omitempty"` 56 Spec ClusterSpec `json:"spec,omitempty"` 57 } 58 59 // ClusterTemplateSSHKey is the object for holding SSH key. 60 type ClusterTemplateSSHKey struct { 61 // ID is the name of the UserSSHKey object that is supposed to be assigned 62 // to any ClusterTemplateInstance created based on this template. 63 ID string `json:"id"` 64 // Name is the human readable SSH key name. 65 Name string `json:"name"` 66 } 67 68 // +kubebuilder:object:generate=true 69 // +kubebuilder:object:root=true 70 71 // ClusterTemplateList specifies a list of cluster templates. 72 type ClusterTemplateList struct { 73 metav1.TypeMeta `json:",inline"` 74 metav1.ListMeta `json:"metadata,omitempty"` 75 76 Items []ClusterTemplate `json:"items"` 77 }