Skip to content

Commit

Permalink
fixup! remove enableKSMCRSMetrics and comment on /etc-based asset r…
Browse files Browse the repository at this point in the history
…emoval

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
  • Loading branch information
rexagod committed Apr 20, 2024
1 parent 7e5e2ad commit 551a7ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ PKGS=$(shell go list ./... | grep -v /test/e2e)
GOLANG_FILES:=$(shell find . -name \*.go -print)
# NOTE: grep -v %.yaml is needed because "%s-policy.yaml" is used
# in manifest.go and that isn't a valid asset.
# NOTE: Certain paths included in the manifest.go file are not valid
# asset paths and should be excluded from the list of assets. These
# paths are:
# - /etc/ (`/etc/kube-state-metrics/custom-resource-state-configmap.yaml`)
ASSETS=$(shell grep -oh '[^"]*/.*\.yaml' pkg/manifests/manifests.go \
| grep -v '^/etc' \
| grep -v '%.*yaml' | sed 's/^/assets\//')
Expand Down
4 changes: 1 addition & 3 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ func (o *Operator) sync(ctx context.Context, key string) error {
}

// Enable kube-state-metrics' custom-resource-state-based metrics if VPA CRD is installed within the cluster.
enableKSMCRSMetrics := false
isVPACRDPresent, err := o.client.VPACustomResourceDefinitionPresent(ctx, o.lastKnownVPACustomResourceDefinitionPresent)
if err != nil {
// Throw on all transient errors.
Expand All @@ -785,10 +784,9 @@ func (o *Operator) sync(ctx context.Context, key string) error {
// If we didn't get an error, we can safely assume that the CRD is deterministically either present or absent.
if *isVPACRDPresent {
klog.Infof("%s CRD found, enabling kube-state-metrics' custom-resource-state-based metrics", client.VerticalPodAutoscalerCRDMetadataName)
enableKSMCRSMetrics = true
}
}
o.lastKnownVPACustomResourceDefinitionPresent = &enableKSMCRSMetrics
o.lastKnownVPACustomResourceDefinitionPresent = isVPACRDPresent

factory := manifests.NewFactory(
o.namespace,
Expand Down

0 comments on commit 551a7ab

Please sign in to comment.