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

Always show diffs in HierarchicalResourceQuota resources and manifests #394

Open
summerwind opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@summerwind
Copy link

I found a case where there is always a diff between the HierarchicalResourceQuota resource and the manifest.
The following manifest can be used to reproduce the problem.

apiVersion: hnc.x-k8s.io/v1alpha2
kind: HierarchicalResourceQuota
metadata:
  name: default
  namespace: default
spec:
  hard:
    count/replicasets.apps: 1000

After applying the above manifest, the diffs obtained using kubectl diff command are as follows. It seems that the values are always diffed by replacing them with SI units.

$ kubectl diff -f hrq.yaml
diff -u -N /var/folders/5l/b5vxg_4x5mj_ty2lvlnslbph0000gp/T/LIVE-460512288/hnc.x-k8s.io.v1alpha2.HierarchicalResourceQuota.default.default /var/folders/5l/b5vxg_4x5mj_ty2lvlnslbph0000gp/T/MERGED-1098353043/hnc.x-k8s.io.v1alpha2.HierarchicalResourceQuota.default.default
--- /var/folders/5l/b5vxg_4x5mj_ty2lvlnslbph0000gp/T/LIVE-460512288/hnc.x-k8s.io.v1alpha2.HierarchicalResourceQuota.default.default	2024-09-19 16:19:25
+++ /var/folders/5l/b5vxg_4x5mj_ty2lvlnslbph0000gp/T/MERGED-1098353043/hnc.x-k8s.io.v1alpha2.HierarchicalResourceQuota.default.default	2024-09-19 16:19:25
@@ -5,14 +5,14 @@
     kubectl.kubernetes.io/last-applied-configuration: |
       {"apiVersion":"hnc.x-k8s.io/v1alpha2","kind":"HierarchicalResourceQuota","metadata":{"annotations":{},"name":"default","namespace":"default"},"spec":{"hard":{"count/replicasets.apps":1000}}}
   creationTimestamp: "2024-09-19T07:19:21Z"
-  generation: 3
+  generation: 4
   name: default
   namespace: default
   resourceVersion: "39813"
   uid: e997b707-8c33-45f6-ab01-37e4574baeec
 spec:
   hard:
-    count/replicasets.apps: 1k
+    count/replicasets.apps: 1000
 status:
   hard:
     count/replicasets.apps: 1k

The replacement to SI units is also done in ResourceQuota, but the following definition of ResourceQuota will not show any difference using kubectl diff.

apiVersion: v1
kind: ResourceQuota
metadata:
  name: default
  namespace: default
spec:
  hard:
    count/replicasets.apps: 1000

This difference in behavior causes problems with GitOps constantly causing manifest synchronization.
Is this HierarchicalResourceQuota resource behavior intended?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant