I have a CRD Object, which is used to create Kubernetes Resources in Remote Clusters.
This CRD has a Field called manifest, which contains a full Kubernetes Manifest, which is to be deployed on the target Cluster.
While this field is not typesafe in the CRD itself, i would like it to be in Pkl.
Here is a a simplified representation of the CRD as a Pkl Module.
What I tried
I created the following files and converted the yaml manifest to Pkl.
Object.pkl
// this is simplified from the actual CRD
module io.crossplane.kubernetes.v1alpha2.Object
extends "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/K8sResource.pkl"
import "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/K8sResource.pkl"
import "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/apimachinery/pkg/apis/meta/v1/ObjectMeta.pkl"
fixed apiVersion: "kubernetes.crossplane.io/v1alpha2"
fixed kind: "Object"
metadata: ObjectMeta?
spec: Spec
status: Status?
class Spec {
manifest: K8sResource
}
class Status {
manifest: K8sResource?
}
I have a CRD Object, which is used to create Kubernetes Resources in Remote Clusters. This CRD has a Field called manifest, which contains a full Kubernetes Manifest, which is to be deployed on the target Cluster.
While this field is not typesafe in the CRD itself, i would like it to be in Pkl. Here is a a simplified representation of the CRD as a Pkl Module.
What I tried
I created the following files and converted the yaml manifest to Pkl.
Object.pkl
convert.pkl
object.yaml
Command
I ran the following command to convert from yaml to pkl.
What I got
What I want