Open belgaied2 opened 2 years ago
i had the same problem. rancher-monitoring chart has hooks with jobs that patch these resource (which are modified for the fleet in the end) after the helm installation, i guess fleet cannot handle this at the moment.
@belgaied2 a diff is needed to inform fleet to ignore the modified objects. I have an example here: https://github.com/ibrokethecloud/core-bundles/blob/master/monitoring/fleet.yaml
Disclosure: I'm somewhat new to Kubernetes.
If anyone else is struggling with this, it's probably because the official fleet-examples are outdated.
To fix the issue, add the following code to the Rancher Monitoring fleet.yaml file and redeploy the changes.
diff:
comparePatches:
- apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks"}
- apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks"}
This happens when Fleet catches the final object being different from what you originally requested.
In the above screenshot we can see that two objects got modified at runtime - MutatingWebhookConfiguration
and ValidatingWebhookConfiguration
. If we download the YAML file of the affected bundle and navigate to the summary:
section, we'll see that the /webhooks
object has been patched during runtime. Therefore, we append the above diff to let Fleet know to ignore these changes.
Note: A more proper way might be to fine-tune the excluded objects, i.e. /webhooks/0/<object name>
.
For more information, refer to https://fleet.rancher.io/bundle-diffs/
The patch diff logic is really buggy, so
diff:
comparePatches:
- apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks/0/admissionReviewVersions"}
- {"op":"remove", "path":"/webhooks/0/clientConfig"}
- {"op":"remove", "path":"/webhooks/0/failurePolicy"}
- {"op":"remove", "path":"/webhooks/0/matchPolicy"}
- {"op":"remove", "path":"/webhooks/0/name"}
- {"op":"remove", "path":"/webhooks/0/namespaceSelector"}
- {"op":"remove", "path":"/webhooks/0/objectSelector"}
- {"op":"remove", "path":"/webhooks/0/reinvocationPolicy"}
- {"op":"remove", "path":"/webhooks/0/rules/0"}
- {"op":"remove", "path":"/webhooks/0/sideEffects"}
- {"op":"remove", "path":"/webhooks/0/timeoutSeconds"}
doens't work !!
While
diff:
comparePatches:
- apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks/0"}
work.
although both should be the same !! as i exclude every single child json path !!!!
Description
I would like to deploy Rancher Monitoring, Logging, etc. using Fleet and the following GitHub Repos:
GitRepo object (for Monitoring):
Logging works just fine but GitRepo for Monitoring stays in the Modifed state as shown here:
A look at the resources of the GitRepo shows:
Here is the end of status section for Monitoring bundle:
If I patch manually using kubectl one of the above patches, it works and the bundle and GitRepo are then both in the Active state.
Environment