Hello,
I would like to pass a nested map (ie map[string]string-or-int) through a CR's spec field to the operator. For this I attempted:
type ChannelSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Replicas is the number of replicas of the ESNI deployment
//+operator-sdk:csv:customresourcedefinitions:type=spec
Replicas int32 `json:"replicas"`
//+kubebuilder:pruning:PreserveUnknownFields
Overrides unstructured.Unstructured `json:"overrides,omitempty"`
}
and
apiVersion:
foo.com/v1alpha1kind: Channel
metadata:
labels:
app.kubernetes.io/name: Channel1
app.kubernetes.io/instance: Channel1
app.kubernetes.io/part-of: src
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: src
name: Channel1
spec:
replicas: 1
overrides:
channel-worker:
configMapRef:
name: channel-worker-config
file: config.json
which resulted in the operator error:
// reflector.go:140] pkg/mod/
k8s.io/clie...@v0.26.1/tools/cache/reflector.go:169: Failed to watch *v1alpha1.Channel: failed to list *v1alpha1.Channel: Object 'Kind' is missing in '{"component":"channel-worker","configMapRef":"channel-worker-config"}'
// reflector.go:424] pkg/mod/
k8s.io/clie...@v0.26.1/tools/cache/reflector.go:169: failed to list *v1alpha1.Channel: Object 'Kind' is missing in '{"component":"channel-worker","configMapRef":"channel-worker-config"}'
Is it possible to pass through such config data without it being a complete Kube object (without Kind for eg) and without disabling validations entirely? (related
https://github.com/operator-framework/operator-sdk/issues/1795)
Thanks