@@ -79,6 +79,61 @@ type ConfigResource struct {
79
79
// OwnerReferences is the list of owner references.
80
80
// +optional
81
81
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
82
+ // OptionalFields is the list of fields that could be updated additionally.
83
+ // +optional
84
+ OptionalFields []OptionalField `json:"optionalFields,omitempty"`
85
+ }
86
+
87
+ // +kubebuilder:pruning:PreserveUnknownFields
88
+ // OptionalField defines the optional field for the resource.
89
+ type OptionalField struct {
90
+ // Path is the json path of the field.
91
+ Path string `json:"path"`
92
+ // Operation is the operation of the field.
93
+ Operation Operation `json:"operation"`
94
+ // MatchExpressions is the match expression of the field.
95
+ // +optional
96
+ MatchExpressions []MatchExpression `json:"matchExpressions,omitempty"`
97
+ // ValueFrom is the field value from the object
98
+ // +optional
99
+ ValueFrom * ValueFrom `json:"valueFrom,omitempty"`
100
+ }
101
+
102
+ // +kubebuilder:pruning:PreserveUnknownFields
103
+ // MatchExpression defines the match expression of the field.
104
+ type MatchExpression struct {
105
+ // Key is the key of the field.
106
+ Key string `json:"key"`
107
+ // Operator is the operator of the field.
108
+ Operator ExpressionOperator `json:"operator"`
109
+ // Values is the values of the field.
110
+ // +optional
111
+ Values []string `json:"values"`
112
+ // ObjectRef is the reference of the object.
113
+ // +optional
114
+ ObjectRef * ObjectRef `json:"objectRef,omitempty"`
115
+ }
116
+
117
+ // ObjectRef defines the reference of the object.
118
+ type ObjectRef struct {
119
+ // APIVersion is the version of the object.
120
+ APIVersion string `json:"apiVersion"`
121
+ // Kind is the kind of the object.
122
+ Kind string `json:"kind"`
123
+ // Name is the name of the object.
124
+ Name string `json:"name"`
125
+ // Namespace is the namespace of the object.
126
+ // +optional
127
+ Namespace string `json:"namespace"`
128
+ }
129
+
130
+ // ValueFrom defines the field value from the object.
131
+ type ValueFrom struct {
132
+ // Path is the json path of the field.
133
+ Path string `json:"path"`
134
+ // ObjectRef is the reference of the object.
135
+ // +optional
136
+ ObjectRef * ObjectRef `json:"objectRef,omitempty"`
82
137
}
83
138
84
139
type OwnerReference struct {
@@ -161,6 +216,26 @@ const (
161
216
ServiceNone ServicePhase = ""
162
217
)
163
218
219
+ // Operation defines the operation of the field.
220
+ type Operation string
221
+
222
+ // Operation type.
223
+ const (
224
+ OperationAdd Operation = "add"
225
+ OperationRemove Operation = "remove"
226
+ )
227
+
228
+ // Operator defines the operator type.
229
+ type ExpressionOperator string
230
+
231
+ // Operator type.
232
+ const (
233
+ OperatorIn ExpressionOperator = "In"
234
+ OperatorNotIn ExpressionOperator = "NotIn"
235
+ OperatorExists ExpressionOperator = "Exists"
236
+ OperatorDoesNotExist ExpressionOperator = "DoesNotExist"
237
+ )
238
+
164
239
// GetService obtains the service definition with the operand name.
165
240
func (r * OperandConfig ) GetService (operandName string ) * ConfigService {
166
241
for _ , s := range r .Spec .Services {
0 commit comments