-
Notifications
You must be signed in to change notification settings - Fork 117
/
servicemeshcontrolplane_types.go
149 lines (123 loc) · 6.49 KB
/
servicemeshcontrolplane_types.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/maistra/istio-operator/pkg/apis/maistra/status"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
func init() {
SchemeBuilder.Register(&ServiceMeshControlPlane{}, &ServiceMeshControlPlaneList{})
}
const DefaultTemplate = "default"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceMeshControlPlane represents a deployment of the service mesh control
// plane. The control plane components are deployed in the namespace in which
// the ServiceMeshControlPlane resides. The configuration options for the
// components that comprise the control plane are specified in this object.
// +k8s:openapi-gen=true
// +kubebuilder:resource:shortName=smcp,categories=maistra-io
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.annotations.readyComponentCount",description="How many of the total number of components are ready"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Reconciled\")].reason",description="Whether or not the control plane installation is up to date."
// +kubebuilder:printcolumn:name="Template",type="string",JSONPath=".status.lastAppliedConfiguration.template",description="The configuration template to use as the base."
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.lastAppliedConfiguration.version",description="The actual current version of the control plane installation."
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the object"
// +kubebuilder:printcolumn:name="Image HUB",type="string",JSONPath=".status.lastAppliedConfiguration.istio.global.hub",description="The image hub used as the base for all component images.",priority=1
type ServiceMeshControlPlane struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// The specification of the desired state of this ServiceMeshControlPlane.
// This includes the configuration options for all components that comprise
// the control plane.
// +kubebuilder:validation:Required
Spec ControlPlaneSpec `json:"spec"`
// The current status of this ServiceMeshControlPlane and the components
// that comprise the control plane. This data may be out of date by some
// window of time.
Status ControlPlaneStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ServiceMeshControlPlaneList contains a list of ServiceMeshControlPlane
type ServiceMeshControlPlaneList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ServiceMeshControlPlane `json:"items"`
}
// ControlPlaneStatus represents the current state of a ServiceMeshControlPlane.
type ControlPlaneStatus struct {
status.StatusBase `json:",inline"`
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
status.StatusType `json:",inline"`
// The generation observed by the controller during the most recent
// reconciliation. The information in the status pertains to this particular
// generation of the object.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// The last version that was reconciled.
ReconciledVersion string `json:"reconciledVersion,omitempty"`
// The list of components comprising the control plane and their statuses.
// +nullable
status.ComponentStatusList `json:",inline"`
// The full specification of the configuration options that were applied
// to the components of the control plane during the most recent reconciliation.
// +optional
LastAppliedConfiguration ControlPlaneSpec `json:"lastAppliedConfiguration"`
}
// GetReconciledVersion returns the reconciled version, or a default for older resources
func (s *ControlPlaneStatus) GetReconciledVersion() string {
if s == nil {
return status.ComposeReconciledVersion("0.0.0", 0)
}
if s.ReconciledVersion == "" {
return status.ComposeReconciledVersion("1.0.0", s.ObservedGeneration)
}
return s.ReconciledVersion
}
// ControlPlaneSpec represents the configuration for installing a control plane.
type ControlPlaneSpec struct {
// Template selects the template to use for default values. Defaults to
// "default" when not set.
// DEPRECATED - use Profiles instead
// +optional
Template string `json:"template,omitempty"`
// Profiles selects the profile to use for default values. Defaults to
// "default" when not set. Takes precedence over Template.
// +optional
Profiles []string `json:"profiles,omitempty"`
// Version specifies what Maistra version of the control plane to install.
// When creating a new ServiceMeshControlPlane with an empty version, the
// admission webhook sets the version to the latest version supported by
// the operator.
// +optional
Version string `json:"version,omitempty"`
// Deprecated: No longer used anywhere.
// Previously used to specify the NetworkType of the cluster. Defaults to "subnet".
// +optional
NetworkType NetworkType `json:"networkType,omitempty"`
// Specifies the Istio configuration options that are passed to Helm when the
// Istio charts are rendered. These options are usually populated from the
// template specified in the spec.template field, but individual values can
// be overridden here.
// More info: https://maistra.io/docs/installation/installation-options/
// +optional
// +kubebuilder:validation:Optional
Istio *HelmValues `json:"istio,omitempty"`
// Specifies the 3Scale configuration options that are passed to Helm when the
// 3Scale charts are rendered. These values are usually populated from the
// template specified in the spec.template field, but individual values can
// be overridden here.
// More info: https://maistra.io/docs/installation/installation-options/#_3scale
// +optional
// +kubebuilder:validation:Optional
ThreeScale *HelmValues `json:"threeScale,omitempty"`
}
// NetworkType is type definition representing the network type of the cluster
type NetworkType string
const (
// NetworkTypeSubnet when using ovs-subnet
NetworkTypeSubnet NetworkType = "subnet"
// NetworkTypeMultitenant when using ovs-multitenant
NetworkTypeMultitenant NetworkType = "multitenant"
// NetworkTypeNetworkPolicy when using ovs-networkpolicy
NetworkTypeNetworkPolicy NetworkType = "networkpolicy"
)