-
Notifications
You must be signed in to change notification settings - Fork 8
NO-JIRA: Claude tool - etcd troubleshooting skill #32
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
Open
fonta-rh
wants to merge
24
commits into
main
Choose a base branch
from
claude-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9,356
−1
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
55a3f58
Add force-new-cluster helper
fonta-rh f3d987c
Initial docs for claude etcd slash command
fonta-rh c90a60a
Initial project file
fonta-rh 5c6cdb7
Add access validation playbook
fonta-rh a543d7f
Swap from slash command to skill
fonta-rh 3b8e3e1
Add diagnosis tools
fonta-rh 8aaac76
Update READMEs
fonta-rh 56576ee
Update gitignore to ignore create rpm files
fonta-rh 24af791
Update to add small blurb to README
fonta-rh 17f1f6b
Remove gitsubmodule
fonta-rh 2a8ed48
Update podman-etcd filename to avoid shell check
fonta-rh 0552c1d
Add quick reference
fonta-rh 27b45cd
Make cluster access optional
fonta-rh f94e559
Update to make sure only cluster_vms are targeted with pcs commands
fonta-rh a9c80e4
Update files to use the right host group
fonta-rh abc9230
Update references to force-new-cluster playbook and other automated t…
fonta-rh cdbd2d9
Update force-new-cluster helper
fonta-rh 4733524
Add log location
fonta-rh 5c3205d
Update force new cluster playbook
fonta-rh 4657a89
Move etcd scripts and playbooks to helpers/etcd/
fonta-rh 531c756
Document diagnostic approach options in troubleshooting skill
fonta-rh f09ccdd
Fetch podman-etcd resource agent from upstream on demand
fonta-rh 104b801
Collect all podman logs instead of last 100 lines
fonta-rh 654715c
Auto-detect etcd leader in force-new-cluster playbook
fonta-rh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| # Etcd Troubleshooting Skill - Permission Configuration | ||
|
|
||
| This document defines the permission grants for the etcd troubleshooting skill to enable faster diagnostics without requiring user approval for read-only operations. | ||
|
|
||
| ## Permission Philosophy | ||
|
|
||
| **Automatic (No User Approval Required):** | ||
| - Read-only operations on diagnostic data | ||
| - File reading from diagnostic output directories | ||
| - Basic Ansible fact gathering (no changes) | ||
| - OpenShift cluster status queries (read-only) | ||
|
|
||
| **Requires User Approval:** | ||
| - Any operation that modifies cluster state | ||
| - Running Ansible playbooks (except validation) | ||
| - Executing remediation scripts | ||
| - Pacemaker resource operations (cleanup, restart, etc.) | ||
|
|
||
| ## Granted Permissions | ||
|
|
||
| ### Bash Tool - Read-Only Commands | ||
|
|
||
| The following Bash commands are automatically approved for execution without user permission: | ||
|
|
||
| ``` | ||
| # File reading operations | ||
| Bash(cat:*) # Read any file | ||
| Bash(head:*) # Read beginning of files | ||
| Bash(tail:*) # Read end of files | ||
| Bash(less:*) # Page through files | ||
|
|
||
| # File searching and filtering | ||
| Bash(grep:*) # Search file contents | ||
| Bash(find:*) # Find files | ||
| Bash(ls:*) # List directory contents | ||
|
|
||
| # Diagnostic data inspection | ||
| Bash(jq:*) # Parse JSON output | ||
| Bash(yq:*) # Parse YAML output | ||
|
|
||
| # Git read-only operations | ||
| Bash(git log:*) # View git history | ||
| Bash(git status:*) # Check git status | ||
| Bash(git diff:*) # View differences | ||
|
|
||
| # Ansible read-only operations | ||
| Bash(ansible cluster_vms -i * -m ping) # Test connectivity | ||
| Bash(ansible cluster_vms -i * -m setup) # Gather facts | ||
| Bash(ansible *_master_* -i * -m shell -a "cat *") # Read files via Ansible | ||
| Bash(ansible *_master_* -i * -m shell -a "grep *") # Search files via Ansible | ||
| Bash(ansible *_master_* -i * -m shell -a "tail *") # Read file ends via Ansible | ||
| Bash(ansible *_master_* -i * -m shell -a "pcs status*") # Read Pacemaker status | ||
| Bash(ansible *_master_* -i * -m shell -a "pcs resource status*") # Read resource status | ||
| Bash(ansible *_master_* -i * -m shell -a "podman ps*") # List containers | ||
| Bash(ansible *_master_* -i * -m shell -a "podman exec etcd etcdctl member list*") # Read member list | ||
| Bash(ansible *_master_* -i * -m shell -a "podman exec etcd etcdctl endpoint health*") # Check health | ||
| Bash(ansible *_master_* -i * -m shell -a "podman exec etcd etcdctl endpoint status*") # Check status | ||
| Bash(ansible *_master_* -i * -m shell -a "crm_attribute --query*") # Query CIB attributes | ||
| Bash(ansible *_master_* -i * -m shell -a "journalctl*") # Read system logs | ||
| Bash(ansible *_master_* -i * -m shell -a "systemctl status*") # Check service status | ||
|
|
||
| # OpenShift read-only operations (via oc-wrapper or with proxy sourcing) | ||
| Bash(source deploy/openshift-clusters/proxy.env && oc get*) # Read cluster resources | ||
| Bash(source deploy/openshift-clusters/proxy.env && oc describe*) # Describe resources | ||
| Bash(source deploy/openshift-clusters/proxy.env && oc logs*) # Read pod logs | ||
| Bash(*oc-wrapper.sh get*) # Get resources via wrapper | ||
| Bash(*oc-wrapper.sh describe*) # Describe resources via wrapper | ||
| Bash(*oc-wrapper.sh logs*) # Read logs via wrapper | ||
| ``` | ||
|
|
||
| ### Read Tool - Diagnostic Directories | ||
|
|
||
| The following paths are automatically approved for reading: | ||
|
|
||
| ``` | ||
| Read(/tmp/etcd-diagnostics-*/*) # All diagnostic collection outputs | ||
| Read(/tmp/ansible-validation.log) # Ansible validation output | ||
| Read(deploy/openshift-clusters/inventory.ini) # Inventory file (read-only) | ||
| Read(deploy/openshift-clusters/proxy.env) # Proxy configuration (read-only) | ||
| Read(.claude/commands/etcd/**) # Skill documentation | ||
| ``` | ||
|
|
||
| ### Validation Scripts (Read-Only) | ||
|
|
||
| These scripts only validate access and don't modify state: | ||
|
|
||
| ``` | ||
| Bash(helpers/etcd/validate-cluster-access.sh) | ||
| ``` | ||
|
|
||
| ## Operations Requiring User Approval | ||
|
|
||
| The following operations will always prompt for user approval: | ||
|
|
||
| ### Ansible Playbooks | ||
|
|
||
| ``` | ||
| ansible-playbook */collect-diagnostics.yml # Requires approval (executes many commands) | ||
| ansible-playbook */validate-access.yml # Requires approval | ||
| ansible-playbook helpers/force-new-cluster.yml # ALWAYS requires approval (destructive) | ||
| ansible-playbook * # Any other playbook | ||
| ``` | ||
|
|
||
| ### Orchestration Scripts | ||
|
|
||
| ``` | ||
| helpers/etcd/collect-all-diagnostics.sh # Requires approval (runs playbook) | ||
| ``` | ||
|
|
||
| ### Pacemaker Operations (Write) | ||
|
|
||
| ``` | ||
| ansible * -m shell -a "pcs resource cleanup*" # Requires approval (clears failures) | ||
| ansible * -m shell -a "pcs resource restart*" # Requires approval (restarts resources) | ||
| ansible * -m shell -a "pcs resource disable*" # Requires approval (disables resources) | ||
| ansible * -m shell -a "pcs resource enable*" # Requires approval (enables resources) | ||
| ansible * -m shell -a "pcs property set*" # Requires approval (changes config) | ||
| ansible * -m shell -a "crm_attribute --delete*" # Requires approval (modifies CIB) | ||
| ansible * -m shell -a "crm_attribute --update*" # Requires approval (modifies CIB) | ||
| ``` | ||
|
|
||
| ### Etcd Operations (Write) | ||
|
|
||
| ``` | ||
| ansible * -m shell -a "podman exec etcd etcdctl member remove*" # Requires approval | ||
| ansible * -m shell -a "podman exec etcd etcdctl member add*" # Requires approval | ||
| ansible * -m shell -a "podman exec etcd etcdctl put*" # Requires approval | ||
| ansible * -m shell -a "podman exec etcd etcdctl del*" # Requires approval | ||
| ``` | ||
|
|
||
| ### System Operations | ||
|
|
||
| ``` | ||
| ansible * -m shell -a "systemctl restart*" # Requires approval | ||
| ansible * -m shell -a "systemctl stop*" # Requires approval | ||
| ansible * -m shell -a "systemctl start*" # Requires approval | ||
| ansible * -m shell -a "reboot*" # Requires approval | ||
| ``` | ||
|
|
||
| ## Usage in Claude Code | ||
|
|
||
| To apply these permissions, they need to be added to the Claude Code system configuration. This is typically done in one of two ways: | ||
|
|
||
| 1. **Project-level**: In `.claude/settings.json` or project configuration | ||
| 2. **User-level**: In global Claude Code settings | ||
|
|
||
| ### Example Configuration Format | ||
|
|
||
| ```json | ||
| { | ||
| "autoApprove": { | ||
| "bash": [ | ||
| "cat:*", | ||
| "tail:*", | ||
| "head:*", | ||
| "grep:*", | ||
| "ls:*", | ||
| "git status:*", | ||
| "git log:*", | ||
| "ansible cluster_vms -i * -m ping", | ||
| "source deploy/openshift-clusters/proxy.env && oc get*" | ||
| ], | ||
| "read": [ | ||
| "/tmp/etcd-diagnostics-*/**", | ||
| "/tmp/ansible-validation.log", | ||
| "deploy/openshift-clusters/inventory.ini", | ||
| "deploy/openshift-clusters/proxy.env", | ||
| ".claude/commands/etcd/**" | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Safety Considerations | ||
|
|
||
| ### Why These Permissions Are Safe | ||
|
|
||
| **Read-only Bash commands:** | ||
| - Cannot modify cluster state | ||
| - Cannot delete data | ||
| - Cannot change configurations | ||
| - Only inspect and report | ||
|
|
||
| **Read tool permissions:** | ||
| - Limited to diagnostic output and documentation | ||
| - No write access to sensitive files | ||
| - Inventory and proxy.env are read-only copies | ||
|
|
||
| **Validation scripts:** | ||
| - Only test connectivity | ||
| - Don't execute remediation actions | ||
| - Safe to run repeatedly | ||
|
|
||
| ### What Remains Protected | ||
|
|
||
| **Anything that changes state:** | ||
| - Resource operations (cleanup, restart, etc.) | ||
| - CIB attribute modifications | ||
| - Playbook executions | ||
| - Service restarts | ||
| - Member additions/removals | ||
|
|
||
| This ensures the skill can quickly gather and analyze diagnostic information while still requiring explicit user approval for any corrective actions. | ||
|
|
||
| ## Updating Permissions | ||
|
|
||
| As the skill evolves, this document should be updated to reflect: | ||
| 1. New safe read-only operations that can be auto-approved | ||
| 2. New operations that require user approval | ||
| 3. Any changes to the permission boundaries | ||
|
|
||
| When in doubt, default to requiring user approval - it's better to ask permission than to execute an unexpected operation. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is awesome! Does it always work, or the agent is picky? 😁
I need something similar in my environment