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

OSD-26287 - Add '--reason' to 'osdctl cluster etcd-health-check' #647

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

tnierman
Copy link
Member

https://issues.redhat.com/browse/OSD-26287


Adds a required --reason flag to the osdctl cluster etcd-health-check command, allowing it to successfully exec into an etcd pod to run etcdctl commands.

For example, the current logic results in the following:

[tnierman@tnierman-thinkpadp1gen5] >> ~/workspace/osdctl/dist/osdctl_linux_amd64_v1/osdctl cluster etcd-health-check $CLUSTERID -S
INFO[0000] Backplane URL retrieved via OCM environment: https://api.stage.backplane.openshift.com 
INFO[0000] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command. 
INFO[0001] Backplane URL retrieved via OCM environment: https://api.stage.backplane.openshift.com 
INFO[0001] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command. 
+----------------------------------------------------------------+
|                CONTROLPLANE NODE STATUS                        |
+----------------------------------------------------------------+
ip-10-0-15-44.us-west-1.compute.internal        Ready   True
ip-10-0-22-91.us-west-1.compute.internal        Ready   True
ip-10-0-49-89.us-west-1.compute.internal        Ready   True
+----------------------------------------------------------------+
|               ETCD POD STATUS                                  |
+----------------------------------------------------------------+
etcd-ip-10-0-15-44.us-west-1.compute.internal   4/4
etcd-ip-10-0-22-91.us-west-1.compute.internal   4/4
etcd-ip-10-0-49-89.us-west-1.compute.internal   4/4
+---------------------------------------------------------------+
|               ETCD MEMBER HEALTH STATUS                       |
+---------------------------------------------------------------+
3 members are available

pods "etcd-ip-10-0-15-44.us-west-1.compute.internal" is forbidden: User "system:serviceaccount:openshift-backplane-srep:ed20b22e60f9973ab686e54bacf38f54" cannot create resource "pods/exec" in API group "" in the namespace "openshift-etcd"
$ etcdctl endpoint status -w table

pods "etcd-ip-10-0-15-44.us-west-1.compute.internal" is forbidden: User "system:serviceaccount:openshift-backplane-srep:ed20b22e60f9973ab686e54bacf38f54" cannot create resource "pods/exec" in API group "" in the namespace "openshift-etcd"
$ etcdctl endpoint health -w table

pods "etcd-ip-10-0-15-44.us-west-1.compute.internal" is forbidden: User "system:serviceaccount:openshift-backplane-srep:ed20b22e60f9973ab686e54bacf38f54" cannot create resource "pods/exec" in API group "" in the namespace "openshift-etcd"
$ etcdctl member list -w table

Adding the reason flag allows this to execute successfully:

[tnierman@tnierman-thinkpadp1gen5] >> ~/workspace/osdctl/dist/osdctl_linux_amd64_v1/osdctl cluster etcd-health-check $CLUSTERID --reason testing -S
INFO[0000] Backplane URL retrieved via OCM environment: https://api.stage.backplane.openshift.com 
INFO[0000] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command. 
INFO[0001] Backplane URL retrieved via OCM environment: https://api.stage.backplane.openshift.com 
INFO[0002] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command. 
+----------------------------------------------------------------+
|                CONTROLPLANE NODE STATUS                        |
+----------------------------------------------------------------+
ip-10-0-15-44.us-west-1.compute.internal        Ready   True
ip-10-0-22-91.us-west-1.compute.internal        Ready   True
ip-10-0-49-89.us-west-1.compute.internal        Ready   True
+----------------------------------------------------------------+
|               ETCD POD STATUS                                  |
+----------------------------------------------------------------+
etcd-ip-10-0-15-44.us-west-1.compute.internal   4/4
etcd-ip-10-0-22-91.us-west-1.compute.internal   4/4
etcd-ip-10-0-49-89.us-west-1.compute.internal   4/4
+---------------------------------------------------------------+
|               ETCD MEMBER HEALTH STATUS                       |
+---------------------------------------------------------------+
3 members are available

$ etcdctl endpoint status -w table
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|        ENDPOINT         |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://10.0.15.44:2379 | f67c06d7ddeeaa3e |  3.5.16 |  205 MB |     false |      false |         9 |      75977 |              75977 |        |
| https://10.0.22.91:2379 | bba5a12344edd51b |  3.5.16 |  206 MB |      true |      false |         9 |      75977 |              75977 |        |
| https://10.0.49.89:2379 | 1e518e2c8b9dcbb2 |  3.5.16 |  206 MB |     false |      false |         9 |      75977 |              75977 |        |
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

$ etcdctl endpoint health -w table
+-------------------------+--------+------------+-------+
|        ENDPOINT         | HEALTH |    TOOK    | ERROR |
+-------------------------+--------+------------+-------+
| https://10.0.49.89:2379 |   true | 7.071363ms |       |
| https://10.0.22.91:2379 |   true |  7.28867ms |       |
| https://10.0.15.44:2379 |   true | 7.500636ms |       |
+-------------------------+--------+------------+-------+

$ etcdctl member list -w table
+------------------+---------+------------------------------------------+-------------------------+-------------------------+------------+
|        ID        | STATUS  |                   NAME                   |       PEER ADDRS        |      CLIENT ADDRS       | IS LEARNER |
+------------------+---------+------------------------------------------+-------------------------+-------------------------+------------+
| 1e518e2c8b9dcbb2 | started | ip-10-0-49-89.us-west-1.compute.internal | https://10.0.49.89:2380 | https://10.0.49.89:2379 |      false |
| bba5a12344edd51b | started | ip-10-0-22-91.us-west-1.compute.internal | https://10.0.22.91:2380 | https://10.0.22.91:2379 |      false |
| f67c06d7ddeeaa3e | started | ip-10-0-15-44.us-west-1.compute.internal | https://10.0.15.44:2380 | https://10.0.15.44:2379 |      false |
+------------------+---------+------------------------------------------+-------------------------+-------------------------+------------+

@openshift-ci openshift-ci bot requested review from dustman9000 and Tafhim December 23, 2024 20:05
Copy link
Contributor

@joshbranham joshbranham 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 openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 6, 2025
Copy link
Member

@typeid typeid left a comment

Choose a reason for hiding this comment

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

/approve

Copy link
Contributor

openshift-ci bot commented Jan 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joshbranham, tnierman, typeid

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2025
Copy link
Contributor

openshift-ci bot commented Jan 7, 2025

@tnierman: all tests passed!

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 56b14b0 into openshift:master Jan 7, 2025
5 checks passed
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants