Skip to content

Remove metrics logic from cmd/anisble-operator/main.go#3466

Merged
bharathi-tenneti merged 3 commits intooperator-framework:masterfrom
bharathi-tenneti:ansible-metrics
Jul 21, 2020
Merged

Remove metrics logic from cmd/anisble-operator/main.go#3466
bharathi-tenneti merged 3 commits intooperator-framework:masterfrom
bharathi-tenneti:ansible-metrics

Conversation

@bharathi-tenneti
Copy link
Copy Markdown
Contributor

Description: Remove kubemetrics package reference logic from cmd/ansible-operator/main.go.
Remove corresponding checks from hack/tests/e2e-ansible.sh

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

Copy link
Copy Markdown
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.

We can also remove these lines, I think:

- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- "get"
- "create"
- apiGroups:
- apps
resources:
- deployments/finalizers
resourceNames:
- {{ .ProjectName }}
verbs:
- "update"
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- apps
resources:
- replicasets
- deployments
verbs:
- get

Comment thread hack/tests/e2e-ansible.sh Outdated
Comment on lines +80 to +86
# header_text "verify that the metrics endpoint exists (Port 8686)"
# if ! timeout 1m bash -c -- "until kubectl run --attach --rm --restart=Never test-metrics --image=$metrics_test_image -- curl -sfo /dev/null http://memcached-operator-metrics:8686/metrics; do sleep 1; done";
# then
# error_text "FAIL: Failed to verify that metrics endpoint exists"
# operator_logs
# exit 1
# fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be fully removed since port 8686 is only for the legacy kube-state-metrics stuff that's being removed.

Comment thread hack/tests/e2e-ansible.sh
# exit 1
# fi

# header_text "verify that the metrics endpoint exists (Port 8383)"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a TODO here to add a --metrics-addr flag to the ansible operator and default it to 8080.

See #3440

Once we have an equivalent PR merged for ansible, we'll need to update this port to be 8080.

Comment thread hack/tests/e2e-ansible.sh Outdated
exit 1
fi
# header_text "verify that metrics reflect cr creation"
# if ! timeout 60s bash -c -- "until kubectl run --attach --rm --restart=Never test-metrics --image=$metrics_test_image -- curl -sf http://memcached-operator-metrics:8686/metrics | grep example-memcached; do sleep 1; done";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the metric is now on 8383 via the instrumented handler:

Suggested change
# if ! timeout 60s bash -c -- "until kubectl run --attach --rm --restart=Never test-metrics --image=$metrics_test_image -- curl -sf http://memcached-operator-metrics:8686/metrics | grep example-memcached; do sleep 1; done";
# if ! timeout 60s bash -c -- "until kubectl run --attach --rm --restart=Never test-metrics --image=$metrics_test_image -- curl -sf http://memcached-operator-metrics:8383/metrics | grep example-memcached; do sleep 1; done";

@joelanford joelanford mentioned this pull request Jul 20, 2020
92 tasks
Copy link
Copy Markdown
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

Once the unit tests pass.

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

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2020
Copy link
Copy Markdown
Member

@fabianvf fabianvf left a comment

Choose a reason for hiding this comment

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

LGTM, though it needs a rebase

breaking: true
migration:
header: Remove legacy metrics generation code from cmd/ansible-operator/main.go, and tests/e2e-anisble.sh checks for servicemonitor.
body: TBD No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit space

@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 21, 2020
@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 21, 2020
@bharathi-tenneti bharathi-tenneti merged commit b7b0c17 into operator-framework:master Jul 21, 2020
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

Successfully merging this pull request may close these issues.

5 participants