|
| 1 | +/* |
| 2 | +Copyright 2021 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha4 |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | + addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1" |
| 22 | +) |
| 23 | + |
| 24 | +// NestedEtcdSpec defines the desired state of NestedEtcd |
| 25 | +type NestedEtcdSpec struct { |
| 26 | + // NestedComponentSpec contains the common and user-specified information that are |
| 27 | + // required for creating the component |
| 28 | + // +optional |
| 29 | + NestedComponentSpec `json:",inline"` |
| 30 | +} |
| 31 | + |
| 32 | +// NestedEtcdStatus defines the observed state of NestedEtcd |
| 33 | +type NestedEtcdStatus struct { |
| 34 | + // Ready is set if all resources have been created |
| 35 | + Ready bool `json:"ready,omitempty"` |
| 36 | + |
| 37 | + // EtcdDomain defines how to address the etcd instance |
| 38 | + Addresses []NestedEtcdAddress `json:"addresses,omitempty"` |
| 39 | + |
| 40 | + // CommonStatus allows addons status monitoring |
| 41 | + addonv1alpha1.CommonStatus `json:",inline"` |
| 42 | +} |
| 43 | + |
| 44 | +// EtcdAddress defines the observed addresses for etcd |
| 45 | +type NestedEtcdAddress struct { |
| 46 | + // IP Address of the etcd instance. |
| 47 | + // +optional |
| 48 | + IP string `json:"ip,omitempty"` |
| 49 | + |
| 50 | + // Hostname of the etcd instance |
| 51 | + Hostname string `json:"hostname,omitempty"` |
| 52 | + |
| 53 | + // Port of the etcd instance |
| 54 | + // +optional |
| 55 | + Port int32 `json:"port"` |
| 56 | +} |
| 57 | + |
| 58 | +//+kubebuilder:object:root=true |
| 59 | +//+kubebuilder:subresource:status |
| 60 | + |
| 61 | +// NestedEtcd is the Schema for the nestedetcds API |
| 62 | +type NestedEtcd struct { |
| 63 | + metav1.TypeMeta `json:",inline"` |
| 64 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 65 | + |
| 66 | + Spec NestedEtcdSpec `json:"spec,omitempty"` |
| 67 | + Status NestedEtcdStatus `json:"status,omitempty"` |
| 68 | +} |
| 69 | + |
| 70 | +//+kubebuilder:object:root=true |
| 71 | + |
| 72 | +// NestedEtcdList contains a list of NestedEtcd |
| 73 | +type NestedEtcdList struct { |
| 74 | + metav1.TypeMeta `json:",inline"` |
| 75 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 76 | + Items []NestedEtcd `json:"items"` |
| 77 | +} |
| 78 | + |
| 79 | +func init() { |
| 80 | + SchemeBuilder.Register(&NestedEtcd{}, &NestedEtcdList{}) |
| 81 | +} |
0 commit comments