These all had quite a lot of interactions so I had to do them together.
Note we can't bump to Kubernetes v0.31.0 because it's newer than what
the latest crossplane-runtime release is using. We'll need to update
crossplane-runtime first.
I'm also seriously questioning keeping the dependency on provider-aws.
It's massive and has a lot of painful dependencies to fix when we update
the import. On the other hand, I experimented with e.g. using
provider-nop or provider-kubernetes for examples and didn't like it.
Signed-off-by: Nic Cope <nicc@rk0n.org>
This is mostly useful when a function loads its input from the
RunFunctionRequest. Crossplane isn't (yet) aware of input schema and
will send anything the user supplies.
Right now that could include extra unknown, misindented, or typod fields
and those will be silently ignored by the function. With this change in
place they will result in an error.
This code will also be used to load desired and observed resource state,
but it's unlikely for those to be invalid.
This is a small behavior change, but I feel okay with it. The new
behavior is safer, probably won't affect anyone, and we're pre 1.0.
https://github.com/crossplane-contrib/function-patch-and-transform/pull/91#issuecomment-1942672309
Signed-off-by: Nic Cope <nicc@rk0n.org>
Without this change any resource that has no ObjectMeta will end up with
an empty metadata (like "metadata": {}) when rendered. This is because
json serialization adds the generation field. We then delete it,
resulting in an empty metadata object.
This isn't actually so bad because Crossplane will always add a few
labels, owner refs, etc before the metadata becomes part of the SSA
fully-specified intent. So in reality we'll never ask the API server to
make metadata an empty object. It is misleading in unit tests though.
Signed-off-by: Nic Cope <nicc@rk0n.org>
This is necessary for functions to be able to return JSON (as
structpb.Struct) that can be used as server side apply fully specified
intent. Without it we include empty structs that are non-nil, even if
they have the omitempty marker.
Signed-off-by: Nic Cope <nicc@rk0n.org>
* Bump crossplane-runtime
* Update GetInteger to handle floats locally
* Use new claim.Reference type
Signed-off-by: Steven Borrelli <steve@borrelli.org>
We don't need the GetUnstructured interface since any type that has it
embeds Unstructured, and lets us get its object directly.
Signed-off-by: Nic Cope <nicc@rk0n.org>
This makes it more convenient and discoverable to get and set arbitrary
unstructured data from a composed or composite resource.
Signed-off-by: Nic Cope <nicc@rk0n.org>
You're most likely going to want to add this to the map returned by
request.GetDesiredComposedResources then later pass that to
response.SetDesiredComposedResources. The map in question is a map of
resource name to *resource.DesiredComposed, so it's easiest if this
returns that type.
Signed-off-by: Nic Cope <nicc@rk0n.org>
This lets us print it (e.g. in logs) in a human-readable way. I
considered using stringer to generate String() methods, but I don't
think we really care about the size/perf benefits of this enum being an
integer.
Signed-off-by: Nic Cope <nicc@rk0n.org>
These just served to obfuscate what the types actually were - a map of
resource name to observed/desired composed resource structs.
Signed-off-by: Nic Cope <nicc@rk0n.org>