-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcodercontrolplane_types.go
More file actions
132 lines (119 loc) · 6.13 KB
/
Copy pathcodercontrolplane_types.go
File metadata and controls
132 lines (119 loc) · 6.13 KB
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
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// CoderControlPlanePhasePending indicates the control plane has not reported ready yet.
CoderControlPlanePhasePending = "Pending"
// CoderControlPlanePhaseReady indicates at least one control plane pod is ready.
CoderControlPlanePhaseReady = "Ready"
// CoderControlPlaneConditionLicenseApplied indicates whether the operator uploaded the configured license.
CoderControlPlaneConditionLicenseApplied = "LicenseApplied"
// CoderControlPlaneLicenseTierNone indicates no license is currently installed.
CoderControlPlaneLicenseTierNone = "none"
// CoderControlPlaneLicenseTierTrial indicates a trial license is currently installed.
CoderControlPlaneLicenseTierTrial = "trial"
// CoderControlPlaneLicenseTierEnterprise indicates an enterprise license is currently installed.
CoderControlPlaneLicenseTierEnterprise = "enterprise"
// CoderControlPlaneLicenseTierPremium indicates a premium license is currently installed.
CoderControlPlaneLicenseTierPremium = "premium"
// CoderControlPlaneLicenseTierUnknown indicates the controller could not determine the current license tier.
CoderControlPlaneLicenseTierUnknown = "unknown"
// CoderControlPlaneEntitlementUnknown indicates the controller could not determine a feature entitlement.
CoderControlPlaneEntitlementUnknown = "unknown"
)
// CoderControlPlaneSpec defines the desired state of a CoderControlPlane.
type CoderControlPlaneSpec struct {
// Image is the container image used for the Coder control plane pod.
// +kubebuilder:default="ghcr.io/coder/coder:latest"
Image string `json:"image,omitempty"`
// Replicas is the desired number of control plane pods.
// +kubebuilder:default=1
Replicas *int32 `json:"replicas,omitempty"`
// Service controls the service created in front of the control plane.
// +kubebuilder:default={}
Service ServiceSpec `json:"service,omitempty"`
// ExtraArgs are appended to the default Coder server arguments.
ExtraArgs []string `json:"extraArgs,omitempty"`
// ExtraEnv are injected into the Coder control plane container.
ExtraEnv []corev1.EnvVar `json:"extraEnv,omitempty"`
// ImagePullSecrets are used by the pod to pull private images.
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// OperatorAccess configures bootstrap API access to the coderd instance.
// +kubebuilder:default={}
OperatorAccess OperatorAccessSpec `json:"operatorAccess,omitempty"`
// LicenseSecretRef references a Secret key containing a Coder Enterprise
// license JWT. When set, the controller uploads the license after the
// control plane is ready and re-uploads when the Secret value changes.
// +optional
LicenseSecretRef *SecretKeySelector `json:"licenseSecretRef,omitempty"`
}
// OperatorAccessSpec configures the controller-managed coderd operator user.
type OperatorAccessSpec struct {
// Disabled turns off creation and management of the `coder-k8s-operator`
// user and API token.
// +kubebuilder:default=false
Disabled bool `json:"disabled,omitempty"`
// GeneratedTokenSecretName stores the generated operator API token.
GeneratedTokenSecretName string `json:"generatedTokenSecretName,omitempty"`
}
// CoderControlPlaneStatus defines the observed state of a CoderControlPlane.
type CoderControlPlaneStatus struct {
// ObservedGeneration tracks the spec generation this status reflects.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// ReadyReplicas is the number of ready pods observed in the deployment.
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
// URL is the in-cluster URL for the control plane service.
URL string `json:"url,omitempty"`
// OperatorTokenSecretRef points to the Secret key containing the `coder-k8s-operator` API token.
OperatorTokenSecretRef *SecretKeySelector `json:"operatorTokenSecretRef,omitempty"`
// OperatorAccessReady reports whether operator API access bootstrap succeeded.
OperatorAccessReady bool `json:"operatorAccessReady,omitempty"`
// LicenseLastApplied is the timestamp of the most recent successful
// operator-managed license upload.
// +optional
LicenseLastApplied *metav1.Time `json:"licenseLastApplied,omitempty"`
// LicenseLastAppliedHash is the SHA-256 hex hash of the trimmed license JWT
// that LicenseLastApplied refers to.
// +optional
LicenseLastAppliedHash string `json:"licenseLastAppliedHash,omitempty"`
// LicenseTier is a best-effort classification of the currently applied license.
// Values: none, trial, enterprise, premium, unknown.
// +optional
LicenseTier string `json:"licenseTier,omitempty"`
// EntitlementsLastChecked is when the operator last queried coderd entitlements.
// +optional
EntitlementsLastChecked *metav1.Time `json:"entitlementsLastChecked,omitempty"`
// ExternalProvisionerDaemonsEntitlement is the entitlement value for feature
// "external_provisioner_daemons".
// Values: entitled, grace_period, not_entitled, unknown.
// +optional
ExternalProvisionerDaemonsEntitlement string `json:"externalProvisionerDaemonsEntitlement,omitempty"`
// Phase is a high-level readiness indicator.
Phase string `json:"phase,omitempty"`
// Conditions are Kubernetes-standard conditions for this resource.
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Namespaced
// +kubebuilder:subresource:status
// CoderControlPlane is the schema for Coder control plane resources.
type CoderControlPlane struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CoderControlPlaneSpec `json:"spec,omitempty"`
Status CoderControlPlaneStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// CoderControlPlaneList contains a list of CoderControlPlane objects.
type CoderControlPlaneList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CoderControlPlane `json:"items"`
}
func init() {
SchemeBuilder.Register(&CoderControlPlane{}, &CoderControlPlaneList{})
}