forked from PrefectHQ/prefect-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraw_value_source.go
More file actions
31 lines (25 loc) · 773 Bytes
/
raw_value_source.go
File metadata and controls
31 lines (25 loc) · 773 Bytes
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
package v1
import (
"fmt"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type RawValueSource struct {
Value *runtime.RawExtension `json:"value,omitempty"`
ConfigMap *corev1.ConfigMapKeySelector `json:"configMap,omitempty"`
Patches []JsonPatch `json:"patches,omitempty"`
}
type JsonPatch struct {
Operation string `json:"op"`
Path string `json:"path"`
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Value *runtime.RawExtension `json:"value,omitempty"`
}
// TODO - no admission webhook yet
func (spec *RawValueSource) Validate() error {
if spec.Value != nil && spec.ConfigMap != nil {
return fmt.Errorf("value and configMap are mutually exclusive")
}
return nil
}