File kubectl-switch-2.2.8.obscpio of Package kubectl-switch
07070100000000000081A40000000000000000000000016857F182000000DF000000000000000000000000000000000000002800000000kubectl-switch-2.2.8/.commitlintrc.json{
"rules": {
"subject-case": [
2,
"never",
[
"start-case",
"pascal-case",
"upper-case"
]
],
"header-max-length": [
2,
"always",
150
]
}
}07070100000001000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000001D00000000kubectl-switch-2.2.8/.github07070100000002000081A40000000000000000000000016857F18200000015000000000000000000000000000000000000002800000000kubectl-switch-2.2.8/.github/CODEOWNERS* @mircea-pavel-anton07070100000003000081A40000000000000000000000016857F1820000156C000000000000000000000000000000000000003000000000kubectl-switch-2.2.8/.github/Code_of_Conduct.md
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
@mircea-pavel-anton.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
07070100000004000081A40000000000000000000000016857F18200000023000000000000000000000000000000000000002900000000kubectl-switch-2.2.8/.github/funding.yml---
github:
- mircea-pavel-anton
07070100000005000081A40000000000000000000000016857F182000001B6000000000000000000000000000000000000002A00000000kubectl-switch-2.2.8/.github/labeler.yaml---
area/docker:
- changed-files:
- any-glob-to-any-file: ".dockerignore"
- any-glob-to-any-file: "Dockerfile"
area/github:
- changed-files:
- any-glob-to-any-file: ".github/**/*"
area/go:
- changed-files:
- any-glob-to-any-file: "cmd/**/*"
- any-glob-to-any-file: "internal/**/*"
- any-glob-to-any-file: "pkg/**/*"
- any-glob-to-any-file: "go.mod"
- any-glob-to-any-file: "go.sum"
07070100000006000081A40000000000000000000000016857F18200000142000000000000000000000000000000000000002900000000kubectl-switch-2.2.8/.github/labels.yaml---
# =================================================================================================
# Areas
# =================================================================================================
- name: area/docker
color: "3970E4"
- name: area/github
color: "000000"
- name: area/go
color: "844FBA"
07070100000007000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000002700000000kubectl-switch-2.2.8/.github/workflows07070100000008000081A40000000000000000000000016857F1820000023F000000000000000000000000000000000000003700000000kubectl-switch-2.2.8/.github/workflows/actionlint.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Actionlint
permissions: { contents: read }
on:
workflow_dispatch: {}
push:
paths:
- ".github/workflows/*.yaml"
- ".mise.toml"
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Run actionlint
run: mise exec -- actionlint
07070100000009000081A40000000000000000000000016857F18200000476000000000000000000000000000000000000003300000000kubectl-switch-2.2.8/.github/workflows/codeql.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CodeQL
permissions:
security-events: write
packages: read
actions: read
contents: read
on:
schedule: [{ cron: "0 0 * * *" }]
push: { branches: ["main"] }
pull_request: { branches: ["main"] }
workflow_dispatch: {}
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: go
build-mode: autobuild
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Initialize CodeQL
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
category: "/language:${{matrix.language}}"
0707010000000A000081A40000000000000000000000016857F18200000322000000000000000000000000000000000000003700000000kubectl-switch-2.2.8/.github/workflows/commitlint.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Commitlint
permissions: { contents: read }
on:
pull_request_target: {}
push: {}
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Validate PR Title
if: github.event_name == 'pull_request_target'
run: echo "$PR_TITLE" | mise exec -- commitlint --verbose
env:
PR_TITLE: ${{ github.event.pull_request.title }}
- name: Validate last commit
if: github.event_name == 'push'
run: mise exec -- commitlint --last --verbose
0707010000000B000081A40000000000000000000000016857F182000002A2000000000000000000000000000000000000003A00000000kubectl-switch-2.2.8/.github/workflows/golangci-lint.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: GolangCI Lint
permissions: { contents: read }
on:
workflow_dispatch: {}
push:
paths:
- .github/workflows/golangci-lint.yaml
- .golangci.yaml
- ".mise.toml"
- "**.go"
- "go.mod"
- "go.sum"
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Run golangci-lint
run: mise exec -- golangci-lint run
0707010000000C000081A40000000000000000000000016857F18200000810000000000000000000000000000000000000003700000000kubectl-switch-2.2.8/.github/workflows/goreleaser.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Goreleaser
permissions: { contents: read }
on:
release: { types: [published] } # wet run
push: # dry run
paths:
- .github/workflows/goreleaser.yaml
- .goreleaser.yaml
- ".mise.toml"
- "**.go"
- "go.mod"
- "go.sum"
workflow_dispatch:
inputs:
dry-run:
description: Dry Run
required: false
default: false
type: boolean
jobs:
goreleaser:
if: github.repository_owner == 'mirceanton' # ? don't run on forks -> missing repo secrets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: { fetch-depth: 0 }
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Run goreleaser (dry-run)
if: github.event_name != 'release' || inputs.dry-run == 'true'
run: goreleaser --snapshot
env: { TAP_GITHUB_TOKEN: "${{ secrets.GHCR_RW_TOKEN }}" }
- name: Generate Token
if: github.event_name == 'release' || inputs.dry-run == 'false'
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Login to Container Registry
if: github.event_name == 'release' || inputs.dry-run == 'false'
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GHCR_RW_TOKEN }}"
- name: Run goreleaser
if: github.event_name == 'release' || inputs.dry-run == 'false'
run: mise exec -- goreleaser --clean
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
TAP_GITHUB_TOKEN: "${{ secrets.GHCR_RW_TOKEN }}"
0707010000000D000081A40000000000000000000000016857F1820000058A000000000000000000000000000000000000003700000000kubectl-switch-2.2.8/.github/workflows/label-sync.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Label Sync
permissions: { contents: read }
on:
schedule: [{cron: '0 * * * *'}]
workflow_dispatch:
inputs:
dry-run:
description: Dry Run
default: true
required: false
type: boolean
pull_request:
paths:
- .github/workflows/label-sync.yaml
- .github/labels.yaml
push:
branches: ["main", "master"]
paths:
- .github/workflows/label-sync.yaml
- .github/labels.yaml
jobs:
label-sync:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: "${{ steps.app-token.outputs.token }}"
sparse-checkout: "${{ env.LABEL_SYNC_CONFIG_FILE }}"
- name: Sync Labels
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
with:
dry-run: "${{ (inputs.dry-run || github.event_name == 'pull_request') == true }}"
token: "${{ steps.app-token.outputs.token }}"
config-file: .github/labels.yaml
0707010000000E000081A40000000000000000000000016857F18200000597000000000000000000000000000000000000003400000000kubectl-switch-2.2.8/.github/workflows/labeler.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Labeler
permissions: { contents: read }
on:
pull_request_target: {}
jobs:
size-label:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Size Label
uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
labeler:
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: "${{ steps.app-token.outputs.token }}"
- name: Labeler
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
with:
sync-labels: true
repo-token: "${{ steps.app-token.outputs.token }}"
configuration-path: .github/labeler.yaml
0707010000000F000081A40000000000000000000000016857F182000007C7000000000000000000000000000000000000003400000000kubectl-switch-2.2.8/.github/workflows/release.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Release
permissions: { contents: read }
on:
schedule: [{cron: '0 0 * * *'}] # wet run
push: {} # dry run
workflow_dispatch:
inputs:
version-increment:
description: 'Version increment type'
required: false
default: 'auto'
type: choice
options: [ "auto", "major", "minor", "patch", "prerelease" ]
dry-run:
description: 'Dry run mode (no actual release)'
required: false
default: false
type: boolean
draft:
description: Mark Release as Draft
default: false
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
release:
if: github.repository_owner == 'mirceanton' # ? don't run on forks
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Generate Release Metadata
id: release-metadata
uses: mirceanton/action-semver-metadata@830294a0f6ab7d2fd11067085a8732ce6066f466 # v1.0.3
with:
github-token: ${{ steps.app-token.outputs.token }}
- name: Create Release
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.dry-run == 'false' ) || (github.event_name == 'schedule') }}
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
name: 'v${{ steps.release-metadata.outputs.next-version }}'
tag_name: 'v${{ steps.release-metadata.outputs.next-version }}'
body: ${{ steps.release-metadata.outputs.release-notes }}
token: ${{ steps.app-token.outputs.token }}
07070100000010000081A40000000000000000000000016857F1820000063E000000000000000000000000000000000000003500000000kubectl-switch-2.2.8/.github/workflows/renovate.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Renovate
permissions: { contents: read }
on:
schedule: [{ cron: "0 * * * *" }]
workflow_dispatch:
inputs:
dry-run:
description: Dry Run
default: false
required: false
type: boolean
log-level:
description: Log Level
type: choice
default: debug
options: [ debug, info ]
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Generate Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
- name: Run Renovate
run: mise exec -- renovate
env:
# https://docs.renovatebot.com/self-hosted-configuration/
LOG_LEVEL: "${{ inputs.log-level || 'debug' }}"
RENOVATE_CONFIG_FILE: .renovaterc.json
RENOVATE_AUTODISCOVER: true
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}"
RENOVATE_DRY_RUN: "${{ inputs.dry-run == true }}"
RENOVATE_TOKEN: "${{ steps.app-token.outputs.token }}"
07070100000011000081A40000000000000000000000016857F18200000247000000000000000000000000000000000000003100000000kubectl-switch-2.2.8/.github/workflows/test.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Test
permissions: { contents: read }
on:
workflow_dispatch: {}
push:
paths:
- ".github/workflows/test.yaml"
- "**.go"
- "go.mod"
- "go.sum"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2
- name: Run Tests
run: bash scripts/test.sh
07070100000012000081A40000000000000000000000016857F18200000539000000000000000000000000000000000000003700000000kubectl-switch-2.2.8/.github/workflows/trivy-scan.yaml---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Trivy
permissions:
security-events: write
contents: read
on:
schedule: [{cron: "1 0 * * *"}]
pull_request: {}
workflow_dispatch:
inputs:
dry-run:
description: Dry Run
required: false
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Create directory for scan results
run: mkdir -p trivy-results
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@76071ef0d7ec797419534a183b498b4d6366cf37 # 0.31.0
with:
image-ref: ghcr.io/${{ github.repository }}:latest
format: 'sarif'
output: 'trivy-results/results.sarif'
severity: 'CRITICAL,HIGH,MEDIUM'
ignore-unfixed: false
vuln-type: 'os,library'
- name: Upload Trivy scan results to GitHub Security tab
if: ${{ !(inputs.dry-run || github.event_name == 'pull_request') }}
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
sarif_file: 'trivy-results/results.sarif'
category: 'trivy'
07070100000013000081A40000000000000000000000016857F18200000027000000000000000000000000000000000000002000000000kubectl-switch-2.2.8/.gitignorekubectl-switch
dist/
configs/
.DS_Store07070100000014000081A40000000000000000000000016857F1820000018B000000000000000000000000000000000000002400000000kubectl-switch-2.2.8/.golangci.yaml---
version: "2"
linters:
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
07070100000015000081A40000000000000000000000016857F18200000F60000000000000000000000000000000000000002600000000kubectl-switch-2.2.8/.goreleaser.yaml---
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
project_name: kubectl-switch
before:
hooks:
- go mod tidy
- go mod download
builds:
- env:
- CGO_ENABLED=0
binary: "{{.ProjectName}}"
goos:
- linux
- darwin
ldflags:
- -s -w -X github.com/mirceanton/{{.ProjectName}}/cmd.version={{.Version}}
archives:
- format: tar.gz
name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"
checksum:
disable: false
name_template: "checksums.txt"
changelog:
disable: false
use: github
sort: asc
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Patches"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "CI"
regexp: ".*ci.*"
order: 998
- title: Others
order: 999
nfpms:
- homepage: https://github.com/mirceanton/{{.ProjectName}}
maintainer: Mircea-Pavel Anton <contact@mirceanton.com>
description: A simple tool to switch between Kubernetes contexts.
file_name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"
license: MIT
formats: [deb, apk, rpm]
brews:
- name: kubectl-switch
description: A simple tool to switch between Kubernetes contexts.
license: MIT
homepage: https://github.com/mirceanton/{{.ProjectName}}
directory: Formula
repository:
owner: mirceanton
name: homebrew-taps
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
test: system "#{bin}/kubectl-switch", "--help"
commit_author:
name: mr-borboto[bot]
email: 170036086+mr-borboto[bot]@users.noreply.github.com
dockers:
- image_templates:
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-amd64"
use: buildx
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.url=https://github.com/mirceanton/{{.ProjectName}}"
- "--label=org.opencontainers.image.source=https://github.com/mirceanton/{{.ProjectName}}"
- "--label=org.opencontainers.image.licenses=MIT"
- "--label=org.opencontainers.image.authors=Mircea-Pavel Anton <contact@mirceanton.com>"
- "--label=org.opencontainers.image.description=A simple tool to switch between Kubernetes contexts."
- image_templates:
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-arm64v8"
use: buildx
goarch: arm64
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.url=https://github.com/mirceanton/{{.ProjectName}}"
- "--label=org.opencontainers.image.source=https://github.com/mirceanton/{{.ProjectName}}"
- "--label=org.opencontainers.image.licenses=MIT"
- "--label=org.opencontainers.image.authors=Mircea-Pavel Anton <contact@mirceanton.com>"
- "--label=org.opencontainers.image.description=A simple tool to switch between Kubernetes contexts."
docker_manifests:
- name_template: "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}"
image_templates:
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-amd64"
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-arm64v8"
- name_template: "ghcr.io/mirceanton/{{.ProjectName}}:latest"
image_templates:
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-amd64"
- "ghcr.io/mirceanton/{{.ProjectName}}:v{{.Version}}-arm64v8"
07070100000016000081A40000000000000000000000016857F182000003E0000000000000000000000000000000000000002000000000kubectl-switch-2.2.8/.mise.toml[tools]
# =================================================================================================
# Project Tools -> pinned versions
# =================================================================================================
go = "1.24.4"
"aqua:golangci/golangci-lint" = "2.1.6"
"aqua:goreleaser/goreleaser" = "2.10.2"
"aqua:kubernetes/kubectl" = "1.33.1"
# =================================================================================================
# Misc Tools
# =================================================================================================
"aqua:kubernetes/minikube" = "latest"
"aqua:helm/helm" = "latest"
"aqua:derailed/k9s" = "latest"
# =================================================================================================
# CI Tools
# =================================================================================================
node = "22"
"npm:renovate" = "40"
"npm:@commitlint/cli" = "19"
"aqua:rhysd/actionlint" = "1"
07070100000017000081A40000000000000000000000016857F1820000008D000000000000000000000000000000000000002600000000kubectl-switch-2.2.8/.renovaterc.json{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "github>mirceanton/renovate-config//default.json5" ]
}07070100000018000081A40000000000000000000000016857F18200000072000000000000000000000000000000000000002000000000kubectl-switch-2.2.8/DockerfileFROM gcr.io/distroless/static-debian12:nonroot
USER 8675:8675
COPY kubectl-switch /
ENTRYPOINT ["/kubectl-switch"]07070100000019000081A40000000000000000000000016857F18200000433000000000000000000000000000000000000001D00000000kubectl-switch-2.2.8/LICENSEMIT License
Copyright (c) 2023 Mircea-Pavel Anton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
0707010000001A000081A40000000000000000000000016857F182000019C0000000000000000000000000000000000000001F00000000kubectl-switch-2.2.8/README.md# kubectl-switch
`kubectl-switch` is a command-line tool for managing and switching between multiple Kubernetes configuration files located in the same directory. It simplifies the process of selecting a Kubernetes context from multiple kubeconfig files and updating the active configuration or namespace.
Just dump all your `kubeconfigs` into a single dir and let `kubectl-switch` manage them for you!
## Features
- **Multiple kubeconfig files**: Manage multiple kubeconfig files with one or more contexts each, all present in a single directory. You don't have to generate a global kubeconfig to hold all of your contexts
- **Context Switching**: Easily switch between different Kubernetes contexts from multiple config files.
- **Namespace Switching**: Quickly change the current namespace in the active context.
- **Previous Config**: Switch back to the previous configuration with `kubectl switch -`.
- **Non-Interactive Mode**: Specify the desired context or namespace directly as an argument.
- **Interactive Mode**: Run the program with no arguments to get an interactive list of available namespaces or contexts to choose from.
- **Persistent Configuration**: Changes persist across different shell sessions.
- **Shell Completions**: Provides tab completion for available contexts and namespaces.
- **Non-destructive**: `kubectl-switch` will never edit those. It will only work with copies of them.
## Why `kubectl-switch`?
`kubectl-switch` is an alternative to tools like `kubectx`, `kubens` and `kubie`. It has been created because I feel all of those fall short in certain regards:
- `kubectx` and `kubens` assume all your contexts are defined in a single config file. Yes, there is some hackery you can do to your `KUBECONFIG` environment variable to make it work with multiple files, but it is (in my opinion) a sub-par workflow and I never really liked it
- `kubie` spawns a new shell when you use it to change contexts, making it practically impossible to integrate into scripts or taskfile automation. Also I consider it to be too complicated of a solution for what is fundamentally a really simple problem
What I wanted was something very simple conceptually: I just want to dump all my `kubeconfig` files in a single directory and then have my tool parse them and "physically" move over the config file to `.kube/config` (or whatever is configured in my `KUBECONFIG` env var) such that it is also persistent between different shells. Here is where `kubectl-switch` comes in!
## Installation
### Install via go install
Install the latest stable version directly using Go:
```bash
# Install the latest version
go install github.com/mirceanton/kubectl-switch/v2@latest
# Or install a specific version
go install github.com/mirceanton/kubectl-switch/v2@v2.2.6
```
> **Note**: Versions prior to v2.2.6 cannot be installed via `go install` due to module path issues. If you need an older version, please use one of the alternative installation methods below.
### Download Precompiled Binaries
Precompiled binaries are available for various platforms. You can download the latest release from the [GitHub Releases page](https://github.com/mirceanton/kubectl-switch/releases/latest).
1. Download the appropriate binary for your system and extract the archive.
2. Make the extracted binary executable:
```bash
chmod +x kubectl-switch
```
3. Move the binary to a directory in your PATH:
```bash
mv kubectl-switch /usr/local/bin/kubectl-switch
```
### Install via Homebrew
1. Add the tap
```bash
brew tap mirceanton/taps
```
2. Install `kubectl-switch`
```bash
brew install kubectl-switch
```
### Running via Docker
`kubectl-switch` is also available as a Docker container:
```bash
docker pull ghcr.io/mirceanton/kubectl-switch
```
To use it with your local kubeconfig files:
```bash
docker run -v ~/.kube:/root/.kube -v /path/to/kubeconfigs:/kubeconfigs \
-e KUBECONFIG_DIR=/kubeconfigs \
ghcr.io/mirceanton/kubectl-switch context
```
### Build from Source
1. Clone the repository:
```bash
git clone https://github.com/mirceanton/kubectl-switch
cd kubectl-switch
```
2. Build the tool:
```bash
go build -o kubectl-switch
```
3. Move the binary to your PATH:
```bash
mv kubectl-switch /usr/local/bin/kubectl-switch
```
## Usage
### Context Command
The `context` (or `ctx`) subcommand is used to switch between Kubernetes contexts (think of `kubectx`):
```bash
# Interactive mode - select context from a list
kubectl-switch context
# Switch to a specific context
kubectl-switch ctx my-context
```
### Namespace Command
The `namespace` (or `ns`) subcommand is used to switch the current namespace (think of `kubens`):
```bash
# Interactive mode - select namespace from a list
kubectl-switch namespace
# Switch to a specific namespace
kubectl-switch ns kube-system
```
### Quickly Switch to Previous Configuration
Switch back to the previous configuration:
```bash
kubectl-switch -
```
### Usage with kubectl plugin
When installed as a kubectl plugin, you can use it directly with the `kubectl` command:
```sh
# These commands are equivalent
kubectl-switch ctx
kubectl switch ctx
```
## Configuration
You can configure `kubectl-switch` using environment variables or CLI flags:
| Environment Variable | CLI Flag | Description | Default Value |
| :--------------------: | :---------------: | :----------------------------------------------: | :--------------------------: |
| `KUBECONFIG_DIR` | `--kubeconfig-dir` | Directory containing your kubeconfig files. | None |
| `KUBECONFIG` | N/A | Path where the active kubeconfig will be stored. | `~/.kube/config` |
## Shell Completion
The `completion` subcommand generates shell completion scripts:
```bash
# Generate completions for bash
kubectl-switch completion bash > /etc/bash_completion.d/kubectl-switch
# Generate completions for zsh
kubectl-switch completion zsh > ~/.zsh/completion/_kubectl-switch
# Generate completions for fish
kubectl-switch completion fish > ~/.config/fish/completions/kubectl-switch.fish
# Generate completions for powershell
kubectl-switch completion powershell > ~/kubectl-switch.ps1
```
## Contributing
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
## License
This project is licensed under the MIT License. See the [`LICENSE`](./LICENSE) file for details.
0707010000001B000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000001900000000kubectl-switch-2.2.8/cmd0707010000001C000081A40000000000000000000000016857F1820000095C000000000000000000000000000000000000002400000000kubectl-switch-2.2.8/cmd/context.gopackage cmd
import (
"github.com/AlecAivazis/survey/v2"
"github.com/mirceanton/kubectl-switch/v2/pkg/kubeconfig"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var contextManager = kubeconfig.NewContextManager(manager)
var contextCmd = &cobra.Command{
Use: "context",
Aliases: []string{"ctx"},
Short: "Switch the active Kubernetes context",
ValidArgsFunction: getContextCompletions,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// Validate and get the config directory
validConfigDir, err := contextManager.ValidateConfigDir(configDir)
if err != nil {
log.Fatal(err)
}
// Get all contexts from kubeconfig files
contextMap, contextNames, err := contextManager.GetContextsFromDir(validConfigDir)
if err != nil {
log.Fatalf("Failed to read kubeconfig files: %v", err)
}
if len(contextMap) == 0 {
log.Fatal("No kubernetes contexts found in the provided directory: ", validConfigDir)
}
// Determine the target context
var selectedContext string
if len(args) == 1 {
selectedContext = args[0]
if _, exists := contextMap[selectedContext]; !exists {
log.Fatalf("Context '%s' not found", selectedContext)
}
} else {
prompt := &survey.Select{
Message: "Choose a context:",
Options: contextNames,
}
err = survey.AskOne(prompt, &selectedContext)
if err != nil {
log.Fatalf("Failed to get user input: %v", err)
}
}
// Switch to the selected context
if err := contextManager.SwitchContext(contextMap[selectedContext], selectedContext); err != nil {
log.Fatalf("Failed to switch context: %v", err)
}
log.Infof("Switched to context '%s'", selectedContext)
},
}
func init() {
rootCmd.AddCommand(contextCmd)
}
// getContextCompletions provides bash completion for available contexts
func getContextCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
configDirFlag, _ := cmd.Flags().GetString("kubeconfig-dir")
validConfigDir, err := contextManager.ValidateConfigDir(configDirFlag)
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
_, contextNames, err := contextManager.GetContextsFromDir(validConfigDir)
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return contextNames, cobra.ShellCompDirectiveNoFileComp
}
0707010000001D000081A40000000000000000000000016857F182000006E8000000000000000000000000000000000000002600000000kubectl-switch-2.2.8/cmd/namespace.gopackage cmd
import (
"github.com/AlecAivazis/survey/v2"
"github.com/mirceanton/kubectl-switch/v2/pkg/kubeconfig"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var namespaceManager = kubeconfig.NewNamespaceManager(manager)
var namespaceCmd = &cobra.Command{
Use: "namespace",
Aliases: []string{"ns"},
Short: "Switch the active Kubernetes namespace",
Args: cobra.MaximumNArgs(1),
ValidArgsFunction: getNamespaceCompletions,
Run: func(cmd *cobra.Command, args []string) {
// Get all namespaces from the current context
namespaceNames, err := namespaceManager.GetNamespaces()
if err != nil {
log.Fatalf("Error listing namespaces: %v", err)
}
// Determine the target namespace
var selectedNamespace string
if len(args) == 1 {
selectedNamespace = args[0]
} else {
prompt := &survey.Select{
Message: "Choose a namespace:",
Options: namespaceNames,
}
err = survey.AskOne(prompt, &selectedNamespace)
if err != nil {
log.Fatalf("Failed to get user input: %v", err)
}
}
// Switch to the selected namespace
if err := namespaceManager.SwitchNamespace(selectedNamespace); err != nil {
log.Fatalf("Failed to switch namespace: %v", err)
}
log.Infof("Switched to namespace '%s'", selectedNamespace)
},
}
func init() {
rootCmd.AddCommand(namespaceCmd)
}
// getNamespaceCompletions provides bash completion for available namespaces
func getNamespaceCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
namespaceNames, err := namespaceManager.GetNamespaces()
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return namespaceNames, cobra.ShellCompDirectiveNoFileComp
}
0707010000001E000081A40000000000000000000000016857F1820000051D000000000000000000000000000000000000002100000000kubectl-switch-2.2.8/cmd/root.gopackage cmd
import (
"os"
"github.com/mirceanton/kubectl-switch/v2/pkg/kubeconfig"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var (
configDir string // Global flag for the kubeconfig directory
version string // The version of the tool, set at build time
manager = kubeconfig.NewManager()
)
var rootCmd = &cobra.Command{
Use: "kubectl-switch",
Annotations: map[string]string{
cobra.CommandDisplayNameAnnotation: "kubectl switch",
},
Short: "A tool to switch Kubernetes contexts",
Long: `kubectl-switch is a CLI tool to switch Kubernetes contexts from multiple kubeconfig files.`,
Version: version,
RunE: func(cmd *cobra.Command, args []string) error {
// Check if the "-" argument is provided to switch to the previous config
if len(args) == 1 && args[0] == "-" {
if err := manager.SwitchToPrevious(); err != nil {
if err == kubeconfig.ErrNoPreviousConfig {
log.Fatal("No previous configuration found")
} else {
log.Fatalf("Failed to switch to previous config: %v", err)
}
}
return nil
}
return cmd.Help()
},
}
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func init() {
rootCmd.PersistentFlags().StringVarP(&configDir, "kubeconfig-dir", "", "", "Directory containing kubeconfig files")
}
0707010000001F000081A40000000000000000000000016857F182000009AD000000000000000000000000000000000000001C00000000kubectl-switch-2.2.8/go.modmodule github.com/mirceanton/kubectl-switch/v2
go 1.24.0
// v2 versions without /v2 in module path
retract [v2.0.0, v2.2.5]
require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.9.1
k8s.io/apimachinery v0.33.2
k8s.io/client-go v0.33.2
)
require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/oauth2 v0.27.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/term v0.30.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.33.2 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
07070100000020000081A40000000000000000000000016857F18200004B16000000000000000000000000000000000000001C00000000kubectl-switch-2.2.8/go.sumgithub.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.33.1 h1:tA6Cf3bHnLIrUK4IqEgb2v++/GYUtqiu9sRVk3iBXyw=
k8s.io/api v0.33.1/go.mod h1:87esjTn9DRSRTD4fWMXamiXxJhpOIREjWOSjsW1kEHw=
k8s.io/api v0.33.2 h1:YgwIS5jKfA+BZg//OQhkJNIfie/kmRsO0BmNaVSimvY=
k8s.io/api v0.33.2/go.mod h1:fhrbphQJSM2cXzCWgqU29xLDuks4mu7ti9vveEnpSXs=
k8s.io/apimachinery v0.33.1 h1:mzqXWV8tW9Rw4VeW9rEkqvnxj59k1ezDUl20tFK/oM4=
k8s.io/apimachinery v0.33.1/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/client-go v0.33.1 h1:ZZV/Ks2g92cyxWkRRnfUDsnhNn28eFpt26aGc8KbXF4=
k8s.io/client-go v0.33.1/go.mod h1:JAsUrl1ArO7uRVFWfcj6kOomSlCv+JpvIsp6usAGefA=
k8s.io/client-go v0.33.2 h1:z8CIcc0P581x/J1ZYf4CNzRKxRvQAwoAolYPbtQes+E=
k8s.io/client-go v0.33.2/go.mod h1:9mCgT4wROvL948w6f6ArJNb7yQd7QsvqavDeZHvNmHo=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4=
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 h1:IUA9nvMmnKWcj5jl84xn+T5MnlZKThmUW1TdblaLVAc=
sigs.k8s.io/structured-merge-diff/v4 v4.6.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
07070100000021000081A40000000000000000000000016857F18200000068000000000000000000000000000000000000001D00000000kubectl-switch-2.2.8/main.gopackage main
import (
"github.com/mirceanton/kubectl-switch/v2/cmd"
)
func main() {
cmd.Execute()
}
07070100000022000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000001900000000kubectl-switch-2.2.8/pkg07070100000023000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000002400000000kubectl-switch-2.2.8/pkg/kubeconfig07070100000024000081A40000000000000000000000016857F18200000751000000000000000000000000000000000000002F00000000kubectl-switch-2.2.8/pkg/kubeconfig/context.gopackage kubeconfig
import (
"os"
"path/filepath"
"strings"
)
// ContextManager handles operations related to Kubernetes contexts
type ContextManager struct {
kubeconfigManager *Manager
}
// NewContextManager creates a new context manager
func NewContextManager(km *Manager) *ContextManager {
return &ContextManager{
kubeconfigManager: km,
}
}
// GetContextsFromDir gets all contexts from kubeconfig files in a directory
func (cm *ContextManager) GetContextsFromDir(configDir string) (map[string]string, []string, error) {
// Handle ~/ in path
if strings.HasPrefix(configDir, "~/") {
homeDir, err := os.UserHomeDir()
if err != nil {
return nil, nil, err
}
configDir = filepath.Join(homeDir, configDir[2:])
}
return cm.kubeconfigManager.GetContextsFromDir(configDir)
}
// SwitchContext switches to the specified context
func (cm *ContextManager) SwitchContext(contextFilePath string, contextName string) error {
// Ensure the destination directory exists
if err := cm.kubeconfigManager.EnsureDir(); err != nil {
return err
}
// Switch to the selected context
if err := cm.kubeconfigManager.SwitchContext(contextFilePath, contextName); err != nil {
return err
}
return nil
}
// ValidateConfigDir ensures the kubeconfig directory is valid and available
func (cm *ContextManager) ValidateConfigDir(configDir string) (string, error) {
if configDir == "" {
configDir = os.Getenv("KUBECONFIG_DIR")
if configDir == "" {
return "", ErrNoConfigDir
}
}
// Handle ~/ in path
if strings.HasPrefix(configDir, "~/") {
homeDir, err := os.UserHomeDir()
if err != nil {
return "", err
}
configDir = filepath.Join(homeDir, configDir[2:])
}
// Check if the directory exists
info, err := os.Stat(configDir)
if err != nil {
return "", err
}
if !info.IsDir() {
return "", ErrNotADirectory
}
return configDir, nil
}
07070100000025000081A40000000000000000000000016857F182000001AE000000000000000000000000000000000000002E00000000kubectl-switch-2.2.8/pkg/kubeconfig/errors.gopackage kubeconfig
import (
"errors"
)
// Common errors for kubeconfig operations
var (
ErrNoConfigDir = errors.New("kubeconfig directory not provided, please provide the directory containing kubeconfig files via the --config-dir flag or KUBECONFIG_DIR environment variable")
ErrNotADirectory = errors.New("the provided path is not a directory")
ErrNoPreviousConfig = errors.New("no previous configuration found")
)
07070100000026000081A40000000000000000000000016857F182000012E4000000000000000000000000000000000000003200000000kubectl-switch-2.2.8/pkg/kubeconfig/kubeconfig.gopackage kubeconfig
import (
"os"
"path/filepath"
log "github.com/sirupsen/logrus"
"k8s.io/client-go/tools/clientcmd"
)
// Manager handles operations related to kubeconfig files
type Manager struct{}
// NewManager creates a new kubeconfig manager
func NewManager() *Manager {
return &Manager{}
}
// GetPath returns the path to the current kubeconfig file
func (m *Manager) GetPath() string {
path := os.Getenv("KUBECONFIG")
if path == "" {
homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatalf("Failed to determine home directory: %v", err)
}
path = filepath.Join(homeDir, ".kube", "config")
}
return path
}
// GetPreviousPath returns the path to the previous kubeconfig file
func (m *Manager) GetPreviousPath() string {
return filepath.Join(filepath.Dir(m.GetPath()), "config.previous")
}
// SaveCurrent backs up the current kubeconfig file
func (m *Manager) SaveCurrent() error {
kubeconfigPath := m.GetPath()
if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) {
return err
}
prevPath := m.GetPreviousPath()
data, err := os.ReadFile(kubeconfigPath)
if err != nil {
return err
}
return os.WriteFile(prevPath, data, 0o600)
}
// SwitchToPrevious switches back to the previous Kubernetes config
func (m *Manager) SwitchToPrevious() error {
kubeconfigPath := m.GetPath()
prevPath := m.GetPreviousPath()
// Check if previous config exists
if _, err := os.Stat(prevPath); os.IsNotExist(err) {
return ErrNoPreviousConfig
}
// Swap the current and previous configs
tempPath := filepath.Join(filepath.Dir(kubeconfigPath), "config.temp")
// Read current config
currentConfig, err := os.ReadFile(kubeconfigPath)
if err != nil {
return err
}
// Read previous config
prevConfig, err := os.ReadFile(prevPath)
if err != nil {
return err
}
// Write current to temp
if err := os.WriteFile(tempPath, currentConfig, 0o600); err != nil {
return err
}
// Write previous to current
if err := os.WriteFile(kubeconfigPath, prevConfig, 0o600); err != nil {
return err
}
// Write temp to previous
if err := os.WriteFile(prevPath, currentConfig, 0o600); err != nil {
return err
}
// Remove temp file
if err := os.Remove(tempPath); err != nil {
log.Warnf("Failed to remove temporary file: %v", err)
}
return nil
}
// EnsureDir ensures that the directory for the kubeconfig file exists
func (m *Manager) EnsureDir() error {
destDir := filepath.Dir(m.GetPath())
return os.MkdirAll(destDir, 0o755)
}
// GetContextsFromDir gets all contexts from kubeconfig files in a directory
func (m *Manager) GetContextsFromDir(configDir string) (map[string]string, []string, error) {
contextMap := make(map[string]string)
var contextNames []string
files, err := os.ReadDir(configDir)
if err != nil {
return nil, nil, err
}
for _, file := range files {
if file.IsDir() {
continue
}
ext := filepath.Ext(file.Name())
if ext != ".yaml" && ext != ".yml" {
continue
}
path := filepath.Join(configDir, file.Name())
kubeconfig, err := clientcmd.LoadFromFile(path)
if err != nil {
log.WithFields(log.Fields{"file": file.Name()}).Warnf("Failed to parse kubeconfig file: %v", err)
continue
}
for contextName := range kubeconfig.Contexts {
if _, exists := contextMap[contextName]; exists {
log.Warnf("Duplicate context name '%s' found in files:\n- %s\n- %s", contextName, contextMap[contextName], path)
continue
}
contextMap[contextName] = path
contextNames = append(contextNames, contextName)
}
}
return contextMap, contextNames, nil
}
// SwitchContext switches to the specified context
func (m *Manager) SwitchContext(contextFilePath string, contextName string) error {
// Save the current config as the previous config
if err := m.SaveCurrent(); err != nil {
log.Warnf("Failed to save current configuration as previous: %v", err)
}
// Load the kubeconfig file for the selected context
kubeconfig, err := clientcmd.LoadFromFile(contextFilePath)
if err != nil {
return err
}
// Update the current context
kubeconfig.CurrentContext = contextName
// Write the updated kubeconfig back to the file
return clientcmd.WriteToFile(*kubeconfig, m.GetPath())
}
// SwitchNamespace switches the namespace in the current context
func (m *Manager) SwitchNamespace(namespace string) error {
// Save the current config as the previous config
if err := m.SaveCurrent(); err != nil {
log.Warnf("Failed to save current configuration as previous: %v", err)
}
// Load the kubeconfig file
kubeconfig, err := clientcmd.LoadFromFile(m.GetPath())
if err != nil {
return err
}
// Update the namespace in the current context
kubeconfig.Contexts[kubeconfig.CurrentContext].Namespace = namespace
// Write the updated kubeconfig back to the file
return clientcmd.WriteToFile(*kubeconfig, m.GetPath())
}
07070100000027000081A40000000000000000000000016857F1820000058E000000000000000000000000000000000000003100000000kubectl-switch-2.2.8/pkg/kubeconfig/namespace.gopackage kubeconfig
import (
"context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
// NamespaceManager handles operations related to Kubernetes namespaces
type NamespaceManager struct {
kubeconfigManager *Manager
}
// NewNamespaceManager creates a new namespace manager
func NewNamespaceManager(km *Manager) *NamespaceManager {
return &NamespaceManager{
kubeconfigManager: km,
}
}
// GetNamespaces gets all namespaces from the current context
func (nm *NamespaceManager) GetNamespaces() ([]string, error) {
kubeconfigPath := nm.kubeconfigManager.GetPath()
// Build the Kubernetes client configuration
config, err := clientcmd.BuildConfigFromFlags("", kubeconfigPath)
if err != nil {
return nil, err
}
// Create the Kubernetes clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
// Get all namespaces
var namespaceNames []string
namespaces, err := clientset.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
if err != nil {
return nil, err
}
for _, ns := range namespaces.Items {
namespaceNames = append(namespaceNames, ns.Name)
}
return namespaceNames, nil
}
// SwitchNamespace switches the namespace in the current context
func (nm *NamespaceManager) SwitchNamespace(namespace string) error {
return nm.kubeconfigManager.SwitchNamespace(namespace)
}
07070100000028000041ED0000000000000000000000026857F18200000000000000000000000000000000000000000000001D00000000kubectl-switch-2.2.8/scripts07070100000029000081A40000000000000000000000016857F18200000D3F000000000000000000000000000000000000002500000000kubectl-switch-2.2.8/scripts/test.sh#!/bin/bash
set -e
# Create config directory if it doesn't exist
export KUBECONFIG_DIR="./configs/"
mkdir -p $KUBECONFIG_DIR
cleanup() {
echo "Performing cleanup..."
# Stop and delete minikube clusters
echo "Stopping and deleting test-cluster-1..."
KUBECONFIG=./configs/cluster1.yaml minikube stop -p test-cluster-1 || true
KUBECONFIG=./configs/cluster1.yaml minikube delete -p test-cluster-1 || true
echo "Stopping and deleting test-cluster-2..."
KUBECONFIG=./configs/cluster2.yaml minikube stop -p test-cluster-2 || true
KUBECONFIG=./configs/cluster2.yaml minikube delete -p test-cluster-2 || true
# Remove config directory
echo "Removing configs directory..."
rm -rf ./configs/
echo "Cleanup completed."
}
setup() {
echo "Performing setup..."
# Build kubectl-switch
echo "Building kubectl-switch..."
go build -o kubectl-switch
# Set up Kubernetes clusters
echo "Setting up test clusters..."
KUBECONFIG=./configs/cluster1.yaml minikube start -p test-cluster-1 &
KUBECONFIG=./configs/cluster2.yaml minikube start -p test-cluster-2 &
wait
echo "Setup completed."
}
run_tests() {
echo "Running tests..."
# Test cluster switching and namespace operations
echo "Switching context to test-cluster-1..."
./kubectl-switch context test-cluster-1
echo "Validating cluster switch to test-cluster-1..."
kubectl get nodes | grep "test-cluster-1" || {
echo "Error: test-cluster-1 not found in node list!" >&2
exit 1
}
echo "Checking no pods in default namespace..."
kubectl get pods --namespace=default 2>&1 | grep "No resources found" || {
echo "Error: Pods found in default namespace!" >&2
exit 1
}
echo "Switching to kube-system namespace..."
./kubectl-switch namespace kube-system
echo "Validating kube-system namespace selection and kube-apiserver running..."
kubectl get pods --namespace=kube-system | grep "kube-apiserver" || {
echo "Error: kube-apiserver not found in kube-system!" >&2
exit 1
}
echo "Switching back to default namespace..."
./kubectl-switch namespace default
echo "Checking again that no pods are in default namespace..."
kubectl get pods --namespace=default 2>&1 | grep "No resources found" || {
echo "Error: Pods found in default namespace!" >&2
exit 1
}
echo "Switching context to test-cluster-2..."
./kubectl-switch context test-cluster-2
echo "Validating cluster switch to test-cluster-2..."
kubectl get nodes | grep "test-cluster-2" || {
echo "Error: test-cluster-2 not found in node list!" >&2
exit 1
}
echo "Switching to previous context..."
./kubectl-switch -
echo "Validating cluster switch to test-cluster-1..."
kubectl get nodes | grep "test-cluster-1" || {
echo "Error: test-cluster-1 not found in node list!" >&2
exit 1
}
echo "========================================================================================="
echo "Tests completed successfully!"
echo "========================================================================================="
}
# Set up trap to ensure cleanup happens on exit
trap cleanup EXIT
# Main execution
echo "Starting E2E tests..."
setup
run_tests
echo "E2E tests completed successfully!"
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!155 blocks