github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/api/v1alpha1/memberstatus_types.go (about)

     1  package v1alpha1
     2  
     3  import (
     4  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     5  )
     6  
     7  // NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
     8  
     9  // MemberStatusSpec defines the desired state of MemberStatus
    10  // +k8s:openapi-gen=true
    11  type MemberStatusSpec struct {
    12  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    13  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    14  
    15  	// spec is intentionally empty since only the status fields will be used for reporting status of the toolchain
    16  }
    17  
    18  // MemberStatusStatus defines the observed state of the toolchain member status
    19  // +k8s:openapi-gen=true
    20  type MemberStatusStatus struct {
    21  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    22  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    23  
    24  	// Che is the status of Che/CRW, such as installed and whether the member configuration is correct
    25  	// +optional
    26  	Che *CheStatus `json:"che,omitempty"`
    27  
    28  	// MemberOperator is the status of a toolchain member operator
    29  	// +optional
    30  	MemberOperator *MemberOperatorStatus `json:"memberOperator,omitempty"`
    31  
    32  	// HostConnection is the status of the connection with the host cluster
    33  	// +optional
    34  	HostConnection *ToolchainClusterStatus `json:"hostConnection,omitempty"`
    35  
    36  	// Host is the status of the connection with the host cluster
    37  	// +optional
    38  	Host *HostStatus `json:"host,omitempty"`
    39  
    40  	// Conditions is an array of current toolchain status conditions
    41  	// Supported condition types: ConditionReady
    42  	// +optional
    43  	// +patchMergeKey=type
    44  	// +patchStrategy=merge
    45  	// +listType=map
    46  	// +listMapKey=type
    47  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
    48  
    49  	// Resource usage of the cluster
    50  	// +optional
    51  	ResourceUsage ResourceUsage `json:"resourceUsage,omitempty"`
    52  
    53  	// Routes/URLs of the cluster, such as Console and Che Dashboard URLs
    54  	// +optional
    55  	Routes *Routes `json:"routes,omitempty"`
    56  }
    57  
    58  // CheStatus contains information about the status of Che/CRW, such as installed and whether the member configuration is correct
    59  // +k8s:openapi-gen=true
    60  type CheStatus struct {
    61  	// Conditions is an array of current Che status conditions
    62  	// Supported condition types: ConditionReady
    63  	// +optional
    64  	// +patchMergeKey=type
    65  	// +patchStrategy=merge
    66  	// +listType=map
    67  	// +listMapKey=type
    68  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
    69  }
    70  
    71  // Routes contains information about the public routes available to the user in the cluster
    72  // +k8s:openapi-gen=true
    73  type Routes struct {
    74  	// ConsoleURL is the web console URL of the cluster
    75  	// +optional
    76  	ConsoleURL string `json:"consoleURL,omitempty"`
    77  
    78  	// CheDashboardURL is the Che Dashboard URL of the cluster if Che is installed
    79  	// +optional
    80  	CheDashboardURL string `json:"cheDashboardURL,omitempty"`
    81  
    82  	// Conditions is an array of current member operator status conditions
    83  	// Supported condition types: ConditionReady
    84  	// +optional
    85  	// +patchMergeKey=type
    86  	// +patchStrategy=merge
    87  	// +listType=map
    88  	// +listMapKey=type
    89  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
    90  }
    91  
    92  // Contains information about the resource usage of the cluster
    93  // +k8s:openapi-gen=true
    94  type ResourceUsage struct {
    95  	// How many percent of the available memory is used per node role (eg. worker, master)
    96  	// +optional
    97  	MemoryUsagePerNodeRole map[string]int `json:"memoryUsagePerNodeRole,omitempty"`
    98  }
    99  
   100  // HostStatus defines the status of the connection with the host cluster
   101  type HostStatus struct {
   102  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
   103  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
   104  
   105  	// Conditions is an array of current member operator status conditions
   106  	// Supported condition types: ConditionReady
   107  	// +optional
   108  	// +patchMergeKey=type
   109  	// +patchStrategy=merge
   110  	// +listType=map
   111  	// +listMapKey=type
   112  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
   113  }
   114  
   115  // MemberOperatorStatus defines the observed state of a toolchain's member operator
   116  type MemberOperatorStatus struct {
   117  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
   118  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
   119  
   120  	// The version of the operator
   121  	Version string `json:"version"`
   122  
   123  	// The commit id from the member-operator repository used to build the operator
   124  	Revision string `json:"revision"`
   125  
   126  	// The timestamp of the member operator build
   127  	BuildTimestamp string `json:"buildTimestamp"`
   128  
   129  	// The status of the member operator's deployment
   130  	DeploymentName string `json:"deploymentName"`
   131  
   132  	// Conditions is an array of current member operator status conditions
   133  	// Supported condition types: ConditionReady
   134  	// +optional
   135  	// +patchMergeKey=type
   136  	// +patchStrategy=merge
   137  	// +listType=map
   138  	// +listMapKey=type
   139  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
   140  
   141  	// The status of the revision check for member operator's deployment
   142  	// +optional
   143  	RevisionCheck RevisionCheck `json:"revisionCheck"`
   144  }
   145  
   146  //+kubebuilder:object:root=true
   147  //+kubebuilder:subresource:status
   148  
   149  // MemberStatus is used to track toolchain member status
   150  // +k8s:openapi-gen=true
   151  // +kubebuilder:subresource:status
   152  // +kubebuilder:resource:scope=Namespaced
   153  // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`
   154  // +kubebuilder:printcolumn:name="Last Updated",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].lastUpdatedTime`
   155  // +kubebuilder:validation:XPreserveUnknownFields
   156  // +operator-sdk:gen-csv:customresourcedefinitions.displayName="CodeReady Toolchain Member Status"
   157  type MemberStatus struct {
   158  	metav1.TypeMeta   `json:",inline"`
   159  	metav1.ObjectMeta `json:"metadata,omitempty"`
   160  
   161  	Spec   MemberStatusSpec   `json:"spec,omitempty"`
   162  	Status MemberStatusStatus `json:"status,omitempty"`
   163  }
   164  
   165  //+kubebuilder:object:root=true
   166  
   167  // MemberStatusList contains a list of MemberStatus
   168  type MemberStatusList struct {
   169  	metav1.TypeMeta `json:",inline"`
   170  	metav1.ListMeta `json:"metadata,omitempty"`
   171  	Items           []MemberStatus `json:"items"`
   172  }
   173  
   174  func init() {
   175  	SchemeBuilder.Register(&MemberStatus{}, &MemberStatusList{})
   176  }