Skip to content

Commit b5ebf7b

Browse files
authored
Merge pull request kubernetes-sigs#251 from aamoyel/cluster-class
Add KubevirtClusterTemplate resource to support ClusterClass feature
2 parents 0fe9004 + af6825e commit b5ebf7b

File tree

7 files changed

+401
-5
lines changed

7 files changed

+401
-5
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
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 v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22+
)
23+
24+
// KubevirtClusterTemplateResource describes the data needed to create a KubevirtCluster from a template.
25+
type KubevirtClusterTemplateResource struct {
26+
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
27+
Spec KubevirtClusterSpec `json:"spec"`
28+
}
29+
30+
// KubevirtClusterTemplateSpec defines the desired state of KubevirtClusterTemplate.
31+
type KubevirtClusterTemplateSpec struct {
32+
Template KubevirtClusterTemplateResource `json:"template"`
33+
}
34+
35+
// +kubebuilder:object:root=true
36+
// +kubebuilder:resource:path=kubevirtclustertemplates,scope=Namespaced,categories=cluster-api,shortName=kct
37+
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="KubevirtClusterTemplate is immutable"
38+
39+
// KubevirtClusterTemplate is the Schema for the kubevirtclustertemplates API.
40+
type KubevirtClusterTemplate struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
Spec KubevirtClusterTemplateSpec `json:"spec,omitempty"`
44+
}
45+
46+
// +kubebuilder:object:root=true
47+
48+
// KubevirtClusterTemplateList contains a list of KubevirtClusterTemplates.
49+
type KubevirtClusterTemplateList struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ListMeta `json:"metadata,omitempty"`
52+
Items []KubevirtClusterTemplate `json:"items"`
53+
}
54+
55+
func init() {
56+
SchemeBuilder.Register(&KubevirtClusterTemplate{}, &KubevirtClusterTemplateList{})
57+
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)