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

CSPL-3156: Add kubectl-splunk Plugin for Executing Splunk Commands within Kubernetes Pods #1407

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

vivekr-splunk
Copy link
Collaborator

Description

This pull request introduces comprehensive support for the Splunk plugin within kubectl, enabling seamless interaction and management of Splunk instances deployed in Kubernetes clusters. The enhancements include:

  • Plugin Functionality: Allows execution of Splunk CLI commands, REST API interactions, file operations, and interactive shell access directly from kubectl.
  • Authentication Handling: Implements secure credential storage and automatic retrieval of Splunk admin credentials from pods.
  • Configuration Management: Supports configuration via files, environment variables, and command-line arguments for flexibility and ease of use.
  • User Experience Enhancements: Adds verbosity levels, caching mechanisms for pod information, and auto-completion support to improve usability.
  • Documentation: Updates the README.md to provide detailed usage instructions, examples, and configuration guidelines.
  • Testing: Includes unit tests to ensure reliability and correctness of the plugin's functionalities.
  • License Update: Apache License 2.0 to align with project requirements.

Related Issue

Closes CSPL-3156


Type of Change

  • New Feature
    Introduces new functionalities to support Splunk operations within kubectl.

  • Documentation Update
    Enhances the README.md with detailed instructions, examples, and license information.

  • License Change
    Updates the project license to Apache License 2.0.

  • Testing
    Adds unit tests to cover the new features and ensure code reliability.


How Has This Been Tested?

  • Unit Tests
    Implemented using Python's unittest framework with unittest.mock for isolating components. All tests pass successfully, ensuring that new functionalities work as intended.

    python -m unittest discover -s tests
  • Manual Testing
    Performed manual verification of all plugin modes (exec, rest, cp, interactive) to ensure they function correctly within a Kubernetes cluster with Splunk deployments.

  • PyPI Deployment
    Uploaded the package to PyPI and verified installation and functionality using pip and pipx.


Checklist

  • Code follows the project’s style guidelines.
  • Performed a self-review of my own code.
  • Commented code, particularly in hard-to-understand areas.
  • Made corresponding changes to the documentation (README.md).
  • Added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Updated the LICENSE file to Apache License 2.0.
  • Necessary badge updates in README.md reflecting the license change.

License

This project is now licensed under the Apache License 2.0. Please see the LICENSE file for details.


Additional Information

  • Configuration File Location: ~/.kubectl_splunk_config
  • Credentials File Location: ~/.kubectl_splunk_credentials
  • Cache File Location: /tmp/kubectl_splunk_cache.json
  • Supported Python Versions: 3.6 and above
  • Shell Auto-Completion: Supports bash and zsh via argcomplete

Vivek Reddy and others added 12 commits November 20, 2024 10:48
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
…mation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
…mation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
Signed-off-by: Vivek Reddy <vivekrsplunk@github.com>
@akondur akondur changed the base branch from main to develop November 21, 2024 21:09
@vivekr-splunk vivekr-splunk self-assigned this Nov 26, 2024
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.

1 participant