-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(appset): Advanced templating for ApplicationSet #11567
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #11567 +/- ##
==========================================
- Coverage 49.15% 49.00% -0.16%
==========================================
Files 248 248
Lines 42891 43002 +111
==========================================
- Hits 21082 21071 -11
- Misses 19691 19807 +116
- Partials 2118 2124 +6
☔ View full report in Codecov by Sentry. |
@speedfl you're a force of nature. I doubt I'll personally have time to review this in time for 2.6. But if the community likes the approach, I'd love to get it into 2.7. |
64e73b8
to
26b7ea6
Compare
@crenshaw-dev can you explain how can we as community motivate you more to "merge it asap as this is what we need"? 😄 |
Interesting approach. I think this is exactly what I need. Would we be to toggle syncPolicy:
'{{ ternary "automated" "noAuto" .automated }}':
prune: true
selfHeal: true |
@boedy yes. You Can take a look to examples and e2e |
apologies if this repeating the same question, but can parameter values provided by various generators be used as a condition here, e.g labels provided by cluster generator? kind: ApplicationSet
spec:
goTemplate: true
template:
spec:
syncPolicy:
{{- if eq (index .metadata.labels "env") "staging" }}
automated: {}
{{- end }} |
@michalschott pay Intuit to clone me. ;-) But seriously, I'll be advocating with my PM to get my time assigned to this before 2.7. @mubarak-j templates outside of keys or string-type values are not part of this PR. For that, you'll need this: #11183 |
Oh! But @mubarak-j, you could accomplish the same thing by doing this: kind: ApplicationSet
spec:
goTemplate: true
template:
spec:
syncPolicy:
'{{ ternary "automated" "noAuto" (eq (index .metadata.labels "env") "staging")}}': {} My bad, I was looking at the exact text of your example instead of the intention. :-) |
Signed-off-by: gmuselli <geoffrey.muselli@gmail.com>
426f283
to
9ad71eb
Compare
@crenshaw-dev Hope you are doing well. A little present :), I rebased from master with small improvments compared to previous version. Initially only the spec in the template was fully templatable. Now the entire template is a raw Json so that we can as well template metadata (ie: conditional finalizers) Added documentation + e2e |
@speedfl that's awesome, thanks! I just got approval to spend time reviewing this for 2.7. It'll be a couple weeks before I can dive in. A couple notes:
|
Thanks a lot for the suggestion. I will add the status field protection in Let me know if you have other fields in mind Concerning the CRD I will try to think about it. If you have suggestion they are welcome. |
Signed-off-by: gmuselli <geoffrey.muselli@gmail.com>
@speedfl would you mind resolving conflicts? Makes sense w.r.t. the CRD. I think it's fine to leave it plain-json. |
Probably a version difference. Try running |
Signed-off-by: gmuselli <geoffrey.muselli@gmail.com>
Signed-off-by: gmuselli <geoffrey.muselli@gmail.com>
All done @crenshaw-dev Have a good weekend :) |
any update? |
@vl-kp I will take it back soon. I think it could be interesting to merge it just after the official release 2.7 so that we have time to test it for 2.8. it is a quite big PR. what do you think @crenshaw-dev |
Yep, that makes sense. I also wanna make some quick effort to see if we can still use the ApplicationSpec struct for CRD generation but use preserve-fields to make sure the code can access all fields. I just haven't had time to try it. |
Signed-off-by: gmuselli <geoffrey.muselli@gmail.com>
Any idea when this is going to be merged? |
@FCosta999 I am sorry but I am not sure I will be able to work on this one for 2.8 but I can prioritize. |
This has been superceded by #14893 right? |
Signed-off-by: gmuselli geoffrey.muselli@gmail.com
@crenshaw-dev I think you were interested by this one
Closes #11164
Closes #9177
Main purpose is to have an ApplicationSet Template as
map[string]interface{}
which can be fully templatableNote on DCO:
If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.
Checklist: