-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
improve flux manager with custom flags #13952
Comments
I think we'd want it to be more descriptively named, such as |
@gopherpro for now I'm using https://github.com/onedr0p/home-ops/blob/main/cluster/base/flux-system/gotk-patches.yaml and https://github.com/onedr0p/home-ops/blob/main/cluster/base/flux-system/kustomization.yaml |
An influx of users came to know Flux and Renovate work together; we discovered this issue report this morning, when a user mentioned that Renovate PR was removing their I don't think something as broad as a full-blown escape hatch where users can put whatever options they want is necessarily the best solution here, there is some header information in comments of manifests of newer Flux versions and they tell what components have been installed. So it could be figured out by a parser and the options added dynamically to the update PR without user input. The default Flux bootstrap runs with this option at its default value:
(this flag can almost always be omitted, unless users wanted to run with fewer than the 4 default controllers – you can determine this from the headers) and users may add two additional components to support image automation with:
Here is the header in the manifest as an example: I'm not sure how long ago this header was added, but almost every Flux installation will have these comments. If they are missing, I think it would run with the defaults. |
@kingdonb nice to see you here and would love to see Renovate mentioned in the Flux docs! While parsing the file is fine to determine what components are installed and maybe acting on it, the comments are not great at determining any other |
@onedr0p I personally use the This is the only critical change needed before I think we can start advertising Renovate to Flux users. (In fact we added Renovate already to the docs this morning, but backed it out until this issue can be addressed.) |
I do not mind using the But with that said I usually read the Flux release notes and check the diffs, so it's not super important to me, but maybe others. Ideally having Renovate check the comments and adding those additional components doesn't seem too hard to implement. |
@onedr0p I am not fully expert in Kustomize (if not me, then who is? seriously though...) but I have seen wildcards used in some surprising places. I just checked, and I think this issue report asked for the feature and I think it got lost in the translation because it looks like the related issue has been merged and this still is not a feature. Maybe there's another method I'm not aware of where you can already do this. |
Yep, there doesn't seem to be a way to wildcard or use regex on that. :( |
Interesting...I didn't know that |
I always point people at this section of our docs, and try to highlight the "Automated Upgrades" section, which points out how to use Flux and GitHub Actions together to keep Flux up to date. This always feels like a forgotten corner of our docs, and when I do this, I specify the I'd rather point at a full-featured solution that doesn't stand awkwardly by itself as a one-off and has other uses, as Renovate clearly does. This seems like a great tool to integrate with Flux, and I've even used it in some of the maintenance of Flux v1 before, I already recognize the value of this tool. I don't think I understood that it's fully open source before. This is really great, if that's so! https://fluxcd.io/docs/installation/#bootstrap-upgrade ☝️ Here is the doc from Flux docs, where we currently describe "Automated Upgrades" in a manner that's loosely related to this idea: https://fluxcd.io/docs/use-cases/gh-actions-auto-pr/ – basically just what Renovate does, only much more limited (it opens pull requests.) I'll have to explore this in more depth later on this week or next. I'd love to help validate that Flux and Renovate can be used together as much as possible without friction! |
Hi, Renovate maintainer here. Not a Flux user yet but happy to advise on elegant ways to support this capability once the requirements are nailed down. My preference when possible is that the "source of truth" for such things is in the tool's own config, package or lock files so that it's not necessary to duplicate it in Renovate config and potentially drift later on. |
There has been a discussion here or there about having a Flux config object which contains global settings for the whole of Flux, so that Flux can be configured on platforms which do not use bootstrap (there's been some discussion about how to configure Flux on platforms like OpenShift where you get to expose your service as a "Subscription" but it doesn't accept configuration params, or other installation methods like the Flux terraform provider) can all be configured in a same way, but so far this concept hasn't got any traction with the maintainers of Flux. The officially supported way to install Flux is the bootstrap method via the CLI, and the official way to configure it is by passing options in, with an official method of patching described in the docs that explains how to configure Flux things that are not supported by bootstrap flags. These are the Flux official configuration methods to know. The relevant flags to cover, if you're interested in covering all flags, are on
There are 6 Flux components, two of them extra, and that has been a stable list since Flux v2 was created. It seems reasonable to accept the default list is likely to remain stable forever, and any new components will likely be considered It would be nice to support removing controllers from I don't know how you get away without tightly coupling to the CLI if you want to support Flux broadly with all custom flags from now on, I probably wouldn't entertain that if I was a Renovate maintainer. The |
I am still learning typescript, so I will try to get around to making this change (if nobody beats me to it first!) |
@kingdonb Be my guest! My recent contributions to Renovate were my first time writing TypeScript, and I found it enjoyable. @rarkins Agreed, much better to keep the configuration DRY. Yes, I'd advocate for an iterative/flag-by-flag approach to adding Renovate support for the various It would be useful if |
To elaborate on that last idea (though this should probably be in an issue on the Flux repo), we could have Flux write a header like this, which would serve both our purposes here and also (I think) provide value to Flux users who are not (yet 😉) using Renovate: # This manifest was generated by flux. DO NOT EDIT.
# Flux Version: v0.26.2
# Components: source-controller,kustomize-controller,helm-controller,notification-controller,image-reflector-controller,image-automation-controller
# To upgrade your Flux installation in the future, update the flux CLI and then run:
# flux bootstrap github --owner=my-github-username --repository=my-repository --components-extra=image-reflector-controller,image-automation-controller <...other flags here...> |
The only reason I think that wouldn't be done is because the In principle it's a fine idea, but what we're really after are the flags to pass to But that's a nit! Let's start with the low-hanging fruit, I like the plan as it's been laid out 👍 |
This comment was marked as off-topic.
This comment was marked as off-topic.
Please don't post |
@kingdonb Any updates? I don't want to rush you, but it also seems like this is a significant issue for Flux users on Renovate, so if you haven't gotten to it, I'd like to at least knock out the initial |
I have been back to this thread a couple times but haven't made any progress on it myself. Have at it! |
OK, no problem. #14332 addresses |
Disable flux auto-updates by Renovate due to renovatebot/renovate#13952
I would love support for |
|
Thanks, it's slightly different though as we cannot extract the cluster domain value from a comment in the header.
Let me know if any of this would be acceptable. |
It would be great to have an allow-list of options that you can pass to Is there any example of a parameterized Renovate manager that I can take a look at to understand what's possible?
I've marked off all of the options that Renovate wouldn't need to expose, the parameters that could be safely left out from the list exposed by the manager without hampering any Flux user capabilities. There's a further list of "global flags" also accepted by flux install, but I don't think any of them are applicable as they would be used for talking to the cluster, and |
I don't think this is needed anymore as you can "take over" Flux with Flux and not rely on the Install Flux
# bootstrap.yaml
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/fluxcd/flux2/manifests/install?ref=v0.38.2
# patches:
# patch out wha you want to change Then you can take Flux over with either option below which are supported by Flux now: 1. OCIRepository---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
name: flux-manifests
namespace: flux-system
spec:
interval: 10m
url: oci://ghcr.io/fluxcd/flux-manifests
ref:
tag: v0.38.2
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: flux
namespace: flux-system
spec:
interval: 10m
path: ./
prune: true
wait: true
sourceRef:
kind: OCIRepository
name: flux-manifests
# patches:
# patch out wha you want to change 2. GitRepository---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: flux-manifests
namespace: flux-system
spec:
interval: 30m
ref:
tag: v0.38.2
url: https://github.com/fluxcd/flux2
ignore: |
# exclude all
/*
# path to manifests
!/manifests
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: flux
namespace: flux-system
spec:
interval: 30m
path: ./manifests/install
prune: true
wait: true
sourceRef:
kind: GitRepository
name: flux-manifests
# patches:
# patch out wha you want to change It's just my personal opinion but I never found the |
@onedr0p is OCIRepository supported in renovatebot yet? I think there are some feature gaps. For instance, HelmRepository can be auto-upgraded by renovate, but a HelmRepository with Until the OCIRepository |
@kingdonb OCIRepository is supported I personally submitted the PR however there's a minor bug that needs to be fixed. GitRepository is now supported and works just fine. HelmRepository with type oci is not supported yet and if I find time I'll try to submit a PR. This is unrelated to this issue though. |
What I'm saying is, yes you can patch Flux according to customize Flux manifests but that's not the only way to configure Flux. And users who bootstrapped Flux with custom flags will likely have the expectation that Renovate is not going to wipe out their customizations, (it should ideally behave as if "bootstrapping again with the same parameters") That's the original subject of this issue, no? There's a lot to unpack here, I would not recommend anyone do this for example: apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/fluxcd/flux2/manifests/install?ref=v0.38.2 ... because it short-circuits the source controller and will never cache the resource. We recommend people turn off remote resources in Kustomize with So stating that there is a workaround and you don't need support for any more Flux manager custom flags, because users can patch instead, is technically true but also asks users to go off the "garden path" at this point. I would prefer to tell users to bootstrap with The other examples you posted are excellent and I'm only picking this minor nit, because I have directed someone at your post who was looking for an example of exactly this, how to do "gitless Flux" and I don't want them to get the wrong idea ;) Thanks for all the work you're doing here and at-large for Flux! |
@kingdonb can you expand on this a bit more?
It is my understanding it is just applying all the resources I need to complete my bootstrap method, this is not being actively watched by flux. I know this isn't the advised route but here is how I am bootstrapping my home Kubernetes cluster, at my day job we do something similar and it works out quite good. https://github.com/onedr0p/home-ops/tree/main/kubernetes/bootstrap |
Sure! What I'm saying is, Source Controller handles all of the "source concern" topics like caching, secure provenance, cryptographic verification, or SSH key handling, and Kustomize controller handles all of the "applier concern" topics like When you use a remote resource like So if you avoid remote bases such as this one, the Source Controller reconciles every If you install the Flux monitoring dashboards and check out the Flux metrics, you will absolutely notice a large performance difference between these two methods. Which is why we decided to make the administrative option that prohibits remote bases, since as a cluster admin you might even want to prohibit your users from doing this altogether, as it can have an impact on performance for the whole cluster. I have done this in demos before, but I try not to do that anymore. In practice, this is probably only an issue at the boundaries of scale. Flux is high performance software and if you don't have hundreds of tenants, you are unlikely to notice scale issues in any case, but what else is most important about this is that certain cloud providers charge for egress, Git repos are often hosted somewhere else. If you are downloading a git repo every 10m versus hitting an endpoint to check if it has the same content it did before by hash, that adds up fast, and you'll potentially see a major impact on your bandwidth bills by making this change, if your bandwidth usage is metered like this. |
I should have been more clear, the See my bootstrap process here |
That's very unconventional and I also like it 🥇 |
I realize it takes a bit more understanding of Flux to do something like this but overall I'm happy with this method. |
We have a repository with flux components and Renovate did update Flux from 0.39.0 to 0.40.2. The update itself is okay but the commit updated all cluster domains to the default We bootstrapped flux using the - - --events-addr=http://notification-controller.flux-system.svc.custom-domain.local./
+ - --events-addr=http://notification-controller.flux-system.svc.cluster.local./
- - --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.custom-domain.local.
+ - --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.cluster.local. Is there any possibility for Renovate to not update the cluster domain? And does this belong here or should I open a bug report? |
@Kampfmoehre this is not a bug |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I think this issue is not related to renovate itself. Ping me if you need further help |
@rarkins $ flux install --help
...
Examples:
# Install the latest version in the flux-system namespace
flux install --namespace=flux-system
...
Global Flags:
-n, --namespace string If present, the namespace scope for this CLI request (default "flux-system") |
The manager maintainers seemed to be taking a principled stance that only configuration directives that are expressly stated as configuration should be re-parsed. So I don't know if such a change would be accepted, or advisable, but I think the metadata field and way that namespace is configured in Kubernetes API should be considered as stable, so I'm not sure it's worth it to fret over this at all. It is possible that someone will edit their gotk-components.yaml even though it warns users "DO NOT EDIT" at the top of the file, so how much do you parse? I would look at the |
Totally understand that only configuration directives should be re-parsed. Because of these, it would be nice to support the custom namespace (not |
I didn't even think about that, you know, In Flux docs, we typically tell users to avoid bootstrap configuration flags unless they're really needed, and to put their customizations in the Kustomize overlay for flux-system. Like for example, instead of setting network-policy=false, I'll delete the NetworkPolicy resources with a https://fluxcd.io/flux/installation/configuration/boostrap-customization/ https://github.com/kingdonb/csh-flux/blob/dca03d73376690c0eddece911b28895450e5b6bb/clusters/home-workers/flux-system/kustomization.yaml#L28-L50 - (note that If you use this method (not necessary to write a patch, the Kustomization overlay accepts @mecseid Does this help? I'm not sure if there are embedded namespace references in the Flux manifests that would not be properly set by the Kustomization overlay's |
What would you like Renovate to be able to do?
Good day,
I would like to be able to add flags for the flux manager. Currently, flux is always running the following command.
renovate/lib/manager/flux/artifacts.ts
Line 19 in a98e7af
It would be really nice if you could add some flags. So you can update your flux components even more personalized.
Something like
flux install ${costume_flags} --export > ${quote(packageFileName)}
If you have any ideas on how this should be implemented, please tell us here.
My idea is to add the option to set flags. The flags will be used if the manager runs the update command.
Like this, it's possible to update flux and ignore the network policy.
Is this a feature you are interested in implementing yourself?
No
The text was updated successfully, but these errors were encountered: