From da1001c4430e49f068fc1bea2382b11e71cbd99c Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Mon, 9 Oct 2023 14:36:44 -0700 Subject: [PATCH] address comments --- apis/cluster/v1beta1/zz_generated.deepcopy.go | 2 +- apis/placement/v1beta1/commons.go | 2 +- apis/placement/v1beta1/zz_generated.deepcopy.go | 2 +- apis/v1alpha1/zz_generated.deepcopy.go | 2 +- pkg/controllers/workgenerator/controller.go | 5 +++-- .../manifests/{resourceQuota.yaml => resourcequota.yaml} | 0 .../workgenerator/manifests/test-envelop-configmap.yaml | 2 +- .../workgenerator/manifests/test-envelop-configmap2.yaml | 2 +- pkg/controllers/workgenerator/suite_test.go | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) rename pkg/controllers/workgenerator/manifests/{resourceQuota.yaml => resourcequota.yaml} (100%) diff --git a/apis/cluster/v1beta1/zz_generated.deepcopy.go b/apis/cluster/v1beta1/zz_generated.deepcopy.go index 4a52ac1e5..f983670b4 100644 --- a/apis/cluster/v1beta1/zz_generated.deepcopy.go +++ b/apis/cluster/v1beta1/zz_generated.deepcopy.go @@ -11,7 +11,7 @@ Licensed under the MIT license. package v1beta1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/apis/placement/v1beta1/commons.go b/apis/placement/v1beta1/commons.go index e74debac4..f5e682928 100644 --- a/apis/placement/v1beta1/commons.go +++ b/apis/placement/v1beta1/commons.go @@ -79,5 +79,5 @@ const ( // PreviousBindingStateAnnotation is the annotation that records the previous state of a binding. // This is used to remember if an "unscheduled" binding was moved from a "bound" state or a "scheduled" state. - PreviousBindingStateAnnotation = fleetPrefix + "PreviousBindingState" + PreviousBindingStateAnnotation = fleetPrefix + "previous-binding-state" ) diff --git a/apis/placement/v1beta1/zz_generated.deepcopy.go b/apis/placement/v1beta1/zz_generated.deepcopy.go index c55bb5975..acfc9cb73 100644 --- a/apis/placement/v1beta1/zz_generated.deepcopy.go +++ b/apis/placement/v1beta1/zz_generated.deepcopy.go @@ -11,7 +11,7 @@ Licensed under the MIT license. package v1beta1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" ) diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 8ad756ac9..c584671c5 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -12,7 +12,7 @@ package v1alpha1 import ( corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/pkg/controllers/workgenerator/controller.go b/pkg/controllers/workgenerator/controller.go index 63d5ed762..bd7539209 100644 --- a/pkg/controllers/workgenerator/controller.go +++ b/pkg/controllers/workgenerator/controller.go @@ -279,7 +279,7 @@ func (r *Reconciler) syncAllWork(ctx context.Context, resourceBinding *fleetv1be // generate a work object for the manifests if there are still any non enveloped resources newWork = append(newWork, generateSnapshotWorkObj(workNamePrefix, resourceBinding, snapshot, simpleManifests)) } else { - klog.V(2).InfoS("Skip generating work for the snapshot since there is no none-enveloped resource in the snapshot", "snapshot", klog.KObj(snapshot)) + klog.V(2).InfoS("the snapshot contains enveloped resource only", "snapshot", klog.KObj(snapshot)) } // issue all the create/update requests for the corresponding works for each snapshot in parallel for i := range newWork { @@ -393,7 +393,8 @@ func (r *Reconciler) getConfigMapEnvelopWorkObj(ctx context.Context, workNamePre "resourceBinding", klog.KObj(resourceBinding), "configMapWrapper", klog.KObj(envelopeObj)) return nil, controller.NewUserError(err) } - klog.V(2).InfoS("Successfully extract the enveloped resources from the configMap", "numOfResources", len(manifest), "configMapWrapper", klog.KObj(envelopeObj)) + klog.V(2).InfoS("Successfully extract the enveloped resources from the configMap", "numOfResources", len(manifest), + "snapshot", klog.KObj(resourceSnapshot), "resourceBinding", klog.KObj(resourceBinding), "configMapWrapper", klog.KObj(envelopeObj)) // Try to see if we already have a work represent the same enveloped object for this CRP in the same cluster envelopWorkLabelMatcher := client.MatchingLabels{ fleetv1beta1.ParentBindingLabel: resourceBinding.Name, diff --git a/pkg/controllers/workgenerator/manifests/resourceQuota.yaml b/pkg/controllers/workgenerator/manifests/resourcequota.yaml similarity index 100% rename from pkg/controllers/workgenerator/manifests/resourceQuota.yaml rename to pkg/controllers/workgenerator/manifests/resourcequota.yaml diff --git a/pkg/controllers/workgenerator/manifests/test-envelop-configmap.yaml b/pkg/controllers/workgenerator/manifests/test-envelop-configmap.yaml index 3f232dfa4..451947aae 100644 --- a/pkg/controllers/workgenerator/manifests/test-envelop-configmap.yaml +++ b/pkg/controllers/workgenerator/manifests/test-envelop-configmap.yaml @@ -48,4 +48,4 @@ data: - UPDATE resources: - pods - sideEffects: None \ No newline at end of file + sideEffects: None diff --git a/pkg/controllers/workgenerator/manifests/test-envelop-configmap2.yaml b/pkg/controllers/workgenerator/manifests/test-envelop-configmap2.yaml index 489969d12..a580d6971 100644 --- a/pkg/controllers/workgenerator/manifests/test-envelop-configmap2.yaml +++ b/pkg/controllers/workgenerator/manifests/test-envelop-configmap2.yaml @@ -36,4 +36,4 @@ data: - UPDATE resources: - pods - sideEffects: None \ No newline at end of file + sideEffects: None diff --git a/pkg/controllers/workgenerator/suite_test.go b/pkg/controllers/workgenerator/suite_test.go index 474e967fb..a02d89a8c 100644 --- a/pkg/controllers/workgenerator/suite_test.go +++ b/pkg/controllers/workgenerator/suite_test.go @@ -164,7 +164,7 @@ func readTestManifests() { Expect(err).Should(Succeed()) By("Read ResourceQuota") - rawByte, err = os.ReadFile("manifests/resourceQuota.yaml") + rawByte, err = os.ReadFile("manifests/resourcequota.yaml") Expect(err).Should(Succeed()) testEnvelopeResourceQuota, err = yaml.ToJSON(rawByte) Expect(err).Should(Succeed())