-
Notifications
You must be signed in to change notification settings - Fork 464
/
types_defaults.go
130 lines (109 loc) · 4.19 KB
/
types_defaults.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
)
// DefaultSpec contains common status fields for every extension resource.
type DefaultSpec struct {
// Type contains the instance of the resource's kind.
Type string `json:"type"`
// ProviderConfig is the provider specific configuration.
// +kubebuilder:validation:XPreserveUnknownFields
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
ProviderConfig *runtime.RawExtension `json:"providerConfig,omitempty"`
}
// GetExtensionType implements Spec.
func (d *DefaultSpec) GetExtensionType() string {
return d.Type
}
// GetExtensionPurpose implements Spec.
func (d *DefaultSpec) GetExtensionPurpose() *string {
return nil
}
// GetProviderConfig implements Spec.
func (d *DefaultSpec) GetProviderConfig() *runtime.RawExtension {
return d.ProviderConfig
}
// DefaultStatus contains common status fields for every extension resource.
type DefaultStatus struct {
// ProviderStatus contains provider-specific status.
// +kubebuilder:validation:XPreserveUnknownFields
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"`
// Conditions represents the latest available observations of a Seed's current state.
// +optional
Conditions []gardencorev1beta1.Condition `json:"conditions,omitempty"`
// LastError holds information about the last occurred error during an operation.
// +optional
LastError *gardencorev1beta1.LastError `json:"lastError,omitempty"`
// LastOperation holds information about the last operation on the resource.
// +optional
LastOperation *gardencorev1beta1.LastOperation `json:"lastOperation,omitempty"`
// ObservedGeneration is the most recent generation observed for this resource.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// State can be filled by the operating controller with what ever data it needs.
// +kubebuilder:validation:XPreserveUnknownFields
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
State *runtime.RawExtension `json:"state,omitempty"`
// Resources holds a list of named resource references that can be referred to in the state by their names.
// +optional
Resources []gardencorev1beta1.NamedResourceReference `json:"resources,omitempty"`
}
// GetProviderStatus implements Status.
func (d *DefaultStatus) GetProviderStatus() *runtime.RawExtension {
return d.ProviderStatus
}
// GetConditions implements Status.
func (d *DefaultStatus) GetConditions() []gardencorev1beta1.Condition {
return d.Conditions
}
// SetConditions implements Status.
func (d *DefaultStatus) SetConditions(c []gardencorev1beta1.Condition) {
d.Conditions = c
}
// GetLastOperation implements Status.
func (d *DefaultStatus) GetLastOperation() *gardencorev1beta1.LastOperation {
return d.LastOperation
}
// SetLastOperation implements Status.
func (d *DefaultStatus) SetLastOperation(lastOp *gardencorev1beta1.LastOperation) {
d.LastOperation = lastOp
}
// GetLastError implements Status.
func (d *DefaultStatus) GetLastError() *gardencorev1beta1.LastError {
return d.LastError
}
// SetLastError implements Status.
func (d *DefaultStatus) SetLastError(lastErr *gardencorev1beta1.LastError) {
d.LastError = lastErr
}
// GetObservedGeneration implements Status.
func (d *DefaultStatus) GetObservedGeneration() int64 {
return d.ObservedGeneration
}
// SetObservedGeneration implements Status.
func (d *DefaultStatus) SetObservedGeneration(generation int64) {
d.ObservedGeneration = generation
}
// GetState implements Status.
func (d *DefaultStatus) GetState() *runtime.RawExtension {
return d.State
}
// SetState implements Status.
func (d *DefaultStatus) SetState(state *runtime.RawExtension) {
d.State = state
}
// GetResources implements Status.
func (d *DefaultStatus) GetResources() []gardencorev1beta1.NamedResourceReference {
return d.Resources
}
// SetResources implements Status.
func (d *DefaultStatus) SetResources(namedResourceReference []gardencorev1beta1.NamedResourceReference) {
d.Resources = namedResourceReference
}