kubernetes-retired/hierarchical-namespaces

Always show diffs in `HierarchicalResourceQuota` resources and manifests

Closed this issue · 4 comments

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?

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.