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

Remove metrics logic from cmd/helm-operator/main.go #3451

Merged

Conversation

bharathi-tenneti
Copy link
Contributor

Description: Remove kubemetrics package reference logic from cmd/helm-operator/main.go.

Motivation: Now that we have handler to setup metrics on primary resources using handler.InstrumentedEnqueueRequestForObject{}, we do not separate KubeMetrics to setup metrics.

Partially closes, #3354

@@ -16,17 +16,14 @@ package main

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not missing remove from cmd/ansible-operator/main.go as well?
Also, should we not add the fragment here with TBD?

Copy link
Contributor Author

@bharathi-tenneti bharathi-tenneti Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be doing separate PR for Ansible, and regarding fragment I had a question if we are adding individual fragments for removal PRs. As in the meeting, some one was saying about doing one big Fragment with all PRs. I just need clarification on that.

Copy link
Contributor

@camilamacedo86 camilamacedo86 Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add many fragments in the same pr. IMO we can do all in the same PR as we are doing in the other cases to be easier to check that and we do not miss anything.

  • remove addmetrics impl from anisble and helm
  • remove the pkg/kube-metrics
  • remove what is not long used from pkg/k8sutil
  • add 4 fragments so far 1 for ansible, 1 for helm, 1 for pkg/kube-metrics, 1 for the pkg/utils removed funcs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should add individual removal fragments. Those require migration sections, but we're doing this:

migration:
  header: <what got removed>
  body: TBD

Then when we go to do the release, we'll run the generator and then rewrite the release notes, using what's there to remind us what to cover.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, Ill follow above template, and add fragment for this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return err
}
return nil
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also:

  • remove the check for the service monitor in hack/tests/e2e-helm.sh
  • remove the env section for the pod spec template in internal/plugins/helm/v1/scaffolds/templates/manager/config.go

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 17, 2020
@joelanford joelanford mentioned this pull request Jul 17, 2020
92 tasks
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 17, 2020
Comment on lines 55 to 76
metrics_service="nginx-operator-controller-manager-metrics-service"

# verify that metrics service was created
if ! timeout 60s bash -c -- "until kubectl get service/${metrics_service} --namespace=${operator_namespace} > /dev/null 2>&1; do sleep 1; done";
then
error_text "Failed to get metrics service"
operator_logs
exit 1
fi


serviceaccount_secret=$(kubectl get serviceaccounts default -n ${operator_namespace} -o jsonpath='{.secrets[0].name}')
token=$(kubectl get secret ${serviceaccount_secret} -n ${operator_namespace} -o jsonpath={.data.token} | base64 -d)

# verify that the metrics endpoint exists
if ! timeout 60s bash -c -- "until kubectl run --attach --rm --restart=Never --namespace=${operator_namespace} test-metrics --image=${metrics_test_image} -- -sfkH \"Authorization: Bearer ${token}\" https://${metrics_service}:8443/metrics; do sleep 1; done";
then
error_text "Failed to verify that metrics endpoint exists"
operator_logs
exit 1
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this should be kept. We still have a metrics service in the Kubebuilder layout, but it is created alongside the operator as part of the kustomize manifests.

The only thing we need to remove from the e2e is the test for the presence of the servicemonitors/nginx-operator-metrics (which you've already done)

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2020
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to do all in the same PR. But, I am OK with it.

/lgtm

@bharathi-tenneti bharathi-tenneti merged commit b747a2c into operator-framework:master Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants