You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
This is really a great project!
However i'm missing a feature: It would be really nice, if i could embedd whole objects as values.
I created a generic CRD that uses a json.RawMessage in my Spec (see details for spec) to take all kinds of values no matter what the struct is. This way i can template whatever i want.
/*
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
"encoding/json"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// MyCRDOverriderSpec defines the desired state of MyCRDOverrider
type MyCRDOverriderSpec struct {
// Foo is an example field of MyCRDOverrider. Edit MyCRDoverrider_types.go to remove/update
// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Type=object
Values json.RawMessage `json:"values"`
}
// MyCRDOverriderStatus defines the observed state of MyCRDOverrider
type MyCRDOverriderStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// MyCRDOverrider is the Schema for the MyCRDoverriders API
type MyCRDOverrider struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MyCRDOverriderSpec `json:"spec,omitempty"`
Status MyCRDOverriderStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// MyCRDOverriderList contains a list of MyCRDOverrider
type MyCRDOverriderList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MyCRDOverrider `json:"items"`
}
func init() {
SchemeBuilder.Register(&MyCRDOverrider{}, &MyCRDOverriderList{})
}
This is really a great project!
However i'm missing a feature: It would be really nice, if i could embedd whole objects as values.
I created a generic CRD that uses a
json.RawMessage
in my Spec (see details for spec) to take all kinds of values no matter what the struct is. This way i can template whatever i want.This works great for simple values, e.g.
With this template
However, what doesn't work is putting a whole object into values, like adding the resources object.
Values:
and the template like above
The error log from template-operator is
The text was updated successfully, but these errors were encountered: