Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future of Composition Environment #3770

Closed
19 of 22 tasks
MisterMX opened this issue Feb 14, 2023 · 28 comments
Closed
19 of 22 tasks

Future of Composition Environment #3770

MisterMX opened this issue Feb 14, 2023 · 28 comments
Assignees
Labels
enhancement New feature or request feature-lifecycle roadmap Issues that have priority and are included in the roadmap, or are candidates to add to the roadmap
Milestone

Comments

@MisterMX
Copy link
Contributor

MisterMX commented Feb 14, 2023

What problem are you facing?

Support for EnvironmentConfigs was added in Crossplane v1.11.0.

How could Crossplane help solve your problem?

We need a plan to promote it to v1beta1, which may include accepting it as is, changing it, or dropping the feature. Community feedback would help here.

Tracked issues

Preview Give feedback
  1. phisco
  2. release/api-deprecation release/breaking-api-change release/breaking-behavior-change
  3. bug environment
    clementblaise
  4. concepts/composition content request
  5. composition enhancement environment proposal
    phisco
  6. composition enhancement environment stale
  7. composition environment
    phisco
  8. composition enhancement environment
  9. bug
  10. enhancement
  11. composition enhancement environment stale
  12. bug composition environment
    phisco
  13. bug composition environment
  14. composition enhancement environment stale
  15. composition enhancement environment
  16. bug composition environment
  17. api environment stale
  18. documentation enhancement
@MisterMX MisterMX added the enhancement New feature or request label Feb 14, 2023
@jbw976 jbw976 added this to the v1.12 milestone Feb 14, 2023
@jbw976 jbw976 moved this to Backlog in Crossplane Roadmap Feb 14, 2023
@blakebarnett
Copy link

blakebarnett commented Feb 18, 2023

We are using it successfully as-is.

Some clarity around the patch ordering in documentation and validation that a patch is just not going to work rather than having it fail silently would be great beta criteria. For example if attempting to patch a composed resource and then trying to use that same field elsewhere as if it were a composite field maybe a validatingAdmissionWebhook could deny it as invalid?

@ytsarev
Copy link
Member

ytsarev commented Mar 5, 2023

I agree, #3454 behavior should be documented.

Otherwise it is totally unclear why construction like https://github.com/ytsarev/composition-environment-example/blob/main/xvpc/composition.yaml#L36-L38 does not work.

It's not the best UX in general so if there is chance to change the order for ToEnvironment patches, we should try to do it.

@plumbis where are old doc snippets are living now?

E.g. I'm failing to find https://github.com/crossplane/crossplane/pull/3007/files#diff-57c8cd7167236fac0edefa6b72c183bb0fdbd21bdc8ec0a521407eaf436ebc0e in the current state of repos.

It is generally useful to have snippets close to the code as they represent the working samples of the various functionality right in the crossplane repo.

@ytsarev
Copy link
Member

ytsarev commented Mar 5, 2023

I've added working(aka not affected by ordering situation) examples of ToEnvironmentFieldPath patches to ytsarev/composition-environment-example@2b14f43 .

@ytsarev
Copy link
Member

ytsarev commented Mar 9, 2023

crossplane/docs#380 related concern

@plumbis
Copy link
Contributor

plumbis commented Mar 9, 2023

@plumbis where are old doc snippets are living now?

@ytsarev all snippets are still under their versions (v1.10, v1.9).
https://github.com/crossplane/docs/tree/master/content/v1.10/snippets

They are being removed in v1.11 and future versions. Docs that still reference snippets need to be updated.

(Happy to discuss why we're removing snippets but it's beyond the scope of this issue)

@P0t4T0o
Copy link
Contributor

P0t4T0o commented Mar 31, 2023

hi, is it intended that if we select env config by some label in composition and there are multiple configs with that label, only one config is selected per matchLabels list item:

 environment:
    environmentConfigs:
      - type: Selector
        selector:
          matchLabels:
            - key: environment-config/app123
              type: Value
              value: select-me

would be nice to be able to select and aggregate all configs with matching labels. these could be necessary changes to enable it: P0t4T0o@cf8ee8e

@ytsarev
Copy link
Member

ytsarev commented Mar 31, 2023

@P0t4T0o that makes total sense to me and also looks matching original design by @MisterMX .

@P0t4T0o why don't you create PR from the changes you demonstrated? It already looks functional, just some unit test coverage to extend.

@mithie
Copy link

mithie commented Apr 5, 2023

We are using it successfully as-is.

Some clarity around the patch ordering in documentation and validation that a patch is just not going to work rather than having it fail silently would be great beta criteria. For example if attempting to patch a composed resource and then trying to use that same field elsewhere as if it were a composite field maybe a validatingAdmissionWebhook could deny it as invalid?

I agree with that. Documentation should be adjusted accordingly. We were facing the same issue as mentioned above when we were trying to use the CombineFromComposite patch type with a value from a status field that was patched by the FromEnvironmentFieldPath before. There's a comment on this in the docs of FromEnvironmentFieldPath, but it's still confusing since it fails silently. So, I agree with the above. Having some sort of validation would be a good feature.

@bobh66
Copy link
Contributor

bobh66 commented Apr 7, 2023

I added the following comment to #3931 but I'll mention it here as well - it seems like it should be valid for an EnvironmentConfig Selector to return no results, just as it is valid for a CompositionSelector to return no results and fallback to the defaultComposition. In this case the environment may be constructed of a variety of named and selected EnvironmentConfigs, as well as patches from the Composite, and the absence of one or more selectors may not be a problem, and may even be expected.

I view it as creating a runtime context from a number of sources, where different sources may exist in different scenarios and the absence of a given source is not necessarily an error condition.

I'm also thinking it might be helpful to have a "default" or "init" section under spec.environment which can contain a hard-coded set of "defaults" for the environment, which may or may not be overridden by selected/named environments or patches. This would also help with the FromValue patch type scenario that has been discussed in #3270

If there is interest in that I can open a separate issue and see about implementation for 1.13

@blakebarnett
Copy link

I'm also thinking it might be helpful to have a "default" or "init" section under spec.environment which can contain a hard-coded set of "defaults" for the environment, which may or may not be overridden by selected/named environments or patches. This would also help with the FromValue patch type scenario that has been discussed in #3270

If there is interest in that I can open a separate issue and see about implementation for 1.13

I have wanted exactly this functionality many times. I've ended up creating "cluster-wide" defaults, and then creating free-form status fields to do CombineToComposite to make use of the fields that aren't exact fits for each composition. It would be much nicer to be able to set them per-composition in this way.

@jbw976 jbw976 added the roadmap Issues that have priority and are included in the roadmap, or are candidates to add to the roadmap label Apr 8, 2023
@jbw976 jbw976 modified the milestones: v1.12, v1.13 Apr 8, 2023
@phisco phisco moved this from Backlog to In Progress in Crossplane Roadmap May 22, 2023
@jeanduplessis jeanduplessis modified the milestones: v1.13, v1.14 Jun 15, 2023
@jbw976 jbw976 modified the milestones: v1.14, v1.15 Jul 20, 2023
@phisco phisco moved this from In Progress to Backlog in Crossplane Roadmap Jan 25, 2024
@negz
Copy link
Member

negz commented Feb 13, 2024

@MisterMX @phisco do you think we should reframe this issue to reflect the decision taken in #5061?

This document proposes not promoting the Composition Environment feature to beta in v1.15, nor setting a timeline for its promotion to beta, investing in enabling Composition Functions to request extra resources allowing them to reimplement the same functionality while exploring other possible approaches.

Here's my understanding of the state of the feature:

  • We've made a decision that we don't want to promote it to beta as-is.
  • We want to avoid leaving it as alpha as-is, because the longer it exists as-is the harder it is to change.
  • We plan to remove spec.environment and the environment patch types from native P&T (mode: Resources).
  • We plan to replace it with function-environment-configs combined with function-patch-and-transform.
  • We want to keep the EnvironmentConfig type but we're not sure where it should live. Possibly a provider?

Is that correct?

@negz
Copy link
Member

negz commented May 8, 2024

We need to make a decision about the future of this feature.

I don't think it's going to be promoted to beta in its current form. @phisco @jbw976 could we start by removing the EnvConfig specific fields from the Composition type in v1.17?

@phisco
Copy link
Contributor

phisco commented May 8, 2024

I'd rather deprecate them first for one release, at least. Otherwise we are forcing people using this alpha, but really widely used,feature to also migrate to functions, while native compositions are not deprecated yet. Given that the migration is not seamless, I'd prefer not rushing it.

@negz
Copy link
Member

negz commented May 9, 2024

Deprecation sounds great to me, as long as we're making forward progress in some direction. 😄

Do we have an example of deprecating a field (as opposed to a whole type)? How would we deprecate it? Probably:

  • // Deprecated comment on the field
  • Release notes
  • Docs updates

Anything else?

@phisco
Copy link
Contributor

phisco commented May 9, 2024

We can emit a deprecation warning from the webhook too if marking the field deprecated is not doing that already, I don't think it does, I have to check 🤔

@jbw976 jbw976 changed the title Promote Composition Environment to beta Future of Composition Environment May 29, 2024
@jbw976 jbw976 added this to the v1.17 milestone May 29, 2024
@jbw976 jbw976 added roadmap Issues that have priority and are included in the roadmap, or are candidates to add to the roadmap and removed graduation-beta labels May 29, 2024
@jbw976 jbw976 removed this from the v1.17 milestone Jun 27, 2024
@bobh66
Copy link
Contributor

bobh66 commented Aug 8, 2024

@phisco @negz any thoughts on promoting EnvironmentConfig to v1beta1 so it can be supported when building Configuration packages? Regardless of the composition environment plumbing, the EnvironmentConfig resource itself is extremely useful.

@phisco
Copy link
Contributor

phisco commented Aug 12, 2024

I'm fine promoting the EnvironmentConfig resource to beta as is, the other option would be to move it out of tree, e.g. provider-environment-configs.
WDYT @negz?

@negz
Copy link
Member

negz commented Aug 12, 2024

I maybe have a slight preference for moving it out of tree? Not sure.

My thinking is that it'd be unusual to have a type installed by core that wasn't actually used by core - only by functions. On the other hand it's also a bit unusual to have a "provider" that installs a type but doesn't actually reconcile it, so I don't feel super strongly.

If/when we bump it to beta can we make sure the "old" env config machinery is explicitly marked deprecated. I want to make it clear that we're only promoting the type (for use with functions) and that we still plan to remove the "built in" env config support.

@bobh66
Copy link
Contributor

bobh66 commented Sep 4, 2024

@phisco @negz I'd like to get the EnvironmentConfig promoted to beta in 1.18, or sooner if we move it to function-environment-configs. My concerns with moving it out-of-tree are that you have to install the function in order to get the resource, which introduces another dependency, and it calls into question the ability to include EnvironmentConfigs in crossplane Configuration packages as described in #3865

I think the thing that pushes me toward keeping it in-tree is the desire to be able to include it in a Configuration package. That seems to be more Crossplane-ish and I don't know that we would want to support including out-of-tree resources in Configuration packages, although including things like ConfigMaps might be useful in both Configuration and Function packages.

Thoughts? Do we need a new issue for promoting the resource? Or can we treat the promotion/deprecation as one thing and deal with it here?

@jbw976 jbw976 added this to the v1.18 milestone Sep 4, 2024
@phisco
Copy link
Contributor

phisco commented Sep 5, 2024

@bobh66, I'm fine keeping this issue.

I'm fine just promoting EnvironmentConfig and leaving the environment machinery to be deprecated with the rest of the native patch and transform composition. I think it would add a lot of useless pain for users to move it out of Crossplane.

@bobh66
Copy link
Contributor

bobh66 commented Sep 5, 2024

Thanks @phisco - is there any additional effort required to deprecate the machinery, or does deprecating the native P&T cover it?

@negz
Copy link
Member

negz commented Sep 5, 2024

I feel okay leaving the EnvironmentConfig type in-tree. I'd like to actively remove the in-tree code paths though.

By that I mean:

  • The environment field on the Composition type
  • The controller code that selects and fetches environment config
  • All the native FromEnvironment and ToEnvironment patch types

I think it would add a lot of useless pain for users to move it out of Crossplane.

I'm assuming by "it" here you mean the things I listed above - it's unclear if you meant that or the EnvironmentConfig type.

If so, I empathize, but the flipside is that we must maintain the code for this alpha feature indefinitely. We're committed to maintain most of the in-tree Composition code because it shipped as a GA feature, but EnvironmentConfigs never left alpha.

I know EnvironmentConfigs are popular and widely used, but everyone using them has opted into an alpha feature with plenty of warning that it might be dropped or changed in future. I think it's reasonable to ask them to migrate to the beta iteration of the feature (i.e. using functions).

@phisco
Copy link
Contributor

phisco commented Sep 5, 2024

I meant dropping the EnvironmentConfig resource would be painful.

Sounds good to me dropping the machinery around them though, the migration path is as easy as pushing the configuration down to function-environment-config/function-patch-and-transform. If we start making people aware now, it should be fine.

@phisco
Copy link
Contributor

phisco commented Oct 14, 2024

As discussed we'll have to:

@jbw976
Copy link
Member

jbw976 commented Oct 22, 2024

@phisco i've taken your task list in the comment above and merged them into the main task list for this epic, along with current status. Thanks for driving this in v1.18! 🙇‍♂️

@phisco
Copy link
Contributor

phisco commented Nov 5, 2024

Ok, we finally managed to execute on the plan above, so we can close this!

TL;DR: We've promoted the EnvironmentConfig resource to Beta, but dropped all "in-tree" Composition Environment capabilities, i.e. spec.environment from Compositions. There is clear documentation and automated tooling (crossplane beta convert pipeline-composition/composition-environment) to migrate from that to function-environment-configs. We have almost complete feature-parity, except for spec.environment.policy.resolve: IfNotPresent, which only supports Always now, but we don't think this will affect users, see here for more details.

@phisco phisco closed this as completed Nov 5, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Crossplane Roadmap Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature-lifecycle roadmap Issues that have priority and are included in the roadmap, or are candidates to add to the roadmap
Projects
Status: Done
Status: Alpha to Beta
Development

No branches or pull requests