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 #1404

Closed
wants to merge 11 commits into from

Conversation

vivekr-splunk
Copy link
Collaborator

@vivekr-splunk vivekr-splunk commented Nov 20, 2024

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

Signed-off-by: Vivek Reddy <[email protected]>
tools/kubectl-splunk Fixed Show fixed Hide fixed
…mation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
tools/kubectl-splunk Fixed Show fixed Hide fixed
Signed-off-by: Vivek Reddy <[email protected]>
tools/kubectl-splunk Fixed Show fixed Hide fixed
…mation

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
tools/kubectl-splunk Fixed Show fixed Hide fixed
Signed-off-by: Vivek Reddy <[email protected]>
tools/kubectl-splunk/kubectl_splunk/main.py Dismissed Show dismissed Hide dismissed
Vivek Reddy added 6 commits November 21, 2024 12:38
@vivekr-splunk vivekr-splunk deleted the CSPL-3156 branch November 21, 2024 20:54
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.

2 participants