You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CRDs contain the fields mutated by the controller #1681
I am deploying MetalLB with ArgoCD and I have noticed that some objects are never shown as synced.
A quick check revealed that at leat two CRDs (bgppeers.metallb.io and addresspools.metallb.io) contain the fields /spec/conversion/webhook/clientConfig/caBundle and this value appears to be updated by the controller.
While I can tell ArgoCD to ignore the specific differences, maybe it is a good idea to add the fields that are mutated by the controller to the managedFields? This way the resulting objects will be cleaner.
Oh, I wasn't aware of that option, thanks for reporting this!
The CRDs are generated by controller-gen, so I need to see if there's a slick way to declare the caBundle as managed.
I'm uncertain if that was causing you any issues, but I had some pretty serious ones with my unorthodox setup.
I have my hardware rented at Hetzner and have two dedicated servers connected with a v-switch. I also have a cloud machine, which is connected by the network features of Hetzner with these two dedicated servers.
My K8S cluster is built upon VMs that run on these servers and MetalLB is providing IPs which could also be reached from my cloud machines.
Because ArgoCD was messing with these CRDs, the connection from the cloud machines to the load balancer services broke.
As one of the cloud machines is my "network entry point", I couldn't access most of my services.
So for anyone who is running into such an issue, make sure ArgoCD doesn't mess with the caBundle for these CRDs.
ArgoCD is not messing with anything unless you ask for it :)
The problem is very simple. ArgoCD compares the K8S objects with their desired state, field by field. It ignores the fields that are known (defined) as "managed" fields and it can also ignore the fields if you configure it this way. Whenever it detects a difference, it will flag this object as "not in sync" - because it is different from your GIT repo. And if you configure ArgoCD to sync automatically....well, then you ask for the fight between ArgoCD trying to set it to the value you want vs a controller running in the cluster trying to update these field(s).
I try to use ArgoCD for everything in my cluster.
There is a similar challenge, for example, with SealedSecret object, but there it cannot be solved by defining the fields "managed" because sealed-secrets controller actually creates Secret objects by decrypting SealedSecret one. So, the actual secret values (e.g. data fields) have to be ignored. Just an example, not related to this issue.
Bottom line, it is nice to have a clear declaration that a particular field of an object is transient and should not be considered by GitOps tools (like ArgoCD and similar) for detecting the out-of-sync objects.
OK, so I have no idea what changed, but for some reason, I have the same problem again.
I have an LB service for my SSH access to my Gitea instance. I cannot connect to this SSH service from my cloud machine, that is in the same network.
I've specified, that the caBundle should be ignored by ArgoCD, so that doesn't really seem the problem.
I don't know what exact constellation it is, but at some point I managed to get it working, then recreated the service again, and now it's broken.
Some things that I did, to fix it:
Recreated the different CRDs (maybe something changed again with the caBundle). I deleted the CRDs, recreated them and then just to make sure, restarted the controller, so it could do its stuff.
Changed the LB IP for the SSH service of Gitea, that didn't fix it either.
In general, I'm just wondering; What do I have to do, and in which order, so the CRDs get the correct certificates and my GitOps solution doesn't mess it up again?
I've removed MetalLB completely from my cluster and just installed it normally with kustomize, so without the usage of ArgoCD.
I still have the same problem, that a new service isn't really reachable from my cloud machine, and I'm really at the end of my nerves on how to fix this.
The weirdest thing is, that I have a second instance of Gitea running and there it works. I can even delete the service, it gets recreated with ArgoCD and the connection still works.
Something, somewhere is just going wrong with new services and MetalLB...
I have just reinstalled MetalLB (because I needed to recreate my little cluster)with ArgoCD and everything went up perfectly. This is what I used in my application.yaml:
Reacted by IckeBinBerliner, Brendan McShane, vidosits, Kenan Erdogan, Ondřej Molík, Björn Kraus, Cristian, Austin Sera, Eric_Ren, Maxime Vincent and 10 more
Reacted by Andreas Lindhé, Neil Gealy, Cristian, Ole-Magnus Sæther, Chris Herrera, Viz, Drikanis and Clément R
Does the same thing, but still didn't realy work.
Anyways I kind of ArgoCD excluded, as I reinstalled MetalLB manually with kustomize and something is still going wrong.
Any chance to fix that? I've installed new cluster with k8s 1.27, metallb 0.13.12 and argocd 2.9.5 and there's many times during reconciliation this ...
I had the same issue today as well, with 0.14.3. I have selfHeal: true, so I just deleted the CRD to get back to sync, but this was ofc just temporary. Had to add ignoreDifferences.
Reacted by spensireli, Jason Slay, hogesako, Markus Pesch, Chris Herrera, Vlad Bachynskyi, Mike Nguyen, Mika Ranta and Ben Bardyn
Reacted by spensireli and Jason Slay
Reacted by Roger Warford, Pan Teparak, cchriso, Jason Slay, Fernando Llaca, Sarem Seitz, David Frickert, tillmzw, Chris Herrera, Carter Green and 3 more
Activity
fedepaol commentedon Nov 2, 2022
Oh, I wasn't aware of that option, thanks for reporting this!
The CRDs are generated by controller-gen, so I need to see if there's a slick way to declare the caBundle as managed.
TheAnachronism commentedon Nov 10, 2022
I'm uncertain if that was causing you any issues, but I had some pretty serious ones with my unorthodox setup.
I have my hardware rented at Hetzner and have two dedicated servers connected with a v-switch. I also have a cloud machine, which is connected by the network features of Hetzner with these two dedicated servers.
My K8S cluster is built upon VMs that run on these servers and MetalLB is providing IPs which could also be reached from my cloud machines.
Because ArgoCD was messing with these CRDs, the connection from the cloud machines to the load balancer services broke.
As one of the cloud machines is my "network entry point", I couldn't access most of my services.
So for anyone who is running into such an issue, make sure ArgoCD doesn't mess with the caBundle for these CRDs.
ngrigoriev commentedon Nov 10, 2022
ArgoCD is not messing with anything unless you ask for it :)
The problem is very simple. ArgoCD compares the K8S objects with their desired state, field by field. It ignores the fields that are known (defined) as "managed" fields and it can also ignore the fields if you configure it this way. Whenever it detects a difference, it will flag this object as "not in sync" - because it is different from your GIT repo. And if you configure ArgoCD to sync automatically....well, then you ask for the fight between ArgoCD trying to set it to the value you want vs a controller running in the cluster trying to update these field(s).
I try to use ArgoCD for everything in my cluster.
There is a similar challenge, for example, with SealedSecret object, but there it cannot be solved by defining the fields "managed" because sealed-secrets controller actually creates Secret objects by decrypting SealedSecret one. So, the actual secret values (e.g. data fields) have to be ignored. Just an example, not related to this issue.
Bottom line, it is nice to have a clear declaration that a particular field of an object is transient and should not be considered by GitOps tools (like ArgoCD and similar) for detecting the out-of-sync objects.
TheAnachronism commentedon Nov 10, 2022
I'm not saying that it is ArgoCD's fault :D
Just wanted to note that it actually can cause issues if one doesn't do it correctly.
ngrigoriev commentedon Nov 10, 2022
The software is (almost ;) ) never at fault :)
Yes, that's exactly why I raised this [low-priority] issue. GitOps method needs help with determining if an object in K8S is out of sync or not.
fedepaol commentedon Nov 10, 2022
We'll get to it! Sorry but I've been busy with other stuff lately
TheAnachronism commentedon Nov 12, 2022
OK, so I have no idea what changed, but for some reason, I have the same problem again.
I have an LB service for my SSH access to my Gitea instance. I cannot connect to this SSH service from my cloud machine, that is in the same network.
I've specified, that the caBundle should be ignored by ArgoCD, so that doesn't really seem the problem.
I don't know what exact constellation it is, but at some point I managed to get it working, then recreated the service again, and now it's broken.
Some things that I did, to fix it:
In general, I'm just wondering; What do I have to do, and in which order, so the CRDs get the correct certificates and my GitOps solution doesn't mess it up again?
TheAnachronism commentedon Nov 12, 2022
Alright, so, some news here:
I've removed MetalLB completely from my cluster and just installed it normally with kustomize, so without the usage of ArgoCD.
I still have the same problem, that a new service isn't really reachable from my cloud machine, and I'm really at the end of my nerves on how to fix this.
The weirdest thing is, that I have a second instance of Gitea running and there it works. I can even delete the service, it gets recreated with ArgoCD and the connection still works.
Something, somewhere is just going wrong with new services and MetalLB...
ngrigoriev commentedon Nov 13, 2022
I have just reinstalled MetalLB (because I needed to recreate my little cluster)with ArgoCD and everything went up perfectly. This is what I used in my application.yaml:
TheAnachronism commentedon Nov 13, 2022
Well this is what I had in the ArgoCD application:
Does the same thing, but still didn't realy work.
Anyways I kind of ArgoCD excluded, as I reinstalled MetalLB manually with kustomize and something is still going wrong.
TheAnachronism commentedon Nov 15, 2022
Alright, so about my problem, just wanted to note that I fixed it, and it didn't have anything to do with MetalLB...
Still, thanks for the help^^
18 remaining items
dusatvoj commentedon Jan 20, 2024
Any chance to fix that? I've installed new cluster with k8s 1.27, metallb 0.13.12 and argocd 2.9.5 and there's many times during reconciliation this ...

and this:

even there's no change @ metallb
fedepaol commentedon Jan 24, 2024
Cutting a release in these days with the fix for this
benzman81 commentedon Feb 1, 2024
same issue here using rancher fleet
fedepaol commentedon Feb 1, 2024
@benzman81 mind testing with the latest release? It should have the managedFields set
benzman81 commentedon Feb 1, 2024
@fedepaol we ran into the issue today using the lates helm chart
metallb:0.14.3. We currenlty fixed it by adding this to fleet.yaml:Griznah commentedon Feb 5, 2024
I had the same issue today as well, with 0.14.3. I have
selfHeal: true, so I just deleted the CRD to get back to sync, but this was ofc just temporary. Had to addignoreDifferences.ChristianCiach commentedon Mar 28, 2024
Workaround if you are using Carvel kapp:
See https://carvel.dev/kapp/docs/v0.60.x/config/#rebaserules for documentation.
lexfrei commentedon Apr 4, 2024
For anyone who trying to google the problem, here is the summarised solution from this thread which worked for me:
fedepaol commentedon Jun 17, 2024
The managedFields property is set as we can see with
and
I'll close this issue and file one for the documentation, code wise there's nothing more we can do.
Fix metallb diff in argocd
chore: fix metallb diff in argocd
Ignore caBundle in CRDs, they are managed by MetalLB and will always …
https://github.com/metallb/metallb/issues/1681#issuecomment-1312620526
AlePini commentedon Sep 16, 2026
Better approach to ignore all managedFields from MetalLB, use:
Or set globally on ArgoCD config (using Helm Chart as example):