github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/api/v1alpha1/toolchainstatus_types.go (about) 1 package v1alpha1 2 3 import ( 4 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 ) 6 7 // These are valid status condition reasons for Toolchain status 8 const ( 9 // ToolchainStatusUnreadyNotificationCreated is used when a notification has been sent to an admin mailing list 10 // after the toolchain status has been in an "unready" condition for an extended period of time 11 ToolchainStatusUnreadyNotificationCreated ConditionType = "ToolchainStatusUnreadyNotificationCreated" 12 13 // ToolchainStatusUnreadyNotificationCRCreatedReason is used to indicate the Unready Notification CR has been created 14 ToolchainStatusUnreadyNotificationCRCreatedReason = "UnreadyNotificationCRCreated" 15 16 // ToolchainStatusUnreadyNotificationCRCreationFailedReason is set when the controller fails to create an unready notification CR 17 ToolchainStatusUnreadyNotificationCRCreationFailedReason = "UnreadyNotificationCRCreationFailed" 18 19 // ToolchainStatusRestoredNotificationCRCreationFailedReason is set when the controller fails to create restored notification 20 ToolchainStatusRestoredNotificationCRCreationFailedReason = "RestoredNotificationCRCreationFailed" 21 22 // overall status condition reasons 23 ToolchainStatusAllComponentsReadyReason = "AllComponentsReady" 24 ToolchainStatusComponentsNotReadyReason = "ComponentsNotReady" 25 26 // deployment reasons 27 ToolchainStatusDeploymentReadyReason = "DeploymentReady" 28 ToolchainStatusDeploymentNotReadyReason = "DeploymentNotReady" 29 ToolchainStatusDeploymentNotFoundReason = "DeploymentNotFound" 30 ToolchainStatusDeploymentNotUpToDateReason = "DeploymentNotUpToDate" 31 ToolchainStatusDeploymentUpToDateReason = "DeploymentIsUpToDate" 32 ToolchainStatusDeploymentRevisionCheckDisabledReason = "DeploymentRevisionCheckDisabled" 33 ToolchainStatusDeploymentRevisionCheckGitHubErrorReason = "DeploymentRevisionCheckGitHubError" 34 ToolchainStatusDeploymentRevisionCheckOperatorErrorReason = "DeploymentRevisionCheckOperatorError" 35 36 // host connection reasons 37 ToolchainStatusClusterConnectionReadyReason = "HostConnectionReady" 38 ToolchainStatusClusterConnectionNotReadyReason = "HostConnectionNotReady" 39 ToolchainStatusClusterConnectionNotFoundReason = "ToolchainClusterNotFound" 40 ToolchainStatusClusterConnectionLastProbeTimeExceededReason = "ToolchainClusterLastProbeTimeExceeded" 41 42 // registration service reasons 43 ToolchainStatusRegServiceReadyReason = "RegServiceReady" 44 ToolchainStatusRegServiceNotReadyReason = "RegServiceNotReady" 45 46 // Host routes reasons 47 ToolchainStatusProxyRouteUnavailableReason = "ProxyRouteUnavailable" 48 ToolchainStatusHostRoutesAvailableReason = "HostRoutesAvailable" 49 50 // member status reasons 51 ToolchainStatusMemberStatusNotFoundReason = "MemberStatusNotFound" 52 ToolchainStatusMemberToolchainClusterMissingReason = "MemberToolchainClusterMissing" 53 ToolchainStatusMemberStatusConsoleRouteUnavailableReason = "ConsoleRouteUnavailable" 54 ToolchainStatusMemberStatusRoutesAvailableReason = "RoutesAvailable" 55 ToolchainStatusMemberStatusCheRouteUnavailableReason = "CheRouteUnavailable" 56 ToolchainStatusMemberStatusCheUserAPICheckFailedReason = "CheUserAPICheckFailed" 57 ToolchainStatusMemberStatusCheNotRequiredReason = "CheNotRequired" 58 ToolchainStatusMemberStatusCheAdminUserNotConfiguredReason = "CheAdminUserNotConfigured" 59 ToolchainStatusMemberStatusCheUserDeletionNotEnabledReason = "CheUserDeletionNotEnabled" 60 ToolchainStatusMemberStatusCheReadyReason = "CheReady" 61 62 // Metric Keys 63 // MasterUserRecordsPerDomainMetricKey the key to store the metric for the number of MasterUserRecords per email address domain 64 MasterUserRecordsPerDomainMetricKey = "masterUserRecordsPerDomain" 65 // UserSignupsPerActivationAndDomainMetricKey the key to store the metric for the number of UserSignups per activations and per email address domain 66 UserSignupsPerActivationAndDomainMetricKey = "userSignupsPerActivationAndDomain" 67 ) 68 69 // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. 70 71 // ToolchainStatusSpec defines the desired state of ToolchainStatus 72 // +k8s:openapi-gen=true 73 type ToolchainStatusSpec struct { 74 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file 75 // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html 76 77 // spec is intentionally empty since only the status fields will be used for reporting status of the toolchain 78 } 79 80 // ToolchainStatusStatus defines the observed state of the toolchain, including host cluster and member cluster components 81 // +k8s:openapi-gen=true 82 type ToolchainStatusStatus struct { 83 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file 84 // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html 85 86 // HostOperator is the status of a toolchain host operator 87 // +optional 88 HostOperator *HostOperatorStatus `json:"hostOperator,omitempty"` 89 90 // RegistrationService is the status of the registration service 91 // +optional 92 RegistrationService *HostRegistrationServiceStatus `json:"registrationService,omitempty"` 93 94 // Members is an array of member status objects 95 // +optional 96 // +patchMergeKey=clusterName 97 // +patchStrategy=merge 98 // +listType=map 99 // +listMapKey=clusterName 100 Members []Member `json:"members,omitempty" patchStrategy:"merge" patchMergeKey:"clusterName"` 101 102 // Metrics is a map that stores metrics to be exposed on Prometheus. 103 // +optional 104 // +mapType=atomic 105 // +patchStrategy=merge 106 Metrics map[string]Metric `json:"metrics,omitempty" patchStrategy:"merge"` 107 108 // HostRoutes/URLs of the host cluster, such as Proxy URL 109 // +optional 110 HostRoutes HostRoutes `json:"hostRoutes,omitempty"` 111 112 // Conditions is an array of the current overall toolchain status conditions 113 // Supported condition types: ConditionReady 114 // +optional 115 // +patchMergeKey=type 116 // +patchStrategy=merge 117 // +listType=map 118 // +listMapKey=type 119 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 120 } 121 122 // HostRoutes contains information about the public routes available to the user in the host cluster 123 // +k8s:openapi-gen=true 124 type HostRoutes struct { 125 // ProxyURL is the Proxy URL of the cluster 126 // +optional 127 ProxyURL string `json:"proxyURL,omitempty"` 128 129 // Conditions is an array of current member operator status conditions 130 // Supported condition types: ConditionReady 131 // +optional 132 // +patchMergeKey=type 133 // +patchStrategy=merge 134 // +listType=map 135 // +listMapKey=type 136 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 137 } 138 139 type Metric map[string]int 140 141 // HostOperatorStatus defines the observed state of a toolchain's host operator 142 // +k8s:openapi-gen=true 143 type HostOperatorStatus struct { 144 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file 145 // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html 146 147 // The version of the operator 148 Version string `json:"version"` 149 150 // The commit id from the host-operator repository used to build the operator 151 Revision string `json:"revision"` 152 153 // The timestamp of the host operator build 154 BuildTimestamp string `json:"buildTimestamp"` 155 156 // The status of the host operator's deployment 157 DeploymentName string `json:"deploymentName"` 158 159 // Conditions is an array of current host operator status conditions 160 // Supported condition types: ConditionReady 161 // +optional 162 // +patchMergeKey=type 163 // +patchStrategy=merge 164 // +listType=map 165 // +listMapKey=type 166 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 167 168 // The status of the revision check for host operator's deployment 169 // +optional 170 RevisionCheck RevisionCheck `json:"revisionCheck"` 171 } 172 173 // HostRegistrationServiceStatus defines the observed state of a toolchain's registration service 174 // +k8s:openapi-gen=true 175 type HostRegistrationServiceStatus struct { 176 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file 177 // Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html 178 179 // Deployment is the status of the registration service's deployment 180 Deployment RegistrationServiceDeploymentStatus `json:"deployment"` 181 182 // RegistrationServiceResources is the status for resources created for the registration service 183 RegistrationServiceResources RegistrationServiceResourcesStatus `json:"registrationServiceResources"` 184 185 // Health provides health status of the registration service 186 Health RegistrationServiceHealth `json:"health"` 187 188 // The status of the revision check for registration service 189 // +optional 190 RevisionCheck RevisionCheck `json:"revisionCheck"` 191 } 192 193 // RegistrationServiceDeploymentStatus contains status of the registration service's deployment 194 // +k8s:openapi-gen=true 195 type RegistrationServiceDeploymentStatus struct { 196 // The host operator deployment name 197 Name string `json:"name"` 198 199 // Conditions is an array of current deployment status conditions for a host operator 200 // Supported condition types: Available, Progressing 201 // +optional 202 // +patchMergeKey=type 203 // +patchStrategy=merge 204 // +listType=map 205 // +listMapKey=type 206 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 207 } 208 209 // RegistrationServiceHealth contains health status of the registration service 210 // +k8s:openapi-gen=true 211 type RegistrationServiceHealth struct { 212 Alive string `json:"alive"` 213 BuildTime string `json:"buildTime"` 214 Environment string `json:"environment"` 215 Revision string `json:"revision"` 216 StartTime string `json:"startTime"` 217 218 // Conditions is an array of status conditions for the health of the registration service 219 // Supported condition types: ConditionReady 220 // +optional 221 // +patchMergeKey=type 222 // +patchStrategy=merge 223 // +listType=map 224 // +listMapKey=type 225 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 226 } 227 228 // Member contains the status of a member cluster 229 // +k8s:openapi-gen=true 230 type Member struct { 231 // APIEndpoint is the server API URL of the cluster 232 // +optional 233 APIEndpoint string `json:"apiEndpoint,omitempty"` 234 235 // The cluster identifier 236 ClusterName string `json:"clusterName"` 237 238 // Number of Spaces created within the member cluster 239 // +optional 240 SpaceCount int `json:"spaceCount,omitempty"` 241 242 // The array of member status objects 243 MemberStatus MemberStatusStatus `json:"memberStatus"` 244 } 245 246 // RegistrationServiceResourcesStatus contains conditions for creation/deployment of registration service resources 247 // +k8s:openapi-gen=true 248 type RegistrationServiceResourcesStatus struct { 249 // Conditions is an array of current registration service resource status conditions 250 // Supported condition types: Deployed, Deploying, DeployingFailed 251 // +optional 252 // +patchMergeKey=type 253 // +patchStrategy=merge 254 // +listType=map 255 // +listMapKey=type 256 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 257 } 258 259 // RevisionCheck contains status of revision check for the component, 260 // it highlights if the component is up-to-date and the deployed version matches the latest one in the GitHub repository. 261 // +k8s:openapi-gen=true 262 type RevisionCheck struct { 263 // Conditions is an array of status conditions for the health of the registration service 264 // Supported condition types: ConditionReady 265 // +optional 266 // +patchMergeKey=type 267 // +patchStrategy=merge 268 // +listType=map 269 // +listMapKey=type 270 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 271 } 272 273 //+kubebuilder:object:root=true 274 //+kubebuilder:subresource:status 275 276 // ToolchainStatus is used to track overall toolchain status 277 // +k8s:openapi-gen=true 278 // +kubebuilder:subresource:status 279 // +kubebuilder:resource:scope=Namespaced 280 // +kubebuilder:printcolumn:name="MURs",type="integer",JSONPath=`.status.hostOperator.masterUserRecordCount` 281 // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status` 282 // +kubebuilder:printcolumn:name="Last Updated",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].lastUpdatedTime` 283 // +kubebuilder:validation:XPreserveUnknownFields 284 // +operator-sdk:gen-csv:customresourcedefinitions.displayName="CodeReady Toolchain Status" 285 type ToolchainStatus struct { 286 metav1.TypeMeta `json:",inline"` 287 metav1.ObjectMeta `json:"metadata,omitempty"` 288 289 Spec ToolchainStatusSpec `json:"spec,omitempty"` 290 Status ToolchainStatusStatus `json:"status,omitempty"` 291 } 292 293 //+kubebuilder:object:root=true 294 295 // ToolchainStatusList contains a list of ToolchainStatus 296 type ToolchainStatusList struct { 297 metav1.TypeMeta `json:",inline"` 298 metav1.ListMeta `json:"metadata,omitempty"` 299 Items []ToolchainStatus `json:"items"` 300 } 301 302 func init() { 303 SchemeBuilder.Register(&ToolchainStatus{}, &ToolchainStatusList{}) 304 }