How can I get values from an Environment Config to a Composition and vice versa? #5436
-
I have an environment config with some values, and I also have a composition with some values in spec. I need to get these values existing in the same context so that I can use I saw in the docs that you can patch a composite resource with an environment but I'm not able to get the values to appear in the status of the composition as I would expect. The spec:
environment:
environmentConfigs:
- type: Reference
ref:
name: cluster-metadata
patches:
- type: ToCompositeFieldPath
fromFieldPath: oidcUri
toFieldPath: status.oidcUri
- type: ToCompositeFieldPath
fromFieldPath: oidcArn
toFieldPath: status.oidcArn When I view the status of my composite resource I do not see these fields appear which in turn causes my combine patch to fail specifying a required property in Any thoughts or ideas? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Are the |
Beta Was this translation helpful? Give feedback.
-
Can you share your CompositeResourceDefinition? Or at least the part where you define those fields in the status |
Beta Was this translation helpful? Give feedback.
-
I've determined that it came down my usage of composition functions and using mode: Pipeline
pipeline:
- step: environmentConfigs
functionRef:
name: crossplane-contrib-function-environment-configs
input:
apiVersion: environmentconfigs.fn.crossplane.io/v1beta1
kind: Input
spec:
environmentConfigs:
- type: Reference
ref:
name: cluster-metadata
- step: patch-and-transform
functionRef:
name: crossplane-contrib-function-patch-and-transform
input:
apiVersion: pt.fn.crossplane.io/v1beta1
kind: Resources
environment:
patches:
- type: ToCompositeFieldPath
fromFieldPath: oidcUri
toFieldPath: status.irsa.oidcUri
- type: ToCompositeFieldPath
fromFieldPath: oidcArn
toFieldPath: status.irsa.oidcArn
- type: ToCompositeFieldPath
fromFieldPath: clusterName
toFieldPath: status.clusterName |
Beta Was this translation helpful? Give feedback.
I've determined that it came down my usage of composition functions and using
mode: pipeline
. I got a working XR by using theenvironment-config
andpatch-and-transform
functions together. I wrote tostatus
from the environment patches section of patch and transform.