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