kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/types/v1beta1/types.go (about) 1 /* 2 3 Copyright 2020 The KubeSphere Authors. 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 17 */ 18 19 package v1beta1 20 21 import ( 22 v1 "k8s.io/api/core/v1" 23 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 "k8s.io/apimachinery/pkg/runtime" 25 ) 26 27 type GenericClusterReference struct { 28 Name string `json:"name"` 29 } 30 31 type GenericPlacementFields struct { 32 // +listType=map 33 // +listMapKey=name 34 Clusters []GenericClusterReference `json:"clusters,omitempty"` 35 ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"` 36 } 37 type GenericPlacementSpec struct { 38 Placement GenericPlacementFields `json:"placement,omitempty"` 39 } 40 41 type GenericPlacement struct { 42 metav1.TypeMeta `json:",inline"` 43 metav1.ObjectMeta `json:"metadata,omitempty"` 44 45 Spec GenericPlacementSpec `json:"spec,omitempty"` 46 } 47 48 type ClusterOverride struct { 49 Op string `json:"op,omitempty"` 50 Path string `json:"path"` 51 // +kubebuilder:pruning:PreserveUnknownFields 52 Value runtime.RawExtension `json:"value,omitempty"` 53 } 54 55 type GenericOverrideItem struct { 56 ClusterName string `json:"clusterName"` 57 ClusterOverrides []ClusterOverride `json:"clusterOverrides,omitempty"` 58 } 59 60 type GenericOverrideSpec struct { 61 Overrides []GenericOverrideItem `json:"overrides,omitempty"` 62 } 63 64 type GenericOverride struct { 65 metav1.TypeMeta `json:",inline"` 66 metav1.ObjectMeta `json:"metadata,omitempty"` 67 68 Spec *GenericOverrideSpec `json:"spec,omitempty"` 69 } 70 71 type ConditionType string 72 73 type AggregateReason string 74 75 type PropagationStatus string 76 77 type GenericClusterStatus struct { 78 Name string `json:"name"` 79 Status PropagationStatus `json:"status,omitempty"` 80 } 81 82 type GenericCondition struct { 83 // Type of cluster condition 84 Type ConditionType `json:"type"` 85 // Status of the condition, one of True, False, Unknown. 86 Status v1.ConditionStatus `json:"status"` 87 // Last time reconciliation resulted in an error or the last time a 88 // change was propagated to member clusters. 89 // +optional 90 LastUpdateTime string `json:"lastUpdateTime,omitempty"` 91 // Last time the condition transit from one status to another. 92 // +optional 93 LastTransitionTime string `json:"lastTransitionTime,omitempty"` 94 // (brief) reason for the condition's last transition. 95 // +optional 96 Reason AggregateReason `json:"reason,omitempty"` 97 } 98 99 type GenericFederatedStatus struct { 100 ObservedGeneration int64 `json:"observedGeneration,omitempty"` 101 Conditions []*GenericCondition `json:"conditions,omitempty"` 102 Clusters []GenericClusterStatus `json:"clusters,omitempty"` 103 } 104 105 type GenericFederatedResource struct { 106 metav1.TypeMeta `json:",inline"` 107 metav1.ObjectMeta `json:"metadata,omitempty"` 108 109 Status *GenericFederatedStatus `json:"status,omitempty"` 110 }