github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/pkg/apis/projectcalico/v3/clusterinfo.go (about) 1 // Copyright (c) 2017, 2020-2021 Tigera, Inc. All rights reserved. 2 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package v3 16 17 import ( 18 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 19 ) 20 21 const ( 22 KindClusterInformation = "ClusterInformation" 23 KindClusterInformationList = "ClusterInformationList" 24 ) 25 26 // +genclient:nonNamespaced 27 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 28 29 // ClusterInformationList is a list of ClusterInformation objects. 30 type ClusterInformationList struct { 31 metav1.TypeMeta `json:",inline"` 32 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 33 34 Items []ClusterInformation `json:"items" protobuf:"bytes,2,rep,name=items"` 35 } 36 37 // +genclient 38 // +genclient:nonNamespaced 39 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 40 41 type ClusterInformation struct { 42 metav1.TypeMeta `json:",inline"` 43 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 44 45 Spec ClusterInformationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` 46 } 47 48 // ClusterInformationSpec contains the values of describing the cluster. 49 type ClusterInformationSpec struct { 50 // ClusterGUID is the GUID of the cluster 51 ClusterGUID string `json:"clusterGUID,omitempty" validate:"omitempty"` 52 // ClusterType describes the type of the cluster 53 ClusterType string `json:"clusterType,omitempty" validate:"omitempty"` 54 // CalicoVersion is the version of Calico that the cluster is running 55 CalicoVersion string `json:"calicoVersion,omitempty" validate:"omitempty"` 56 // CNXVersion is the version of CNX that the cluster is running 57 CNXVersion string `json:"cnxVersion,omitempty" validate:"omitempty"` 58 // DatastoreReady is used during significant datastore migrations to signal to components 59 // such as Felix that it should wait before accessing the datastore. 60 DatastoreReady *bool `json:"datastoreReady,omitempty"` 61 // Variant declares which variant of Calico should be active. 62 Variant string `json:"variant,omitempty"` 63 } 64 65 // New ClusterInformation creates a new (zeroed) ClusterInformation struct with the TypeMetadata 66 // initialized to the current version. 67 func NewClusterInformation() *ClusterInformation { 68 return &ClusterInformation{ 69 TypeMeta: metav1.TypeMeta{ 70 Kind: KindClusterInformation, 71 APIVersion: GroupVersionCurrent, 72 }, 73 } 74 }