/
nginx_types.go
68 lines (58 loc) · 2.15 KB
/
nginx_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
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NginxSpec defines the desired state of a Nginx.
type NginxSpec struct {
// Nginx Version to deploy
Version string `json:"version"`
// How long to sleep before updating .Status.
ReconcileDelay metav1.Duration `json:"reconcileDelay"`
}
// NginxStatus defines the observed state of a Nginx
type NginxStatus struct {
// The most recent generation observed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions is a list of status conditions ths object is in.
Conditions []metav1.Condition `json:"conditions,omitempty"`
// DEPRECATED: This field is not part of any API contract
// it will go away as soon as kubectl can print conditions!
// Human readable status - please use .Conditions from code
Phase NginxPhase `json:"phase,omitempty"`
// Version of the operator
OperatorVersion string `json:"operatorVersion,omitempty"`
}
const (
NginxAvailable = "Available"
)
type NginxPhase string
// Well-known Nginx Phases for printing a Status in kubectl,
// see deprecation notice in NginxStatus for details.
const (
NginxPhasePending NginxPhase = "Pending"
NginxPhaseReady NginxPhase = "Ready"
NginxPhaseNotReady NginxPhase = "NotReady"
)
// Nginx controls the handover process between two operators.
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Operator Version",type="string",JSONPath=".status.operatorVersion"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type Nginx struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NginxSpec `json:"spec,omitempty"`
// +kubebuilder:default={phase:Pending}
Status NginxStatus `json:"status,omitempty"`
}
// NginxList contains a list of Nginxs
// +kubebuilder:object:root=true
type NginxList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Nginx `json:"items"`
}
func init() {
SchemeBuilder.Register(&Nginx{}, &NginxList{})
}