kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/types/v1beta2/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 v1beta2
    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  	Clusters        []GenericClusterReference `json:"clusters,omitempty"`
    33  	ClusterSelector *metav1.LabelSelector     `json:"clusterSelector,omitempty"`
    34  }
    35  type GenericPlacementSpec struct {
    36  	Placement GenericPlacementFields `json:"placement,omitempty"`
    37  }
    38  
    39  type GenericPlacement struct {
    40  	metav1.TypeMeta   `json:",inline"`
    41  	metav1.ObjectMeta `json:"metadata,omitempty"`
    42  
    43  	Spec GenericPlacementSpec `json:"spec,omitempty"`
    44  }
    45  
    46  type ClusterOverride struct {
    47  	Op   string `json:"op,omitempty"`
    48  	Path string `json:"path"`
    49  	// +kubebuilder:pruning:PreserveUnknownFields
    50  	Value runtime.RawExtension `json:"value,omitempty"`
    51  }
    52  
    53  type GenericOverrideItem struct {
    54  	ClusterName      string            `json:"clusterName"`
    55  	ClusterOverrides []ClusterOverride `json:"clusterOverrides,omitempty"`
    56  }
    57  
    58  type GenericOverrideSpec struct {
    59  	Overrides []GenericOverrideItem `json:"overrides,omitempty"`
    60  }
    61  
    62  type GenericOverride struct {
    63  	metav1.TypeMeta   `json:",inline"`
    64  	metav1.ObjectMeta `json:"metadata,omitempty"`
    65  
    66  	Spec *GenericOverrideSpec `json:"spec,omitempty"`
    67  }
    68  
    69  type ConditionType string
    70  
    71  type AggregateReason string
    72  
    73  type PropagationStatus string
    74  
    75  type GenericClusterStatus struct {
    76  	Name   string            `json:"name"`
    77  	Status PropagationStatus `json:"status,omitempty"`
    78  }
    79  
    80  type GenericCondition struct {
    81  	// Type of cluster condition
    82  	Type ConditionType `json:"type"`
    83  	// Status of the condition, one of True, False, Unknown.
    84  	Status v1.ConditionStatus `json:"status"`
    85  	// Last time reconciliation resulted in an error or the last time a
    86  	// change was propagated to member clusters.
    87  	// +optional
    88  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
    89  	// Last time the condition transit from one status to another.
    90  	// +optional
    91  	LastTransitionTime string `json:"lastTransitionTime,omitempty"`
    92  	// (brief) reason for the condition's last transition.
    93  	// +optional
    94  	Reason AggregateReason `json:"reason,omitempty"`
    95  }
    96  
    97  type GenericFederatedStatus struct {
    98  	ObservedGeneration int64                  `json:"observedGeneration,omitempty"`
    99  	Conditions         []*GenericCondition    `json:"conditions,omitempty"`
   100  	Clusters           []GenericClusterStatus `json:"clusters,omitempty"`
   101  }
   102  
   103  type GenericFederatedResource struct {
   104  	metav1.TypeMeta   `json:",inline"`
   105  	metav1.ObjectMeta `json:"metadata,omitempty"`
   106  
   107  	Status *GenericFederatedStatus `json:"status,omitempty"`
   108  }