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
CustomResource is a generic resource for creating a Kubernetes custom resource; see example. Today it is implemented as an 'overlay' resource and has two major limitations:
Conceptually,CustomResource represents a single Kubernetes object akin to ConfigMap or Deployment. It's not a component resource and should continue to benefit from the usual resource lifecycle (e.g. diff).
For most use-cases, a reasonable alternative to CustomResource is ConfigGroup with its objs input property, which allows for literal Kubernetes objects. That said, a component resource is an awkward substitute for a custom resource.
Note that the Pulumi Converter for Kubernetes (kube2pulumi and pulumi-converter-kubernetes) doesn't support custom resources (see Limitations).
The content you are editing has changed. Please copy your edits and refresh the page.
I was curious as to why Pulumi YAML is unable to simply use the CustomResource as provided by the kubernetes provider without an overlay. Imagine we removed the special-case logic (here) and allowed the YAML engine to register the resource. We see the essential problem is a limitation of Pulumi schema: lack of support for open-ended types w/ extra properties.
The YAML engine obtains schema info from the provider, and is unable to handle the spec property.
Error: Property spec does not exist on 'kubernetes:apiextensions.k8s.io:CustomResource'
on Pulumi.yaml line 16:
16: spec:
Cannot assign '{apiVersion: string, kind: string, metadata: {name: string}, spec: {cronSpec: string, image: string}}' to 'kubernetes:apiextensions.k8s.io:CustomResource':
Existing properties are: kind, others, apiVersion, metadata
Observe that the schema for CustomResource (overlays.go) has the standard kind, apiVersion, and metadata properties. Then there's a others property (a map type), which is how the magic happens. The overlay code packs the spec into others to convey it to the provider. See how the SDK type is defined in a way that Pulumi schema cannot represent (ref):
CustomResource
is a generic resource for creating a Kubernetes custom resource; see example. Today it is implemented as an 'overlay' resource and has two major limitations:Conceptually,
CustomResource
represents a single Kubernetes object akin toConfigMap
orDeployment
. It's not a component resource and should continue to benefit from the usual resource lifecycle (e.g. diff).For most use-cases, a reasonable alternative to
CustomResource
isConfigGroup
with itsobjs
input property, which allows for literal Kubernetes objects. That said, a component resource is an awkward substitute for a custom resource.Note that the Pulumi Converter for Kubernetes (kube2pulumi and pulumi-converter-kubernetes) doesn't support custom resources (see Limitations).
Resolves
The text was updated successfully, but these errors were encountered: