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

Bug 1829072: Fix all of the k8s_event module instances. #1203

Merged

Conversation

timflannagan
Copy link
Member

Previously, all instances of the k8s_event module were using an invalid k8s_event.name configuration. This produced an error like the following:

TASK [meteringconfig : Log Events for validating configurations] ***************
task path: /opt/ansible/roles/meteringconfig/tasks/validate.yml:91
Tuesday 28 April 2020  18:09:29 +0000 (0:00:00.365)       0:00:14.305 ********* 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: MaxRetryError: HTTPConnectionPool(host='localhost', port=8888): Max retries exceeded with url: /api/v1/namespaces/openshift-metering/events/Validate Configuration (Caused by ProtocolError('Connection aborted.', InvalidURL("URL can't contain control characters. '/api/v1/namespaces/openshift-metering/events/Validate Configuration' (found at least ' ')",)))
fatal: [localhost]: FAILED! => {"changed": false, "msg": "HTTPConnectionPool(host='localhost', port=8888): Max retries exceeded with url: /api/v1/namespaces/openshift-metering/events/Validate Configuration (Caused by ProtocolError('Connection aborted.', InvalidURL(\"URL can't contain control characters. '/api/v1/namespaces/openshift-metering/events/Validate Configuration' 

This k8s_event.name field directly corresponds to the traditional metadata.name for a k8s resource, which is how kubernetes refers to an object in a resource URL. This error is produced as the previous configuration(s) had invalid control characters being passed to the k8s_event module implementation.

On top of this, I changed the k8s_event.reportingComponent to be an optional field as it's not directly applicable to our use case in the metering-ansible-operator, and many of the core events often don't utilize this field.

Other changes that were made:

  • Substituting the source.component to be the metering-ansible-operator, as "Metering Component" doesn't provide much value and it's difficult to interpret from that source what controller is responsible for firing off this event.
  • Reorganizing the k8s_event.reason, k8s_event.message, and k8s_event.state to better reflect the current state of the metering-ansible-operator reconciliation effort.
  • In the case of an error, i.e. a user-provided configuration was invalid, only the status field of the MeteringConfig custom resource was updated, and no event was fired off warning a user that they might need to take manually intervene.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high labels May 1, 2020
@openshift-ci-robot
Copy link

@timflannagan1: This pull request references Bugzilla bug 1829072, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1829072: Fix all of the k8s_status module instances.

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/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label May 1, 2020
@timflannagan
Copy link
Member Author

Still need to verify some edge cases
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 1, 2020
Copy link
Member

@EmilyM1 EmilyM1 left a comment

Choose a reason for hiding this comment

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

It looks like the only thing that changed was the component to metering-ansible-operator. This is alot of change in many files when only 1 line in each needed to change. How about just changing component? Is that an option here?
I see reportingComponent key is not longer required, but this is a subtraction of 1 line, wondering why the repositioning in each file is needed rather than 2 line alterations?

@timflannagan
Copy link
Member Author

@EmilyM1 I think you're missing the point of this change - It's possible I need to be more explicit in the PR's description. The problem stems from all of the instances of the k8s_event.name being invalid.

@timflannagan timflannagan changed the title Bug 1829072: Fix all of the k8s_status module instances. Bug 1829072: Fix all of the k8s_evebt module instances. May 1, 2020
@timflannagan timflannagan changed the title Bug 1829072: Fix all of the k8s_evebt module instances. Bug 1829072: Fix all of the k8s_event module instances. May 1, 2020
@timflannagan timflannagan force-pushed the fix-events-module branch 2 times, most recently from 47181a2 to 23f6a5b Compare May 1, 2020 21:38
@EmilyM1
Copy link
Member

EmilyM1 commented May 2, 2020

Oh I know see the name changes as well! I checked the k8 object name link. It does make sense.

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: EmilyM1, timflannagan1

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@timflannagan
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2020
@timflannagan timflannagan force-pushed the fix-events-module branch 2 times, most recently from 03274a3 to bd3dcf9 Compare May 4, 2020 20:21
Previously, all instances of the `k8s_event` module were using an invalid `k8s_event.name` configuration. This produced an error like the following:

```yaml
TASK [meteringconfig : Log Events for validating configurations] ***************
task path: /opt/ansible/roles/meteringconfig/tasks/validate.yml:91
Tuesday 28 April 2020  18:09:29 +0000 (0:00:00.365)       0:00:14.305 *********
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: MaxRetryError: HTTPConnectionPool(host='localhost', port=8888): Max retries exceeded with url: /api/v1/namespaces/openshift-metering/events/Validate Configuration (Caused by ProtocolError('Connection aborted.', InvalidURL("URL can't contain control characters. '/api/v1/namespaces/openshift-metering/events/Validate Configuration' (found at least ' ')",)))
fatal: [localhost]: FAILED! => {"changed": false, "msg": "HTTPConnectionPool(host='localhost', port=8888): Max retries exceeded with url: /api/v1/namespaces/openshift-metering/events/Validate Configuration (Caused by ProtocolError('Connection aborted.', InvalidURL(\"URL can't contain control characters. '/api/v1/namespaces/openshift-metering/events/Validate Configuration'
```

This `k8s_event.name` field directly corresponds to the [traditional `metadata.name`](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) for a k8s resource, which is how kubernetes refers to an object in a resource URL. This error is produced as the previous configuration(s) had invalid control characters being passed to the `k8s_event` module implementation.

On top of this, I changed the `k8s_event.reportingComponent` to be an optional field as it's not directly applicable to our use case in the metering-ansible-operator, and many of the core events often don't utilize this field.

Other changes that were made:
- Substituting the `source.component` to be the metering-ansible-operator, as "Metering Component" doesn't provide much value and it's difficult to interpret from that source what controller is responsible for firing off this event.
- Reorganizing the `k8s_event.reason`, `k8s_event.message`, and `k8s_event.state` to better reflect the current state of the metering-ansible-operator reconciliation effort.
- In the case of an error, i.e. a user-provided configuration was invalid, only the status field of the `MeteringConfig` custom resource was updated, and no event was fired off warning a user that they might need to take manually intervene.
@timflannagan
Copy link
Member Author

/test all

@bentito
Copy link
Member

bentito commented May 5, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2020
@timflannagan
Copy link
Member Author

We should probably file a BZ for the many-to-many errors when trying to query Prometheus for the pvc-related queries despite its reproducibility.
/retest

@openshift-merge-robot openshift-merge-robot merged commit 4a05361 into kube-reporting:master May 5, 2020
@openshift-ci-robot
Copy link

@timflannagan1: Some pull requests linked via external trackers have merged: . The following pull requests linked via external trackers have not merged:

In response to this:

Bug 1829072: Fix all of the k8s_event module instances.

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/test-infra repository.

@timflannagan timflannagan deleted the fix-events-module branch May 5, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants