-
Notifications
You must be signed in to change notification settings - Fork 198
/
description.go
113 lines (91 loc) · 3.28 KB
/
description.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
Copyright 2021 The Clusternet Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Important: Run "make generated" to regenerate code after modifying this file
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope="Namespaced",shortName=desc,categories=clusternet
// +kubebuilder:printcolumn:name="DEPLOYER",type=string,JSONPath=".spec.deployer"
// +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// Description is the Schema for the resources to be installed
type Description struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DescriptionSpec `json:"spec"`
Status DescriptionStatus `json:"status,omitempty"`
}
// DescriptionSpec defines the spec of Description
type DescriptionSpec struct {
// Deployer indicates the deployer for this Description
//
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Enum=Helm;Generic
Deployer DescriptionDeployer `json:"deployer"`
// Charts describe all the helm charts to be installed
//
// +optional
Charts []ChartReference `json:"charts,omitempty"`
// Raw is the underlying serialization of all objects.
//
// +optional
Raw [][]byte `json:"raw,omitempty"`
}
// DescriptionStatus defines the observed state of Description
type DescriptionStatus struct {
// Phase denotes the phase of Description
// +optional
// +kubebuilder:validation:Enum=Pending;Success;Failure
Phase DescriptionPhase `json:"phase,omitempty"`
// Reason indicates the reason of DescriptionPhase
// +optional
Reason string `json:"reason,omitempty"`
}
type DescriptionDeployer string
const (
DescriptionHelmDeployer DescriptionDeployer = "Helm"
DescriptionGenericDeployer DescriptionDeployer = "Generic"
)
type DescriptionPhase string
const (
DescriptionPhaseSuccess DescriptionPhase = "Success"
DescriptionPhaseFailure DescriptionPhase = "Failure"
)
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// DescriptionList contains a list of Description
type DescriptionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Description `json:"items"`
}
type ChartReference struct {
// Namespace of the HelmChart.
//
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
Namespace string `json:"namespace"`
// Name of the HelmChart.
//
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
Name string `json:"name"`
}