diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 2a4c822..5fd37fc 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,95 +1,115 @@ name: Bug Report -description: Report a bug to help us improve -title: "[Bug Report]: " +description: "๐Ÿ› Report a bug to help us improve" +title: "[Bug]: " labels: ["kind/bug", "needs-triage", "priority/high"] body: - type: markdown attributes: value: | - **Thank you for reporting a bug.** Your feedback is valuable to us. Please fill in as much of the template below as you're able, to help us better understand and fix the bug. + # ๐Ÿ” Bug Report + + Thank you for taking the time to report a bug! Your feedback helps make our project better. + + > ๐Ÿ’ก Before submitting, please search existing issues to avoid duplicates. + + Please fill out the information below as detailed as possible. - type: input id: bug-title attributes: - label: Bug Title - description: Provide a concise title that summarizes the bug. - placeholder: Short and descriptive title of the bug + label: "๐Ÿ“ Bug Title" + description: "Give your bug a clear and descriptive title" + placeholder: "Example: CLI crashes when creating cluster with custom configuration" validations: required: true - type: textarea id: steps-to-reproduce attributes: - label: Steps to Reproduce - description: Describe the steps to reproduce the bug. Be as detailed as possible. - placeholder: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error + label: "๐Ÿ”„ Steps to Reproduce" + description: "Help us recreate the issue by providing detailed steps" + placeholder: | + 1. Install ksctl version X.Y.Z + 2. Run command `...` + 3. Configure settings with... + 4. Observe error... validations: required: true - type: textarea id: expected-behavior attributes: - label: Expected Behavior - description: Describe what you expected to happen. - placeholder: Describe the expected outcome after following the steps above. + label: "โœ… Expected Behavior" + description: "What should have happened?" + placeholder: "Describe what you expected to happen when following the steps above" validations: required: true - type: textarea id: actual-behavior attributes: - label: Actual Behavior - description: Describe what actually happened instead. - placeholder: Describe the actual outcome after following the steps above. + label: "โŒ Actual Behavior" + description: "What happened instead?" + placeholder: | + Describe what actually happened. If you have error messages or screenshots, please include them here. + + ``` + Include any error messages or logs here + ``` validations: required: true - type: input id: environment attributes: - label: Environment - description: Include details like the ksctl version, operating system, and the version of the software in which the bug occurred. - placeholder: e.g., ksctl cli on Windows 10, version 1.3 + label: "๐Ÿ–ฅ๏ธ Environment" + description: | + Tell us about your environment (OS, software versions, etc.) + placeholder: "ksctl v1.3.0, Ubuntu 22.04, Docker 24.0.5" validations: required: true - type: textarea id: additional-context attributes: - label: Additional Context - description: Provide any additional context about the problem here. Screenshots or error logs are very helpful. - placeholder: Any additional information, screenshots, or logs that might help us understand the problem better. + label: "๐Ÿ“Ž Additional Context" + description: | + Add any other context, screenshots, or logs about the problem here. + Tip: You can attach images by dragging & dropping them into this field. + placeholder: "Share any additional information that might help us understand the issue better" validations: required: false - type: checkboxes - id: confirmation + id: affected-components attributes: - label: Confirmation - description: "Please confirm the following:" + label: "๐ŸŽฏ Affected Components" + description: "Which parts of the project are affected by this bug?" options: - - label: I have searched the existing issues and this is a new and unique bug report. - required: true - - label: I agree to provide follow-up information if needed. - required: true + - label: "๐Ÿ–ฅ๏ธ CLI" + - label: "๐ŸŽจ UI" + - label: "๐Ÿ“š Documentation" + - label: "๐Ÿ”ง Core Functionality" + - label: "๐Ÿ”Œ Plugins/Extensions" - type: checkboxes - id: updates + id: confirmations attributes: - label: Scope of changes - description: what all subprojects will be affected? + label: "โœ”๏ธ Confirmations" + description: "Please confirm the following:" options: - - label: Cli - - label: UI - - label: Docs + - label: "๐Ÿ” I have searched existing issues and verified this is a new bug" + required: true + - label: "๐Ÿ’ฌ I will respond to questions and updates in this bug report" + required: true + - label: "๐Ÿ“œ I have read and agree to follow the [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/)" + required: true - - type: checkboxes - id: agreement + - type: markdown attributes: - label: Agreement - description: By submitting this feature proposal, you agree to engage in constructive discussion and follow our [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/) - options: - - label: I agree to engage in constructive discussion and follow the Contribution Guidelines. - required: true + value: | + --- + ๐Ÿ‘ฅ Our maintainers will review your bug report and get back to you as soon as possible. + โญ Thank you for contributing to make our project better! diff --git a/.github/ISSUE_TEMPLATE/enhancement-proposal.yml b/.github/ISSUE_TEMPLATE/enhancement-proposal.yml index dcf00a4..f55e381 100644 --- a/.github/ISSUE_TEMPLATE/enhancement-proposal.yml +++ b/.github/ISSUE_TEMPLATE/enhancement-proposal.yml @@ -1,76 +1,128 @@ name: Enhancement Proposal -description: Suggest an enhancement for an existing feature or propose a new functionality -title: "[Enhancement Proposal]: " +description: "โœจ Propose new features or improvements to existing functionality" +title: "[Enhancement]: " labels: ["kind/enhancement", "needs-triage"] body: - type: markdown attributes: value: | - **Thank you for suggesting an enhancement.** Please fill in as much of the template below as you're able. Your proposal will help us understand your ideas better and improve the project. + # โœจ Enhancement Proposal + + Thank you for helping improve our project! Your ideas and suggestions are valuable to us. + + > ๐Ÿ’ก Before submitting, please check if a similar enhancement has been proposed. + + Let's hear about your amazing idea! ๐Ÿš€ - type: input id: enhancement-title attributes: - label: Enhancement Title - description: Provide a concise title for your enhancement proposal. - placeholder: Short and descriptive title + label: "๐Ÿ“Œ Enhancement Title" + description: "Give your enhancement a clear and descriptive title" + placeholder: "Example: Add support for custom backup schedules" validations: required: true - type: textarea id: enhancement-summary attributes: - label: Summary of the Enhancement - description: A brief summary of the enhancement you're proposing. - placeholder: What enhancement are you proposing and why? + label: "๐Ÿ’ซ Enhancement Summary" + description: "Provide a brief overview of your proposed enhancement" + placeholder: | + Briefly describe: + - What is the enhancement? + - Who will benefit from it? + - How does it improve the project? validations: required: true - type: textarea id: motivation-and-goals attributes: - label: Motivation and Goals - description: What motivates you to propose this enhancement? What goals do you aim to achieve? - placeholder: Explain the motivation behind this proposal and what you hope to achieve. + label: "๐ŸŽฏ Motivation and Goals" + description: "Help us understand the 'why' behind your proposal" + placeholder: | + - What problem does this solve? + - What use cases does it address? + - What benefits will it bring to users? validations: required: true - type: textarea id: detailed-design attributes: - label: Detailed Design - description: Describe in detail how this enhancement should be implemented. Include any specific technical requirements, methods, or steps. - placeholder: Detailed description of the enhancement's design and implementation. + label: "๐Ÿ”จ Detailed Design" + description: "Describe how your enhancement should work" + placeholder: | + Please include: + - Technical implementation details + - Required changes to existing features + - Any new interfaces or APIs + - Performance considerations + + You can use diagrams or code examples: + ```yaml + example: + configuration: + - setting: value + ``` validations: required: true - type: textarea id: alternatives attributes: - label: Alternatives - description: Have you considered any alternative solutions or features? Why is your proposed enhancement preferable? - placeholder: Describe any alternative solutions or features you've considered. + label: "๐Ÿค” Alternative Approaches" + description: "What other approaches have you considered?" + placeholder: | + - Alternative solution 1 and why it was not chosen + - Alternative solution 2 and its trade-offs + - Current workarounds, if any validations: required: false - type: checkboxes - id: updates + id: impact-areas attributes: - label: Scope of changes - description: what all subprojects will be affected? + label: "๐ŸŽฏ Impact Areas" + description: "Which parts of the project will be affected?" options: - - label: Cli - - label: UI - - label: Docs + - label: "๐Ÿ–ฅ๏ธ CLI - Command line interface changes" + - label: "๐ŸŽจ UI - User interface modifications" + - label: "๐Ÿ“š Documentation - Documentation updates" + - label: "โš™๏ธ Core - Core functionality changes" + - label: "๐Ÿ”Œ API - API modifications" + - label: "๐Ÿงช Tests - Test suite updates" + + - type: textarea + id: additional-context + attributes: + label: "๐Ÿ“Ž Additional Context" + description: "Any other context or screenshots about the enhancement" + placeholder: "Add any other relevant information, mockups, or examples here" + validations: + required: false - type: checkboxes id: agreement attributes: - label: Agreement - description: By submitting this feature proposal, you agree to engage in constructive discussion and follow our [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/) + label: "๐Ÿ“ Agreement" + description: | + By submitting this enhancement proposal, you agree to: options: - - label: I agree to engage in constructive discussion and follow the Contribution Guidelines. + - label: "๐Ÿค Engage in constructive discussion and follow our [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/)" required: true + - label: "๐Ÿ’ช Help implement this enhancement if approved (optional)" + - label: "๐Ÿ“ข Provide additional information if requested" + required: true + + - type: markdown + attributes: + value: | + --- + ### ๐Ÿ™ Thank you for your contribution! + Your enhancement proposal will be reviewed by our maintainers. We'll discuss the implementation details and feasibility together. + > โญ Don't forget to star the repository if you haven't already! diff --git a/.github/ISSUE_TEMPLATE/feature-proposal.yml b/.github/ISSUE_TEMPLATE/feature-proposal.yml index 05fec99..1b7e0bf 100644 --- a/.github/ISSUE_TEMPLATE/feature-proposal.yml +++ b/.github/ISSUE_TEMPLATE/feature-proposal.yml @@ -1,85 +1,145 @@ name: Feature Proposal -title: "[Feature Proposal]: " -description: Propose a new feature or enhancement -labels: [ "kind/feature", "needs-triage" ] - +title: "[Feature]: " +description: "๐ŸŒŸ Propose a new feature to enhance our project" +labels: ["kind/feature", "needs-triage"] body: - type: markdown attributes: value: | - Thank you for taking the initiative to propose a new feature! Please fill out the following details to help us understand your proposal better. + # ๐ŸŒŸ New Feature Proposal + + Thank you for proposing a new feature! Your ideas help make our project better. + + > ๐Ÿ’ก Before submitting, please check if a similar feature has been proposed. + + Let's explore your innovative idea together! ๐Ÿš€ - type: input - id: why + id: feature-name attributes: - label: Purpose - description: why do we need this feature + label: "โœจ Feature Name" + description: "What would you like to call this feature?" + placeholder: "Example: Automated Cluster Backup" validations: - required: false + required: true - type: input - id: feature-name + id: why attributes: - label: Feature Name - description: What would you like to call this feature? - placeholder: A brief, descriptive name for the feature + label: "๐ŸŽฏ Purpose" + description: "What problem does this feature solve?" + placeholder: "Example: Users need a way to automatically backup their clusters" validations: required: true - type: textarea id: feature-description attributes: - label: Feature Description - description: Describe the feature you're proposing. Include any specific details that can help us understand what it does and why it's beneficial. - placeholder: Detailed description of the feature + label: "๐Ÿ“ Feature Description" + description: "Describe how your feature would work" + placeholder: | + Please include: + - Detailed description of the feature + - How users will interact with it + - Any technical requirements + - Expected behavior + + You can use code examples: + ```bash + # Example usage + ksctl backup create --schedule="0 0 * * *" + ``` validations: required: true - type: textarea id: benefits attributes: - label: Benefits - description: Explain the benefits of this feature. How does it improve the project? - placeholder: Benefits and improvements + label: "๐ŸŽ Benefits" + description: "How will this feature improve the project?" + placeholder: | + Examples of benefits: + - Improves user productivity by... + - Reduces operational complexity by... + - Enhances security through... validations: required: true - type: textarea id: potential-drawbacks attributes: - label: Potential Drawbacks - description: Are there any potential drawbacks or downsides to implementing this feature? - placeholder: Possible downsides or challenges + label: "โš–๏ธ Potential Drawbacks" + description: "What are the potential challenges or trade-offs?" + placeholder: | + Consider: + - Performance implications + - Maintenance overhead + - Complexity added + - Resource requirements validations: required: false - type: textarea id: alternatives-considered attributes: - label: Alternatives Considered - description: Have you considered any alternative solutions or features? If so, what are they and why were they not suitable? - placeholder: Alternative solutions or features + label: "๐Ÿ”„ Alternatives Considered" + description: "What other approaches have you considered?" + placeholder: | + For each alternative: + - Description of the approach + - Why it wasn't chosen + - Comparison with proposed solution validations: required: false - - type: checkboxes - id: updates + id: impact-areas attributes: - label: Scope of changes - description: what all subprojects will be affected? + label: "๐ŸŽฏ Impact Areas" + description: "Which components will be affected by this feature?" options: - - label: Cli - - label: UI - - label: Docs + - label: "๐Ÿ–ฅ๏ธ CLI - Command line interface" + - label: "๐ŸŽจ UI - User interface" + - label: "๐Ÿ“š Documentation" + - label: "โš™๏ธ Core Features" + - label: "๐Ÿ”Œ External Integrations" + - label: "๐Ÿงช Testing Infrastructure" + + - type: textarea + id: implementation-details + attributes: + label: "๐Ÿ› ๏ธ Implementation Details" + description: "Any technical details about the implementation?" + placeholder: | + Include if you have thoughts on: + - Technical architecture + - Required dependencies + - Integration points + - Migration considerations + validations: + required: false - type: checkboxes id: agreement attributes: - label: Agreement - description: By submitting this feature proposal, you agree to engage in constructive discussion and follow our [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/) + label: "๐Ÿ“‹ Agreements" + description: | + Before submitting, please confirm: options: - - label: I agree to engage in constructive discussion and follow the Contribution Guidelines. + - label: "๐Ÿค I agree to follow the [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/)" + required: true + - label: "๐Ÿ” I have searched for similar feature requests" required: true + - label: "๐Ÿ’ฌ I will participate in the discussion about this feature" + required: true + + - type: markdown + attributes: + value: | + --- + ### ๐Ÿ™ Thank you for your contribution! + + Our maintainers will review your proposal and provide feedback soon. + > ๐Ÿ’ช Want to implement this feature? Let us know in the comments! diff --git a/.github/ISSUE_TEMPLATE/release.yml b/.github/ISSUE_TEMPLATE/release.yml index fff1c41..abbabc0 100644 --- a/.github/ISSUE_TEMPLATE/release.yml +++ b/.github/ISSUE_TEMPLATE/release.yml @@ -1,6 +1,6 @@ name: New Release description: Suggest an enhancement for an existing feature or propose a new functionality -title: "[New Release]: " +title: "๐Ÿš€ [New Release]: " labels: ["triage-accepted"] body: @@ -17,7 +17,7 @@ body: placeholder: Short and descriptive title validations: required: true - + - type: input id: release-url attributes: @@ -53,5 +53,3 @@ body: options: - label: I agree to engage in constructive discussion and follow the Contribution Guidelines. required: true - - diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fdb6187..e0871f9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,4 +9,3 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" - diff --git a/.github/labeler.yml b/.github/labeler.yml index f682e79..e69de29 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,10 +0,0 @@ -'area/cli': -- 'cmd/cli/*' -- 'cmd/cli/**/*' - -'go': -- '**/*.go' -- 'go.mod' -- 'go.sum' - - diff --git a/.github/pull_request-template.md b/.github/pull_request-template.md index 2430b9b..264472f 100644 --- a/.github/pull_request-template.md +++ b/.github/pull_request-template.md @@ -1,22 +1,48 @@ -# Tasks description +## ๐Ÿ—’๏ธ Changelog + -```[tasklist] -### Related Issues -- [ ] #9999 -``` -# Solution +## ๐Ÿ‹๐Ÿผ Issues -```[tasklist] -### Tasks -- [ ] milestones or sub-task which needs to be coverted -``` +### โœ… Completed Issues + +- Fixes: - +### ๐Ÿ“Ž Related Issues + +- Related to: -# Note to reviewers - +## ๐Ÿš€ Task List + +- [ ] +- [ ] -- [ ] Ran Tests locally -- [ ] Checked [Contribution's guidelines](https://docs.ksctl.com/docs/contribution-guidelines/) + +## ๐Ÿ” Review Checklist + +- [ ] Code follows project style guidelines +- [ ] Added/updated tests +- [ ] Ran tests locally +- [ ] Updated documentation +- [ ] Checked [Contribution Guidelines](https://docs.ksctl.com/docs/contribution-guidelines/) + +## ๐Ÿ“ธ Screenshots/Recordings + + +## ๐Ÿ“Œ Additional Notes + + +--- + +
+๐Ÿ’ก PR best practices + +* Keep changes focused and atomic +* Update tests and documentation +* Check for conflicts with main branch +* Respond promptly to review comments +* Follow project coding standards +* Make sure you are using `pre-commit` for that run this command `$ pre-commit install` + +
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4ad3389..8f40866 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -14,19 +14,17 @@ name: "CodeQL" on: push: paths: - - 'internal/**' - - 'pkg/**' - - 'cmd/cli/**' - branches: [ "main" ] + - "pkg/**" + - "cmd/**" + branches: ["main"] pull_request: paths: - - 'internal/**' - - 'pkg/**' - - 'cmd/cli/**' + - "pkg/**" + - "cmd/**" # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] schedule: - - cron: '39 14 * * 2' + - cron: "39 14 * * 2" jobs: analyze: @@ -40,43 +38,42 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go', 'javascript' ] + language: ["go", "javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # โ„น๏ธ Command-line programs to run using the OS shell. + # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # โ„น๏ธ Command-line programs to run using the OS shell. - # ๐Ÿ“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/go-fmt.yaml b/.github/workflows/go-fmt.yaml index 25f49bc..26a21e1 100644 --- a/.github/workflows/go-fmt.yaml +++ b/.github/workflows/go-fmt.yaml @@ -3,34 +3,33 @@ name: ci-test-go on: push: paths: - - 'internal/**' - - 'pkg/**' - - 'cmd/cli/**' + - "pkg/**" + - "cmd/**" branches: [main] pull_request: paths: - - 'internal/**' - - 'pkg/**' - - 'cmd/cli/**' + - "pkg/**" + - "cmd/**" branches: [main] jobs: go-fmt: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: v1.20 + go-version-file: "go.mod" - name: check gofmt pkg dir working-directory: pkg run: gofmt -s -w -d $(find . -type f -name '*.go' -print) - - name: check gofmt internal dir - working-directory: internal + - name: check gofmt cmd dir + working-directory: cmd run: gofmt -s -w -d $(find . -type f -name '*.go' -print) + # TODO: Add linter # - name: check golint # run: $#@$@ diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 2eafb0e..91359ca 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -3,7 +3,7 @@ name: goreleaser on: push: tags: - - 'v*' + - "v*" permissions: contents: write @@ -15,17 +15,20 @@ jobs: environment: goreleaser steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.22.0 + go-version-file: "go.mod" - - name: Install Cosign - uses: sigstore/cosign-installer@main + - name: Install Cosign + uses: sigstore/cosign-installer@v3.8.0 + + - name: Check install! + run: cosign version - name: Set the value id: set_environment @@ -38,7 +41,7 @@ jobs: echo "KSCTL_CORE=$(echo $ksctl_core | jq -r '.tag_name')" >> $GITHUB_ENV - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 07b2183..0000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: "Pull Request Labeler" -on: -- pull_request_target - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml index ab6e950..8fc276e 100644 --- a/.github/workflows/sync-docs.yml +++ b/.github/workflows/sync-docs.yml @@ -5,9 +5,9 @@ on: branches: - main paths: - - 'cli/**' # Adjust this to match your CLI code structure + - 'cmd/**' # Adjust this to match your CLI code structure - '.github/workflows/sync-docs.yml' - + workflow_dispatch: concurrency: @@ -27,14 +27,14 @@ jobs: git clone --branch dev https://github.com/ksctl/docs.git docs-repo - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 'stable' + go-version-file: 'cli-repo/go.mod' - name: Generate Documentation working-directory: cli-repo run: | - mkdir -p gen/docs.md + mkdir -p gen/docs make gen-docs - name: Sync Generated Docs @@ -44,7 +44,7 @@ jobs: rm -rf docs-repo/content/en/docs/Reference mkdir -p docs-repo/content/en/docs/Reference cp /tmp/_index.md docs-repo/content/en/docs/Reference/_index.md - cp -rv cli-repo/gen/docs.md/. docs-repo/content/en/docs/Reference/. + cp -rv cli-repo/gen/docs/. docs-repo/content/en/docs/Reference/. ls -lha docs-repo/content/en/docs/Reference/ - name: Commit and Push Changes diff --git a/.github/workflows/test-mock.yml b/.github/workflows/test-mock.yml deleted file mode 100644 index e9fc4e8..0000000 --- a/.github/workflows/test-mock.yml +++ /dev/null @@ -1,267 +0,0 @@ -name: "Test Functionality of the Mock cli" -on: - pull_request: - paths: - - '.github/workflows/test-mock.yml' - - 'cli/**' - - 'logger/**' - - 'scripts/**' - - 'go.mod' - - 'go.sum' - types: [ labeled, opened, synchronize, reopened ] - branches: [ main ] - push: - paths: - - 'scripts/**' - - 'logger/**' - - 'cli/**' - - '.github/workflows/test-mock.yml' - - 'go.mod' - - 'go.sum' - branches: [ main ] - -jobs: - ksctl-cli-mongodb-driver: - runs-on: ubuntu-latest - if: | - ( - github.event.label.name == 'pr/lgtm' || - contains(github.event.pull_request.labels.*.name, 'pr/lgtm') - ) || ( - github.event_name == 'push' && - github.ref == 'refs/heads/main' - ) - env: - MONGODB_URI: "mongodb://root:1234@127.0.0.1:27017" - steps: - - name: Checkout - uses: actions/checkout@v4.1.4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: 1.22.3 - - - name: build ksctl linux - run: | - set -x - make install_linux - echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}" - - - name: local version - run: | - ${{ env.KSCTL_BIN }} version - - - name: local create - run: | - docker run -d \ - --name mongodb \ - -p 27017:27017 \ - -e MONGO_INITDB_ROOT_USERNAME=root \ - -e MONGO_INITDB_ROOT_PASSWORD=1234 \ - mongo - ${{env.KSCTL_BIN}} create local -n demolocal-extmongo -s external-store-mongodb --verbose -1 --yes - ${{env.KSCTL_BIN}} info -p local -n demolocal-extmongo -s external-store-mongodb --verbose -1 - - - name: local get - run: | - ${{env.KSCTL_BIN}} get -s external-store-mongodb - - - name: local switch - run: | - ${{env.KSCTL_BIN}} switch -p local -v -1 -n demolocal-extmongo -s external-store-mongodb - - - name: local delete - run: | - ${{env.KSCTL_BIN}} delete local -n demolocal-extmongo -v -1 -s external-store-mongodb --yes - - - ksctl-cli: - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - - if: | - ( - github.event.label.name == 'pr/lgtm' || - contains(github.event.pull_request.labels.*.name, 'pr/lgtm') - ) || ( - github.event_name == 'push' && - github.ref == 'refs/heads/main' - ) - runs-on: ${{ matrix.os }} - env: - KSCTL_FAKE_FLAG_ENABLED: "1" - steps: - - name: Checkout - uses: actions/checkout@v4.1.4 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: 1.22.3 - - - name: build ksctl windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - Set-PSDebug -Trace 2 - cd .\scripts - .\builder-mock.ps1 - echo "KSCTL_BIN=$env:LOCALAPPDATA\ksctl\ksctl.exe" >> $env:GITHUB_ENV - - - name: build ksctl linux - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - set -x - make install_linux_mock - echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}" - - - name: build ksctl macos - if: ${{ matrix.os == 'macos-latest' }} - run: | - set -x - make install_macos_intel_mock - echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}" - - - name: version - run: | - ${{ env.KSCTL_BIN }} version - - - name: civo create - run: | - ${{ env.KSCTL_BIN }} create civo -n demo -r LON1 --nodeSizeMP "g4s.kube.small" --version 1.27.1 --verbose -1 -s store-local --yes - - ${{ env.KSCTL_BIN }} info -p civo -n demo -r LON1 --verbose -1 -s store-local - - ${{env.KSCTL_BIN}} create ha-civo -n ha-demo-k3s --nodeSizeDS "fake.small" --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap k3s - - ${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-k3s -s store-local -r LON1 --verbose -1 - - ${{env.KSCTL_BIN}} create ha-civo -n ha-demo-kubeadm --nodeSizeDS "fake.small" --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap kubeadm - - ${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-kubeadm -s store-local -r LON1 --verbose -1 - - - name: azure create - run: | - ${{env.KSCTL_BIN}} create azure -n demo -r fake --nodeSizeMP "fake" -s store-local --version 1.27.1 --verbose -1 --yes - - ${{env.KSCTL_BIN}} info -p azure -n demo -r fake -s store-local --verbose -1 - - ${{env.KSCTL_BIN}} create ha-azure -n ha-demo-k3s --nodeSizeDS "fake" --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap k3s - - ${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-k3s -r fake -s store-local --verbose -1 - - ${{env.KSCTL_BIN}} create ha-azure -n ha-demo-kubeadm --nodeSizeDS "fake" --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap kubeadm - - ${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-kubeadm -r fake -s store-local --verbose -1 - - - name: aws create - run: | - ${{env.KSCTL_BIN}} create aws -n demo -r fake-region --nodeSizeMP "fake" --version 1.30 -s store-local --verbose -1 --yes - - ${{env.KSCTL_BIN}} info -p aws -n demo -r fake-region -s store-local --verbose -1 - - ${{env.KSCTL_BIN}} create ha-aws -n ha-demo-k3s --nodeSizeDS "fake" --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap k3s - - ${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-k3s -r fake-region -s store-local --verbose -1 - - ${{env.KSCTL_BIN}} create ha-aws -n ha-demo-kubeadm --nodeSizeDS "fake" --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap kubeadm - - ${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-kubeadm -r fake-region -s store-local --verbose -1 - - - name: local create - run: | - ${{env.KSCTL_BIN}} create local -n demolocal --version 1.27.1 --verbose -1 -s store-local --yes - ${{env.KSCTL_BIN}} info -p local -n demolocal -s store-local --verbose -1 - - - name: civo get - run: | - ${{env.KSCTL_BIN}} get -s store-local -p civo - - - name: azure get - run: | - ${{env.KSCTL_BIN}} get -s store-local -p azure - - - name: aws get - run: | - ${{env.KSCTL_BIN}} get -s store-local -p aws - - - name: get all - run: | - ${{env.KSCTL_BIN}} get -s store-local - - - name: civo switch - run: | - ${{env.KSCTL_BIN}} switch -p civo -n demo -s store-local -r LON1 - ${{env.KSCTL_BIN}} switch -p ha-civo -n ha-demo-k3s -s store-local -r LON1 - ${{env.KSCTL_BIN}} switch -p ha-civo -n ha-demo-kubeadm -s store-local -r LON1 - - - name: aws switch - run: | - ${{env.KSCTL_BIN}} switch -p aws -n demo -s store-local -r fake-region - ${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-k3s -s store-local -r fake-region - ${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-kubeadm -s store-local -r fake-region - - - name: azure switch - run: | - ${{env.KSCTL_BIN}} switch -p azure -n demo -s store-local -r fake - ${{env.KSCTL_BIN}} switch -p ha-azure -n ha-demo-k3s -s store-local -r fake - ${{env.KSCTL_BIN}} switch -p ha-azure -n ha-demo-kubeadm -s store-local -r fake - - - name: local switch - run: | - ${{env.KSCTL_BIN}} switch -p local -n demolocal -s store-local - - - name: civo scale up and down - run: | - ${{env.KSCTL_BIN}} delete ha-civo del-nodes -n ha-demo-k3s --noWP 0 -r LON1 -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-civo add-nodes -n ha-demo-k3s --noWP 1 --nodeSizeWP "fake.small" -s store-local -r LON1 -v -1 --yes - - ${{env.KSCTL_BIN}} delete ha-civo del-nodes -n ha-demo-kubeadm --noWP 0 -r LON1 -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-civo add-nodes -n ha-demo-kubeadm --noWP 1 --nodeSizeWP "fake.small" -s store-local -r LON1 -v -1 --yes - - - name: azure scale up and down - run: | - ${{env.KSCTL_BIN}} delete ha-azure del-nodes -n ha-demo-k3s --noWP 0 -r fake -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-azure add-nodes -n ha-demo-k3s --noWP 1 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes - - ${{env.KSCTL_BIN}} delete ha-azure del-nodes -n ha-demo-kubeadm --noWP 0 -r fake -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-azure add-nodes -n ha-demo-kubeadm --noWP 1 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes - - - name: aws scale up and down - run: | - ${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-k3s --noWP 0 -r fake-region -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-k3s --noWP 1 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes - - ${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-kubeadm --noWP 0 -r fake-region -s store-local --yes -v -1 - - ${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-kubeadm --noWP 1 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes - - - name: civo delete - run: | - ${{env.KSCTL_BIN}} delete civo -n demo -r LON1 -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-civo -n ha-demo-k3s -r LON1 -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-civo -n ha-demo-kubeadm -r LON1 -s store-local -v -1 --yes - - - name: azure delete - run: | - ${{env.KSCTL_BIN}} delete azure -n demo -r fake -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-azure -n ha-demo-k3s -r fake -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-azure -n ha-demo-kubeadm -r fake -s store-local -v -1 --yes - - - name: aws delete - run: | - # ${{env.KSCTL_BIN}} delete aws -n demo -r fake-region -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-k3s -r fake-region -s store-local -v -1 --yes - ${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-kubeadm -r fake-region -s store-local -v -1 --yes - - - name: local delete - run: | - ${{env.KSCTL_BIN}} delete local -n demolocal -s store-local -v -1 --yes - - diff --git a/.github/workflows/testBuilder.yaml b/.github/workflows/testBuilder.yaml index 9f31bd7..e471ba6 100644 --- a/.github/workflows/testBuilder.yaml +++ b/.github/workflows/testBuilder.yaml @@ -2,59 +2,45 @@ name: Testing Build process on: push: paths: - - 'cli/**' - - 'go.mod' - - 'go.sum' - branches: [ main ] + - "cmd/**" + - "pkg/**" + - "go.mod" + - "go.sum" + branches: [main] pull_request: paths: - - 'cli/**' - - 'go.mod' - - 'go.sum' - branches: [ main ] + - "cmd/**" + - "pkg/**" + - "go.mod" + - "go.sum" + branches: [main] jobs: linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.0 + go-version-file: "go.mod" - run: go version - name: Build and install the latest version run: | make install_linux - ksctl -h + ksctl version macos: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.0 + go-version-file: "go.mod" - run: go version # TODO: add support to check for the M1 chip as well - name: Build and install the latest version on intel chip run: | make install_macos_intel - ksctl -h - - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: 1.21.0 - - run: go version - - name: Build and install the latest version - run: | - cd .\scripts - .\builder.ps1 - cd C:\Users\runneradmin\AppData\Local\ksctl - .\ksctl.exe -h + ksctl version diff --git a/.github/workflows/testLogger.yaml b/.github/workflows/testLogger.yaml index d2b8979..d2acc39 100644 --- a/.github/workflows/testLogger.yaml +++ b/.github/workflows/testLogger.yaml @@ -2,28 +2,28 @@ name: Testing Logger on: push: paths: - - 'logger/**' - - 'go.mod' - - 'go.sum' - branches: [ main ] + - "pkg/logger/**" + - "go.mod" + - "go.sum" + branches: [main] pull_request: paths: - - 'logger/**' - - 'go.mod' - - 'go.sum' - branches: [ main ] + - "pkg/logger/**" + - "go.mod" + - "go.sum" + branches: [main] jobs: unit-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.0 + go-version-file: "go.mod" - run: go version - name: testing - working-directory: logger + working-directory: pkg/logger run: | go test -v ./... diff --git a/.gitignore b/.gitignore index 5118da7..2f66827 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,10 @@ # Go workspace file go.work -.idea/ \ No newline at end of file +.idea/ + +gen/docs/ + +kubeconfig +# Added by goreleaser init: +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9587c4c..8e05cee 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,8 +1,23 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + project_name: ksctl-cli +before: + hooks: + - go mod tidy + builds: - - binary: ksctl - main: ./cli + - env: + - CGO_ENABLED=0 + binary: ksctl goos: - linux - darwin @@ -10,20 +25,39 @@ builds: - amd64 - arm64 ldflags: - - -s -w -X "github.com/ksctl/cli/cli/cmd.BuildDate={{.Env.DATE}}" - - -s -w -X "github.com/ksctl/cli/cli/cmd.Version={{.Env.VERSION}}" - - -s -w -X "github.com/ksctl/ksctl/commons.OCIVersion={{.Env.OCIVERSION}}" - env: - - CGO_ENABLED=0 + - -s -w -X "github.com/ksctl/cli/cli/v2/pkg/config.BuildDate={{.Env.DATE}}" + - -s -w -X "github.com/ksctl/cli/cli/v2/pkg/config.Version={{.Env.VERSION}}" + - -s -w -X "github.com/ksctl/ksctl/v2/pkg/config.KsctlCoreVer={{.Env.OCIVERSION}}" signs: - cmd: cosign certificate: '${artifact}.cert' args: - sign-blob - - '--output-certificate=${certificate}' + - '--output-certificate=${certificate}' - '--output-signature=${signature}' - '${artifact}' - --yes artifacts: all output: true + +changelog: + sort: asc + filters: + exclude: + - "^scripts:" + - "^gen:" + +release: + draft: true + make_latest: true + header: >- + # ๐Ÿš€ Changelog + + This release contains a number of enhancements and bug fixes. For a full list of changes + + footer: >- + + --- + + Released by [GoReleaser](https://github.com/goreleaser/goreleaser). diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..78b8a10 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,39 @@ +repos: + - repo: local + hooks: + - id: add-license + name: Add License Headers + entry: addlicense + language: system + types: [go] + args: ["-c", "Ksctl Authors"] + + - id: go-fmt + name: go fmt + entry: gofmt -l -w . + language: system + types: [go] + + - id: go-vet + name: go vet + entry: go vet ./... + language: system + types: [go] + pass_filenames: false + + - id: go-mod-tidy + name: go mod tidy + entry: go mod tidy + language: system + pass_filenames: false + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-executables-have-shebangs diff --git a/MAINTAINERS.md b/MAINTAINERS.md index b0047fd..773f724 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -3,4 +3,3 @@ | Name | GitHub Profile | |---------------|-----------------| | Dipankar Das | dipankardas011 | - diff --git a/Makefile b/Makefile index dd57b01..8ddeaa2 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,7 @@ GOOS_LINUX = linux -GOOS_WINDOWS = windows GOOS_MACOS = darwin GOARCH_LINUX ?= amd64 -GOARCH_WINDOWS ?= amd64 GOARCH_MACOS = arm64 GOARCH_MACOS_INTEL = amd64 @@ -16,29 +14,10 @@ help: ## Display this help. ##@ Generate .PHONY: gen-docs gen-docs: ## Generates docs - go run gen_docs.go + go run gen/docs.go ##@ Install (Dev) - -.PHONY: install_linux_mock -install_linux_mock: ## Install ksctl - @echo "Started to Install ksctl" - cd scripts && \ - env GOOS=${GOOS_LINUX} GOARCH=${GOARCH_LINUX} ./builder-mock.sh - -.PHONY: install_macos_mock -install_macos_mock: ## Install ksctl on macos m1,m2,.. - @echo "Started to Install ksctl" - cd scripts && \ - env GOOS=${GOOS_MACOS} GOARCH=${GOARCH_MACOS} ./builder-mock.sh - -.PHONY: install_macos_intel_mock -install_macos_intel_mock: ## Install ksctl on macos intel - @echo "Started to Install ksctl" - cd scripts && \ - env GOOS=${GOOS_MACOS} GOARCH=${GOARCH_MACOS_INTEL} ./builder-mock.sh - .PHONY: install_linux install_linux: ## Install ksctl @echo "Started to Install ksctl" diff --git a/README.md b/README.md index a96b99e..f03c193 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ It utilizes [Ksctl](https://github.com/ksctl/ksctl) and builds on top to provide [![Go Report Card](https://goreportcard.com/badge/github.com/ksctl/cli)](https://goreportcard.com/report/github.com/ksctl/cli) [![](https://pkg.go.dev/badge/github.com/ksctl/cli.svg)](https://pkg.go.dev/github.com/ksctl/cli) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/7469/badge)](https://www.bestpractices.dev/projects/7469) -![](https://img.shields.io/github/license/ksctl/cli?style=for-the-badge) ![](https://img.shields.io/github/issues/ksctl/cli?style=for-the-badge) ![](https://img.shields.io/github/forks/ksctl/cli?style=for-the-badge) +![](https://img.shields.io/github/license/ksctl/cli?style=for-the-badge) ![](https://img.shields.io/github/issues/ksctl/cli?style=for-the-badge) ![](https://img.shields.io/github/forks/ksctl/cli?style=for-the-badge) ## All Repositories under (Ksctl Org) diff --git a/cli/cmd/addNodesHAAws.go b/cli/cmd/addNodesHAAws.go deleted file mode 100644 index 59778bb..0000000 --- a/cli/cmd/addNodesHAAws.go +++ /dev/null @@ -1,73 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/spf13/cobra" - - "github.com/ksctl/ksctl/pkg/helpers/consts" -) - -var addMoreWorkerNodesHAAws = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Example: ` -ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --nodeSizeWP t2.medium # Here the noWP is the desired count of workernodes - `, - Use: "add-nodes", - Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Aws", - Long: "It is used to add nodes to worker nodes in cluster with the given name from user.", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - - SetDefaults(consts.CloudAws, consts.ClusterTypeHa) - - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.WorkerPlaneNodeType = nodeSizeWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.IsHA = true - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("createApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.AddWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale up", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale up successful") - }, -} - -func init() { - createClusterHAAws.AddCommand(addMoreWorkerNodesHAAws) - clusterNameFlag(addMoreWorkerNodesHAAws) - noOfWPFlag(addMoreWorkerNodesHAAws) - nodeSizeWPFlag(addMoreWorkerNodesHAAws) - regionFlag(addMoreWorkerNodesHAAws) - storageFlag(addMoreWorkerNodesHAAws) - - addMoreWorkerNodesHAAws.MarkFlagRequired("name") - addMoreWorkerNodesHAAws.MarkFlagRequired("region") -} diff --git a/cli/cmd/addNodesHAAzure.go b/cli/cmd/addNodesHAAzure.go deleted file mode 100644 index 5df15d3..0000000 --- a/cli/cmd/addNodesHAAzure.go +++ /dev/null @@ -1,73 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/spf13/cobra" - - "github.com/ksctl/ksctl/pkg/helpers/consts" -) - -var addMoreWorkerNodesHAAzure = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Example: ` -ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --nodeSizeWP Standard_F2s # Here the noWP is the desired count of workernodes - `, - Use: "add-nodes", - Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Azure", - Long: "It is used to add nodes to worker nodes in cluster with the given name from user", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - - SetDefaults(consts.CloudAzure, consts.ClusterTypeHa) - - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.WorkerPlaneNodeType = nodeSizeWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.IsHA = true - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("createApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.AddWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale up", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale up successful") - }, -} - -func init() { - createClusterHAAzure.AddCommand(addMoreWorkerNodesHAAzure) - clusterNameFlag(addMoreWorkerNodesHAAzure) - noOfWPFlag(addMoreWorkerNodesHAAzure) - nodeSizeWPFlag(addMoreWorkerNodesHAAzure) - regionFlag(addMoreWorkerNodesHAAzure) - storageFlag(addMoreWorkerNodesHAAzure) - - addMoreWorkerNodesHAAzure.MarkFlagRequired("name") - addMoreWorkerNodesHAAzure.MarkFlagRequired("region") -} diff --git a/cli/cmd/addNodesHACivo.go b/cli/cmd/addNodesHACivo.go deleted file mode 100644 index d56abb8..0000000 --- a/cli/cmd/addNodesHACivo.go +++ /dev/null @@ -1,73 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var addMoreWorkerNodesHACivo = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Example: ` -ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSizeWP g3.medium # Here the noWP is the desired count of workernodes - `, - Use: "add-nodes", - Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Civo", - Long: "It is used to add nodes to worker nodes in cluster with the given name from user.", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - - SetDefaults(consts.CloudCivo, consts.ClusterTypeHa) - - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.WorkerPlaneNodeType = nodeSizeWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.IsHA = true - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("createApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.AddWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale up", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale up successful") - }, -} - -func init() { - createClusterHACivo.AddCommand(addMoreWorkerNodesHACivo) - clusterNameFlag(addMoreWorkerNodesHACivo) - noOfWPFlag(addMoreWorkerNodesHACivo) - nodeSizeWPFlag(addMoreWorkerNodesHACivo) - regionFlag(addMoreWorkerNodesHACivo) - storageFlag(addMoreWorkerNodesHACivo) - - addMoreWorkerNodesHACivo.MarkFlagRequired("name") - addMoreWorkerNodesHACivo.MarkFlagRequired("region") -} diff --git a/cli/cmd/createCluster.go b/cli/cmd/createCluster.go deleted file mode 100644 index cff4c30..0000000 --- a/cli/cmd/createCluster.go +++ /dev/null @@ -1,183 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" - "github.com/spf13/cobra" -) - -var createClusterCmd = &cobra.Command{ - Use: "create-cluster", - Example: ` -ksctl create --help - `, - Short: "Use to create a cluster", - Aliases: []string{"create"}, - Long: LongMessage("It is used to create cluster with the given name from user"), -} - -var createClusterAzure = &cobra.Command{ - Use: "azure", - Example: ` -ksctl create-cluster azure -n demo -r eastus -s store-local --nodeSizeMP Standard_DS2_v2 --noMP 3 -`, - Short: "Use to create a AKS cluster in Azure", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - - SetDefaults(consts.CloudAzure, consts.ClusterTypeMang) - - createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterAws = &cobra.Command{ - Use: "aws", - Example: ` -ksctl create-cluster aws -n demo -r ap-south-1 -s store-local --nodeSizeMP t2.micro --noMP 3 -`, - Short: "Use to create a EKS cluster in Aws", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - - SetDefaults(consts.CloudAws, consts.ClusterTypeMang) - - createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterCivo = &cobra.Command{ - Use: "civo", - Example: ` -ksctl create-cluster civo --name demo --region LON1 --storage store-local --nodeSizeMP g4s.kube.small --noMP 3 -`, - Short: "Use to create a Civo managed k3s cluster", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - - SetDefaults(consts.CloudCivo, consts.ClusterTypeMang) - - createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterLocal = &cobra.Command{ - Use: "local", - Example: ` -ksctl create-cluster local --name demo --storage store-local --noMP 3 -`, - Short: "Use to create a kind cluster", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudLocal - - SetDefaults(consts.CloudLocal, consts.ClusterTypeMang) - - createManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterHAAws = &cobra.Command{ - Use: "ha-aws", - Example: ` -ksctl create-cluster ha-aws -n demo -r us-east-1 --bootstrap k3s -s store-local --nodeSizeCP t2.medium --nodeSizeWP t2.medium --nodeSizeLB t2.micro --nodeSizeDS t2.small --noWP 1 --noCP 3 --noDS 3 --cni cilium@v1.16.1 -`, - Short: "Use to create a self-managed Highly Available cluster on AWS", - Long: LongMessage("It is used to create cluster with the given name from user."), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - - SetDefaults(consts.CloudAws, consts.ClusterTypeHa) - - createHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterHACivo = &cobra.Command{ - Use: "ha-civo", - Example: ` -ksctl create-cluster ha-civo --name demo --region LON1 --bootstrap k3s --storage store-local --nodeSizeCP g3.small --nodeSizeWP g3.medium --nodeSizeLB g3.small --nodeSizeDS g3.small --noWP 1 --noCP 3 --noDS 3 -ksctl create-cluster ha-civo --name demo --region LON1 --bootstrap kubeadm --storage store-local --nodeSizeCP g3.medium --nodeSizeWP g3.large --nodeSizeLB g3.small --nodeSizeDS g3.small --noWP 1 --noCP 3 --noDS 3 --cni cilium@v1.16.1 -`, - Short: "Use to create a self-managed Highly Available cluster on Civo", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - - SetDefaults(consts.CloudCivo, consts.ClusterTypeHa) - - createHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var createClusterHAAzure = &cobra.Command{ - Use: "ha-azure", - Example: ` -ksctl create-cluster ha-azure --name demo --region eastus --bootstrap k3s --storage store-local --nodeSizeCP Standard_F2s --nodeSizeWP Standard_F2s --nodeSizeLB Standard_F2s --nodeSizeDS Standard_F2s --noWP 1 --noCP 3 --noDS 3 -ksctl create-cluster ha-azure --name demo --region eastus --bootstrap kubeadm --storage store-local --nodeSizeCP Standard_F2s --nodeSizeWP Standard_F4s --nodeSizeLB Standard_F2s --nodeSizeDS Standard_F2s --noWP 1 --noCP 3 --noDS 3 --cni cilium@v1.16.1 -`, - Short: "Use to create a self-managed Highly-Available cluster on Azure", - Long: LongMessage("It is used to create cluster with the given name from user"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - - SetDefaults(consts.CloudAzure, consts.ClusterTypeHa) - - createHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -func init() { - RootCmd.AddCommand(createClusterCmd) - - createClusterCmd.AddCommand(createClusterAzure) - createClusterCmd.AddCommand(createClusterCivo) - createClusterCmd.AddCommand(createClusterLocal) - createClusterCmd.AddCommand(createClusterHACivo) - createClusterCmd.AddCommand(createClusterHAAzure) - createClusterCmd.AddCommand(createClusterHAAws) - createClusterCmd.AddCommand(createClusterAws) - - createClusterAzure.MarkFlagRequired("name") - createClusterAws.MarkFlagRequired("name") - createClusterCivo.MarkFlagRequired("name") - createClusterCivo.MarkFlagRequired("region") - createClusterLocal.MarkFlagRequired("name") - createClusterHAAzure.MarkFlagRequired("name") - createClusterHACivo.MarkFlagRequired("name") - createClusterHAAws.MarkFlagRequired("name") -} diff --git a/cli/cmd/credentials.go b/cli/cmd/credentials.go deleted file mode 100644 index 5e9ec59..0000000 --- a/cli/cmd/credentials.go +++ /dev/null @@ -1,70 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - "github.com/pterm/pterm" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var credCmd = &cobra.Command{ - Use: "cred", - Short: "Login to your Cloud-provider Credentials", - Long: LongMessage("login to your cloud provider credentials"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - cloudMap := map[string]int{ - "Amazon Web Services": 1, - "Azure": 2, - "Civo": 3, - } - var options []string - for k := range cloudMap { - options = append(options, k) - } - log.Print(ctx, "Select the cloud provider") - - selectedOption, _ := pterm.DefaultInteractiveSelect.WithOptions(options).Show() - - if provider, ok := cloud[cloudMap[selectedOption]]; ok { - cli.Client.Metadata.Provider = consts.KsctlCloud(provider) - } else { - log.Error("invalid provider") - } - m, err := controllers.NewManagerClusterKsctl( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to initialize", "Reason", err) - os.Exit(1) - } - - if err := m.Credentials(); err != nil { - log.Error("Failed to added the credential", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Credentials added successfully") - }, -} - -func init() { - RootCmd.AddCommand(credCmd) - storageFlag(credCmd) - - credCmd.Flags().BoolP("verbose", "v", true, "for verbose output") - -} diff --git a/cli/cmd/deleteCluster.go b/cli/cmd/deleteCluster.go deleted file mode 100644 index e7788bc..0000000 --- a/cli/cmd/deleteCluster.go +++ /dev/null @@ -1,184 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" - "github.com/spf13/cobra" -) - -var deleteClusterCmd = &cobra.Command{ - Use: "delete-cluster", - Example: ` -ksctl delete --help - `, - Short: "Use to delete a cluster", - Aliases: []string{"delete"}, - Long: LongMessage("It is used to delete cluster of given provider"), -} - -var deleteClusterLocal = &cobra.Command{ - Use: "local", - Example: ` -ksctl delete local --name demo --storage store-local -`, - Short: "Use to delete a kind cluster", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudLocal - - SetDefaults(consts.CloudLocal, consts.ClusterTypeMang) - - deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterAzure = &cobra.Command{ - Use: "azure", - Example: ` -ksctl delete azure --name demo --region eastus --storage store-local -`, - Short: "Use to deletes a AKS cluster", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - - SetDefaults(consts.CloudAzure, consts.ClusterTypeMang) - - deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterAws = &cobra.Command{ - Use: "aws", - Example: ` -ksctl delete aws --name demo --region ap-south-1 --storage store-local -`, - Short: "Use to deletes a EKS cluster", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - - SetDefaults(consts.CloudAws, consts.ClusterTypeMang) - - deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterCivo = &cobra.Command{ - Use: "civo", - Example: ` -ksctl delete civo --name demo --region LON1 --storage store-local -`, - Short: "Use to delete a Civo managed k3s cluster", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - - SetDefaults(consts.CloudCivo, consts.ClusterTypeMang) - - deleteManaged(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterHAAws = &cobra.Command{ - Use: "ha-aws", - Example: ` -ksctl delete ha-aws --name demo --region us-east-1 --storage store-local -`, - Short: "Use to delete a self-managed Highly Available cluster on AWS", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - - SetDefaults(consts.CloudAws, consts.ClusterTypeHa) - - deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterHAAzure = &cobra.Command{ - Use: "ha-azure", - Example: ` -ksctl delete ha-azure --name demo --region eastus --storage store-local -`, - Short: "Use to delete a self-managed Highly Available cluster on Azure", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - - SetDefaults(consts.CloudAzure, consts.ClusterTypeHa) - - deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -var deleteClusterHACivo = &cobra.Command{ - Use: "ha-civo", - Example: ` -ksctl delete ha-civo --name demo --region LON1 --storage store-local -`, - Short: "Use to delete a self-managed Highly Available cluster on Civo", - Long: LongMessage("It is used to delete cluster of given provider"), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - - SetDefaults(consts.CloudCivo, consts.ClusterTypeHa) - - deleteHA(ctx, log, cmd.Flags().Lookup("yes").Changed) - }, -} - -func init() { - RootCmd.AddCommand(deleteClusterCmd) - - deleteClusterCmd.AddCommand(deleteClusterHACivo) - deleteClusterCmd.AddCommand(deleteClusterCivo) - deleteClusterCmd.AddCommand(deleteClusterHAAzure) - deleteClusterCmd.AddCommand(deleteClusterAzure) - deleteClusterCmd.AddCommand(deleteClusterLocal) - deleteClusterCmd.AddCommand(deleteClusterHAAws) - deleteClusterCmd.AddCommand(deleteClusterAws) - - deleteClusterAws.MarkFlagRequired("name") - deleteClusterAws.MarkFlagRequired("region") - deleteClusterAzure.MarkFlagRequired("name") - deleteClusterAzure.MarkFlagRequired("region") - deleteClusterCivo.MarkFlagRequired("name") - deleteClusterCivo.MarkFlagRequired("region") - deleteClusterHAAzure.MarkFlagRequired("name") - deleteClusterHAAzure.MarkFlagRequired("region") - deleteClusterHACivo.MarkFlagRequired("name") - deleteClusterLocal.MarkFlagRequired("name") - deleteClusterHAAws.MarkFlagRequired("name") -} diff --git a/cli/cmd/deleteNodesHAAws.go b/cli/cmd/deleteNodesHAAws.go deleted file mode 100644 index f66b573..0000000 --- a/cli/cmd/deleteNodesHAAws.go +++ /dev/null @@ -1,71 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var deleteNodesHAAws = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Use: "del-nodes", - Example: ` -ksctl delete ha-aws del-nodes -n demo -r us-east-1 -s store-local --noWP 1 # Here the noWP is the desired count of workernodes - `, - Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Aws", - Long: "It is used to delete cluster with the given name from user", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAws - cli.Client.Metadata.IsHA = true - - SetDefaults(consts.CloudAws, consts.ClusterTypeHa) - - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("deleteApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.DelWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale down", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale down successful") - }, -} - -func init() { - deleteClusterHAAws.AddCommand(deleteNodesHAAws) - - clusterNameFlag(deleteNodesHAAws) - noOfWPFlag(deleteNodesHAAws) - regionFlag(deleteNodesHAAws) - storageFlag(deleteNodesHAAws) - - deleteNodesHAAws.MarkFlagRequired("name") - deleteNodesHAAws.MarkFlagRequired("region") -} diff --git a/cli/cmd/deleteNodesHAAzure.go b/cli/cmd/deleteNodesHAAzure.go deleted file mode 100644 index e164fb0..0000000 --- a/cli/cmd/deleteNodesHAAzure.go +++ /dev/null @@ -1,71 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var deleteNodesHAAzure = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Use: "del-nodes", - Example: ` -ksctl delete ha-azure del-nodes -n demo -r eastus -s store-local --noWP 1 # Here the noWP is the desired count of workernodes - `, - Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Azure", - Long: "It is used to delete cluster with the given name from user", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudAzure - cli.Client.Metadata.IsHA = true - - SetDefaults(consts.CloudAzure, consts.ClusterTypeHa) - - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("deleteApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.DelWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale down", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale down successful") - }, -} - -func init() { - deleteClusterHAAzure.AddCommand(deleteNodesHAAzure) - - clusterNameFlag(deleteNodesHAAzure) - noOfWPFlag(deleteNodesHAAzure) - regionFlag(deleteNodesHAAzure) - storageFlag(deleteNodesHAAzure) - - deleteNodesHAAzure.MarkFlagRequired("name") - deleteNodesHAAzure.MarkFlagRequired("region") -} diff --git a/cli/cmd/deleteNodesHACivo.go b/cli/cmd/deleteNodesHACivo.go deleted file mode 100644 index 18d026d..0000000 --- a/cli/cmd/deleteNodesHACivo.go +++ /dev/null @@ -1,69 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var deleteNodesHACivo = &cobra.Command{ - //Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"), - Use: "del-nodes", - Example: ` -ksctl delete ha-civo del-nodes -n demo -r LON1 -s store-local --noWP 1 # Here the noWP is the desired count of workernodes - `, - Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Civo", - Long: "It is used to delete cluster with the given name from user", - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.Provider = consts.CloudCivo - cli.Client.Metadata.IsHA = true - SetDefaults(consts.CloudCivo, consts.ClusterTypeHa) - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := deleteApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil { - log.Error("deleteApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to init manager", "Reason", err) - os.Exit(1) - } - - err = m.DelWorkerPlaneNodes() - if err != nil { - log.Error("Failed to scale down", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Scale down successful") - }, -} - -func init() { - deleteClusterHACivo.AddCommand(deleteNodesHACivo) - - clusterNameFlag(deleteNodesHACivo) - noOfWPFlag(deleteNodesHACivo) - regionFlag(deleteNodesHACivo) - storageFlag(deleteNodesHACivo) - - deleteNodesHACivo.MarkFlagRequired("name") - deleteNodesHACivo.MarkFlagRequired("region") -} diff --git a/cli/cmd/featureFlags.go b/cli/cmd/featureFlags.go deleted file mode 100644 index 9422700..0000000 --- a/cli/cmd/featureFlags.go +++ /dev/null @@ -1,39 +0,0 @@ -package cmd - -import ( - "context" - "strings" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" - "github.com/spf13/cobra" -) - -const ( - ksctl_feature_auto_scale consts.KsctlSpecialFlags = "autoscale" -) - -func featureFlag(f *cobra.Command) { - f.Flags().StringP("feature-flags", "", "", `Experimental Features: Supported values with comma seperated: [autoscale]`) -} - -func SetRequiredFeatureFlags(ctx context.Context, log types.LoggerFactory, cmd *cobra.Command) { - rawFeatures, err := cmd.Flags().GetString("feature-flags") - if err != nil { - log.Error("Error in setting feature flags", "Reason", err) - return - } - features := strings.Split(rawFeatures, ",") - - for _, feature := range features { - - switch consts.KsctlSpecialFlags(feature) { - // case ksctl_feature_auto_scale: - // if err := os.Setenv(string(consts.KsctlFeatureFlagHaAutoscale), "true"); err != nil { - // log.Error("Unable to set the ha autoscale feature") - // } - default: - return - } - } -} diff --git a/cli/cmd/flags.go b/cli/cmd/flags.go deleted file mode 100644 index e1a9a31..0000000 --- a/cli/cmd/flags.go +++ /dev/null @@ -1,120 +0,0 @@ -package cmd - -import "github.com/spf13/cobra" - -func verboseFlags() { - msgVerbose := "for verbose output" - msgApproval := "approval to avoid showMsg" - - createClusterAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterAws.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterCivo.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterLocal.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterHACivo.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterHAAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - createClusterHAAws.Flags().IntP("verbose", "v", 0, msgVerbose) - - deleteClusterAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterCivo.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterHAAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterHACivo.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterHAAws.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterAws.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteClusterLocal.Flags().IntP("verbose", "v", 0, msgVerbose) - - addMoreWorkerNodesHAAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - addMoreWorkerNodesHACivo.Flags().IntP("verbose", "v", 0, msgVerbose) - addMoreWorkerNodesHAAws.Flags().IntP("verbose", "v", 0, msgVerbose) - - deleteNodesHAAzure.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteNodesHACivo.Flags().IntP("verbose", "v", 0, msgVerbose) - deleteNodesHAAws.Flags().IntP("verbose", "v", 0, msgVerbose) - - getClusterCmd.Flags().IntP("verbose", "v", 0, msgVerbose) - switchCluster.Flags().IntP("verbose", "v", 0, msgVerbose) - infoClusterCmd.Flags().IntP("verbose", "v", 0, msgVerbose) - - createClusterAzure.Flags().BoolP("yes", "y", true, msgApproval) - createClusterAws.Flags().BoolP("yes", "y", true, msgApproval) - createClusterCivo.Flags().BoolP("yes", "y", true, msgApproval) - createClusterLocal.Flags().BoolP("yes", "y", true, msgApproval) - createClusterHACivo.Flags().BoolP("yes", "y", true, msgApproval) - createClusterHAAzure.Flags().BoolP("yes", "y", true, msgApproval) - createClusterHAAws.Flags().BoolP("yes", "y", true, msgApproval) - - deleteClusterLocal.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterAzure.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterAws.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterCivo.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterHAAzure.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterHACivo.Flags().BoolP("yes", "y", true, msgApproval) - deleteClusterHAAws.Flags().BoolP("yes", "y", true, msgApproval) - - addMoreWorkerNodesHAAzure.Flags().BoolP("yes", "y", true, msgApproval) - addMoreWorkerNodesHACivo.Flags().BoolP("yes", "y", true, msgApproval) - addMoreWorkerNodesHAAws.Flags().BoolP("yes", "y", true, msgApproval) - - deleteNodesHAAzure.Flags().BoolP("yes", "y", true, msgApproval) - deleteNodesHACivo.Flags().BoolP("yes", "y", true, msgApproval) - deleteNodesHAAws.Flags().BoolP("yes", "y", true, msgApproval) -} - -func storageFlag(f *cobra.Command) { - f.Flags().StringVarP(&storage, "storage", "s", "", "storage provider") -} - -func clusterNameFlag(f *cobra.Command) { - f.Flags().StringVarP(&clusterName, "name", "n", "demo", "Cluster Name") // keep it same for all -} - -func nodeSizeManagedFlag(f *cobra.Command) { - f.Flags().StringVarP(&nodeSizeMP, "nodeSizeMP", "", "", "Node size of managed cluster nodes") -} - -func nodeSizeCPFlag(f *cobra.Command) { - f.Flags().StringVarP(&nodeSizeCP, "nodeSizeCP", "", "", "Node size of self-managed controlplane nodes") -} -func nodeSizeWPFlag(f *cobra.Command) { - f.Flags().StringVarP(&nodeSizeWP, "nodeSizeWP", "", "", "Node size of self-managed workerplane nodes") -} - -func nodeSizeDSFlag(f *cobra.Command) { - f.Flags().StringVarP(&nodeSizeDS, "nodeSizeDS", "", "", "Node size of self-managed datastore nodes") -} - -func nodeSizeLBFlag(f *cobra.Command) { - f.Flags().StringVarP(&nodeSizeLB, "nodeSizeLB", "", "", "Node size of self-managed loadbalancer node") -} - -func regionFlag(f *cobra.Command) { - f.Flags().StringVarP(®ion, "region", "r", "", "Region") -} - -func appsFlag(f *cobra.Command) { - f.Flags().StringVarP(&apps, "apps", "", "", "Pre-Installed Applications") -} - -func cniFlag(f *cobra.Command) { - f.Flags().StringVarP(&cni, "cni", "", "", "CNI") -} - -func distroFlag(f *cobra.Command) { - f.Flags().StringVarP(&distro, "bootstrap", "", "", "Kubernetes Bootstrap") -} - -func k8sVerFlag(f *cobra.Command) { - f.Flags().StringVarP(&k8sVer, "version", "", "", "Kubernetes Version") -} - -func noOfWPFlag(f *cobra.Command) { - f.Flags().IntVarP(&noWP, "noWP", "", -1, "Number of WorkerPlane Nodes") -} -func noOfCPFlag(f *cobra.Command) { - f.Flags().IntVarP(&noCP, "noCP", "", -1, "Number of ControlPlane Nodes") -} -func noOfMPFlag(f *cobra.Command) { - f.Flags().IntVarP(&noMP, "noMP", "", -1, "Number of Managed Nodes") -} -func noOfDSFlag(f *cobra.Command) { - f.Flags().IntVarP(&noDS, "noDS", "", -1, "Number of DataStore Nodes") -} diff --git a/cli/cmd/getCluster.go b/cli/cmd/getCluster.go deleted file mode 100644 index 0080895..0000000 --- a/cli/cmd/getCluster.go +++ /dev/null @@ -1,64 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - - "github.com/spf13/cobra" -) - -var getClusterCmd = &cobra.Command{ - Use: "get-clusters", - Aliases: []string{"get", "list"}, - Example: ` -ksctl get --provider all --storage store-local -`, - Short: "Use to get clusters", - Long: LongMessage(`It is used to view clusters. For example: - -ksctl get-clusters `), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - if len(provider) == 0 { - provider = "all" - } - SetRequiredFeatureFlags(ctx, log, cmd) - cli.Client.Metadata.Provider = consts.KsctlCloud(provider) - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - m, err := controllers.NewManagerClusterKsctl( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("failed to init", "Reason", err) - os.Exit(1) - } - - err = m.GetCluster() - if err != nil { - log.Error("Get cluster failed", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Get cluster successfull") - }, -} - -func init() { - RootCmd.AddCommand(getClusterCmd) - storageFlag(getClusterCmd) - - getClusterCmd.Flags().StringVarP(&provider, "provider", "p", "", "Provider") -} diff --git a/cli/cmd/infoCluster.go b/cli/cmd/infoCluster.go deleted file mode 100644 index 092c46f..0000000 --- a/cli/cmd/infoCluster.go +++ /dev/null @@ -1,94 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - - "github.com/spf13/cobra" -) - -var infoClusterCmd = &cobra.Command{ - Use: "info-cluster", - Aliases: []string{"info"}, - Example: ` -ksctl info --provider azure --name demo --region eastus --storage store-local -ksctl info -p ha-azure -n ha-demo-kubeadm -r eastus -s store-local --verbose -1 -`, - Short: "Use to info cluster", - Long: LongMessage(`It is used to detailed data for a given cluster`), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - SetRequiredFeatureFlags(ctx, log, cmd) - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - switch provider { - case string(consts.CloudLocal): - cli.Client.Metadata.Provider = consts.CloudLocal - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudCivo): - cli.Client.Metadata.Provider = consts.CloudCivo - cli.Client.Metadata.IsHA = true - - case string(consts.CloudCivo): - cli.Client.Metadata.Provider = consts.CloudCivo - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudAzure): - cli.Client.Metadata.Provider = consts.CloudAzure - cli.Client.Metadata.IsHA = true - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudAws): - cli.Client.Metadata.Provider = consts.CloudAws - cli.Client.Metadata.IsHA = true - - case string(consts.CloudAws): - cli.Client.Metadata.Provider = consts.CloudAws - - case string(consts.CloudAzure): - cli.Client.Metadata.Provider = consts.CloudAzure - default: - log.Error("invalid provider specified", "provider", provider) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterKsctl( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("failed to init", "Reason", err) - os.Exit(1) - } - - _, err = m.InfoCluster() - if err != nil { - log.Error("info cluster failed", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "info cluster successfull") - }, -} - -func init() { - RootCmd.AddCommand(infoClusterCmd) - storageFlag(infoClusterCmd) - clusterNameFlag(infoClusterCmd) - regionFlag(infoClusterCmd) - - infoClusterCmd.Flags().StringVarP(&provider, "provider", "p", "", "Provider") - infoClusterCmd.MarkFlagRequired("name") - infoClusterCmd.MarkFlagRequired("provider") -} diff --git a/cli/cmd/root.go b/cli/cmd/root.go deleted file mode 100644 index a15e46f..0000000 --- a/cli/cmd/root.go +++ /dev/null @@ -1,111 +0,0 @@ -package cmd - -import ( - "context" - "os" - "time" - - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/spf13/cobra" -) - -var ( - clusterName string - region string - noCP int - noWP int - noMP int - noDS int - nodeSizeMP string - nodeSizeCP string - nodeSizeWP string - nodeSizeLB string - nodeSizeDS string - apps string - cni string - provider string - accessMode string - storage string - distro string - k8sVer string - cloud map[int]string -) - -var ( - DisableHeaderBanner bool -) - -type CobraCmd struct { - ClusterName string - Region string - Client types.KsctlClient - Version string -} - -var ( - cli *CobraCmd - logCli types.LoggerFactory - ctx context.Context -) - -var RootCmd = &cobra.Command{ - Use: "ksctl", - Short: "CLI tool for managing multiple K8s clusters", - Long: LongMessage("CLI tool which can manage multiple K8s clusters from local clusters to cloud provider specific clusters."), -} - -func Execute() { - - ctx = context.WithValue( - context.Background(), - consts.KsctlModuleNameKey, - "cli", - ) - ctx = context.WithValue( - ctx, consts.KsctlContextUserID, "cli", - ) - if _, ok := os.LookupEnv("KSCTL_FAKE_FLAG_ENABLED"); ok { - ctx = context.WithValue( - ctx, - consts.KsctlTestFlagKey, - "true", - ) - } - - cli = new(CobraCmd) - logCli = logger.NewLogger(0, os.Stdout) - - cloud = map[int]string{ - 1: string(consts.CloudAws), - 2: string(consts.CloudAzure), - 3: string(consts.CloudCivo), - 4: string(consts.CloudLocal), - } - - timer := time.Now() - err := RootCmd.Execute() - defer logCli.Print(ctx, "Time Took", "time", time.Since(timer).String()) - - if err != nil { - logCli.Error("Initialization of cli failed", "Reason", err) - os.Exit(1) - } -} - -func init() { - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. - - // RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.Kubesimpctl.yaml)") - - // Cobra also supports local flags, which will only run - // when this action is called directly. - RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") - verboseFlags() - - argsFlags() -} diff --git a/cli/cmd/switchCluster.go b/cli/cmd/switchCluster.go deleted file mode 100644 index 6a26e5f..0000000 --- a/cli/cmd/switchCluster.go +++ /dev/null @@ -1,189 +0,0 @@ -package cmd - -import ( - "fmt" - "github.com/creack/pty" - "golang.org/x/term" - "io" - "os" - "os/exec" - "os/signal" - "path/filepath" - "strings" - "syscall" - - "github.com/fatih/color" - "github.com/ksctl/cli/logger" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/types" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/spf13/cobra" -) - -var switchCluster = &cobra.Command{ - Use: "connect-cluster", - Example: ` -ksctl connect-context --provider civo --name --region -ksctl connect --provider civo --name --region -ksctl switch --provider civo --name --region -ksctl connect --provider civo --name --region -ksctl connect-context --provider local --name -ksctl connect-context --provider azure --name --region -ksctl connect-context --provider ha-civo --name --region -ksctl connect-context --provider ha-azure --name --region -ksctl connect-context --provider ha-aws --name --region -ksctl connect-context --provider aws --name --region - - For Storage specific - -ksctl connect-context -s store-local -p civo -n -r -ksctl connect-context -s external-store-mongodb -p civo -n -r -`, - Aliases: []string{"connect", "switch", "access"}, - Short: "Use to switch between clusters", - Long: LongMessage("It is used to switch cluster with the given ClusterName from user."), - Run: func(cmd *cobra.Command, args []string) { - verbosity, _ := cmd.Flags().GetInt("verbose") - var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout) - - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - SetRequiredFeatureFlags(ctx, log, cmd) - - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - switch provider { - case string(consts.CloudLocal): - cli.Client.Metadata.Provider = consts.CloudLocal - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudCivo): - cli.Client.Metadata.Provider = consts.CloudCivo - cli.Client.Metadata.IsHA = true - - case string(consts.CloudCivo): - cli.Client.Metadata.Provider = consts.CloudCivo - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudAzure): - cli.Client.Metadata.Provider = consts.CloudAzure - cli.Client.Metadata.IsHA = true - - case string(consts.ClusterTypeHa) + "-" + string(consts.CloudAws): - cli.Client.Metadata.Provider = consts.CloudAws - cli.Client.Metadata.IsHA = true - - case string(consts.CloudAws): - cli.Client.Metadata.Provider = consts.CloudAws - - case string(consts.CloudAzure): - cli.Client.Metadata.Provider = consts.CloudAzure - } - - m, err := controllers.NewManagerClusterKsctl( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("failed to init", "Reason", err) - os.Exit(1) - } - kubeconfig, err := m.SwitchCluster() - if err != nil { - log.Error("Switch cluster failed", "Reason", err) - os.Exit(1) - } - log.Debug(ctx, "kubeconfig output as string", "kubeconfig", kubeconfig) - log.Success(ctx, "Switch cluster Successful") - - if accessMode == "k9s" { - K9sAccess(log) - } else if accessMode == "shell" { - shellAccess(log) - } else { - log.Print(ctx, "No mode selected") - } - }, -} - -func shellAccess(log types.LoggerFactory) { - home, err := os.UserHomeDir() - if err != nil { - log.Error("Failed to get home dir", "Reason", err) - os.Exit(1) - } - - home = filepath.Join(home, ".ksctl", "kubeconfig") - cmd := exec.Command("/bin/bash") - - cmd.Env = append(os.Environ(), "KUBECONFIG="+home) - - ptmx, err := pty.Start(cmd) - if err != nil { - fmt.Println("Error creating pseudo-terminal:", err) - return - } - defer func() { _ = ptmx.Close() }() - - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGWINCH) - go func() { - for range ch { - if err := pty.InheritSize(os.Stdin, ptmx); err != nil { - fmt.Println("Error resizing pty:", err) - } - } - }() - ch <- syscall.SIGWINCH - - oldState, err := term.MakeRaw(int(os.Stdin.Fd())) - if err != nil { - fmt.Println("Error setting raw mode:", err) - return - } - defer func() { _ = term.Restore(int(os.Stdin.Fd()), oldState) }() - - fmt.Fprintln(ptmx, "echo Hi from Ksctl team! You are now in the shell session having cluster context.") - fmt.Fprintln(ptmx, "kubectl get nodes -owide") - - go func() { _, _ = io.Copy(ptmx, os.Stdin) }() - _, _ = io.Copy(os.Stdout, ptmx) -} - -func K9sAccess(log types.LoggerFactory) { - home, err := os.UserHomeDir() - if err != nil { - log.Error("Failed to get home dir", "Reason", err) - os.Exit(1) - } - home = filepath.Join(home, ".ksctl", "kubeconfig") - _cmd := exec.Command("k9s", "--kubeconfig", home) - - _bout := new(strings.Builder) - _berr := new(strings.Builder) - _cmd.Stdout = _bout - _cmd.Stderr = _berr - - if err := _cmd.Run(); err != nil { - log.Error("Failed to run k9s", "Reason", err) - } - _stdout, _stderr := _bout.String(), _berr.String() - fmt.Println(color.HiBlueString(_stdout)) - fmt.Println(color.HiRedString(_stderr)) -} - -func init() { - RootCmd.AddCommand(switchCluster) - clusterNameFlag(switchCluster) - regionFlag(switchCluster) - storageFlag(switchCluster) - - switchCluster.Flags().StringVarP(&provider, "provider", "p", "", "Provider") - switchCluster.Flags().StringVarP(&accessMode, "mode", "m", "", "Mode of access can be shell or k9s or none") - - switchCluster.MarkFlagRequired("name") - switchCluster.MarkFlagRequired("provider") -} diff --git a/cli/cmd/upgrade.go b/cli/cmd/upgrade.go deleted file mode 100644 index 3319c44..0000000 --- a/cli/cmd/upgrade.go +++ /dev/null @@ -1,262 +0,0 @@ -package cmd - -import ( - "archive/tar" - "compress/gzip" - "crypto/sha256" - "encoding/hex" - "fmt" - "github.com/ksctl/ksctl/poller" - "github.com/rogpeppe/go-internal/semver" - "io" - "net/http" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - - "github.com/pterm/pterm" - - "github.com/spf13/cobra" -) - -func fetchLatestVersion() ([]string, error) { - - logCli.Print(ctx, "Fetching available versions") - - poller.InitSharedGithubReleasePoller() - return poller.GetSharedPoller().Get("ksctl", "cli") -} - -func filterToUpgradeableVersions(versions []string) []string { - var upgradeableVersions []string - for _, version := range versions { - if semver.Compare(version, Version) > 0 { - upgradeableVersions = append(upgradeableVersions, version) - } - } - return upgradeableVersions -} - -func downloadFile(url, localFilename string) error { - logCli.Print(ctx, "Downloading file", "url", url, "localFilename", localFilename) - - resp, err := http.Get(url) - if err != nil { - return err - } - defer resp.Body.Close() - - out, err := os.Create(localFilename) - if err != nil { - return err - } - defer out.Close() - - _, err = io.Copy(out, resp.Body) - return err -} -func verifyChecksum(filePath, checksumfileLoc string) (bool, error) { - logCli.Print(ctx, "Verifying checksum", "file", filePath, "checksumfile", checksumfileLoc) - - rawChecksum, err := os.ReadFile(checksumfileLoc) - if err != nil { - return false, err - } - checksums := strings.Split(string(rawChecksum), "\n") - - var expectedChecksum string = "LOL" - for _, line := range checksums { - if strings.Contains(line, filePath) { - expectedChecksum = strings.Fields(line)[0] - break - } - } - if expectedChecksum == "LOL" { - return false, logCli.NewError(ctx, "Checksum not found in checksum file") - } - - file, err := os.Open(filePath) - if err != nil { - return false, err - } - defer file.Close() - - hash := sha256.New() - if _, err := io.Copy(hash, file); err != nil { - return false, err - } - - calculatedChecksum := hex.EncodeToString(hash.Sum(nil)) - return calculatedChecksum == expectedChecksum, nil -} - -func getOsArch() (string, error) { - arch := runtime.GOARCH - - if arch != "amd64" && arch != "arm64" { - return "", logCli.NewError(ctx, "Unsupported architecture") - } - return arch, nil -} - -func getOs() (string, error) { - os := runtime.GOOS - - if os != "linux" && os != "darwin" { - return "", logCli.NewError(ctx, "Unsupported OS", "message", "will provide support for windows based OS soon") - } - return os, nil -} - -func update(version string) error { - osName, err := getOs() - if err != nil { - return err - } - archName, err := getOsArch() - if err != nil { - return err - } - - logCli.Print(ctx, "Delected System", "OS", osName, "Arch", archName) - downloadURLBase := fmt.Sprintf("https://github.com/ksctl/cli/releases/download/%s", version) - tarFile := fmt.Sprintf("ksctl-cli_%s_%s_%s.tar.gz", version[1:], osName, archName) - checksumFile := fmt.Sprintf("ksctl-cli_%s_checksums.txt", version[1:]) - - tarUri := fmt.Sprintf("%s/%s", downloadURLBase, tarFile) - checksumUri := fmt.Sprintf("%s/%s", downloadURLBase, checksumFile) - - defer func() { - logCli.Print(ctx, "Cleaning up") - if err := os.Remove(checksumFile); err != nil { - logCli.Error("Failed to remove checksum file", "error", err) - } - - if err := os.Remove(tarFile); err != nil { - logCli.Error("Failed to remove checksum file", "error", err) - } - }() - - if err := downloadFile(tarUri, tarFile); err != nil { - return err - } - - if err := downloadFile(checksumUri, checksumFile); err != nil { - return err - } - - match, err := verifyChecksum(tarFile, checksumFile) - if err != nil { - return logCli.NewError(ctx, "Failed to verify checksum", "error", err) - } - if !match { - return logCli.NewError(ctx, "Checksum verification failed") - } - logCli.Success(ctx, "Checksum verification successful") - - tempDir, err := os.MkdirTemp("", "ksctl-update") - if err != nil { - return logCli.NewError(ctx, "Failed to create temp dir", "error", err) - } - file, err := os.Open(tarFile) - if err != nil { - return logCli.NewError(ctx, "Failed to open tar file", "error", err) - } - defer file.Close() - - gzr, err := gzip.NewReader(file) - if err != nil { - return logCli.NewError(ctx, "Failed to read gzip file", "error", err) - } - defer gzr.Close() - tr := tar.NewReader(gzr) - for { - header, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - return logCli.NewError(ctx, "Failed to read tar file", "error", err) - } - if header.Name == "ksctl" { - outFile, err := os.Create(filepath.Join(tempDir, "ksctl")) - if err != nil { - return logCli.NewError(ctx, "Failed to create ksctl binary", "error", err) - } - defer outFile.Close() - - if _, err := io.Copy(outFile, tr); err != nil { - return logCli.NewError(ctx, "Failed to copy ksctl binary", "error", err) - } - break - } - } - - logCli.Print(ctx, "Making ksctl executable...") - if err := os.Chmod(filepath.Join(tempDir, "ksctl"), 0550); err != nil { - return logCli.NewError(ctx, "Failed to make ksctl executable", "error", err) - } - - logCli.Print(ctx, "Moving ksctl to /usr/local/bin (requires sudo)...") - cmd := exec.Command("sudo", "mv", "-v", filepath.Join(tempDir, "ksctl"), "/usr/local/bin/ksctl") - err = cmd.Run() - if err != nil { - return logCli.NewError(ctx, "Failed to move ksctl to /usr/local/bin", "error", err) - } - - _, err = exec.LookPath("ksctl") - if err != nil { - return logCli.NewError(ctx, "Failed to find ksctl in PATH", "error", err) - } - - return nil -} - -var selfUpdate = &cobra.Command{ - Use: "self-update", - Short: "update the ksctl cli", - Long: LongMessage("to self-update ksctl cli"), - Run: func(cmd *cobra.Command, args []string) { - - if Version == "dev" { - logCli.Error("Cannot update dev version", "msg", "Please use a stable version to update") - os.Exit(1) - } - - logCli.Warn(ctx, "Currently no migrations are supported", "msg", "Please help us by creating a PR to support migrations. Thank you!") - - vers, err := fetchLatestVersion() - if err != nil { - logCli.Error("Failed to fetch latest version", "error", err) - os.Exit(1) - } - vers = filterToUpgradeableVersions(vers) - - if len(vers) == 0 { - logCli.Success(ctx, "You are already on the latest version", "version", Version) - os.Exit(0) - } - - logCli.Print(ctx, "Available versions to update") - selectedOption, _ := pterm.DefaultInteractiveSelect.WithOptions(vers).Show() - - newVer := selectedOption - - if err := update(newVer); err != nil { - logCli.Error("Failed to update ksctl cli", "error", err) - os.Exit(1) - } - - logCli.Success(ctx, "Updated Ksctl cli", "previousVer", Version, "newVer", newVer) - logCli.Note(ctx, "Please restart your terminal to use the updated version") - }, -} - -func init() { - RootCmd.AddCommand(selfUpdate) - storageFlag(selfUpdate) - - selfUpdate.Flags().BoolP("verbose", "v", true, "for verbose output") -} diff --git a/cli/cmd/utils.go b/cli/cmd/utils.go deleted file mode 100644 index 9faddd7..0000000 --- a/cli/cmd/utils.go +++ /dev/null @@ -1,616 +0,0 @@ -package cmd - -import ( - "context" - "encoding/json" - "fmt" - "os" - "strings" - - "github.com/fatih/color" - "github.com/ksctl/ksctl/pkg/controllers" - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" -) - -func newLogo() string { - x := strings.Split(logoKsctl, "\n") - - y := []string{} - - colorCode := map[int]func(str string) string{ - 0: func(str string) string { return color.New(color.BgHiMagenta).Add(color.FgHiBlack).SprintFunc()(str) }, - 1: func(str string) string { return color.New(color.BgHiBlue).Add(color.FgHiBlack).SprintFunc()(str) }, - 2: func(str string) string { return color.New(color.BgHiCyan).Add(color.FgHiBlack).SprintFunc()(str) }, - 3: func(str string) string { return color.New(color.BgHiGreen).Add(color.FgHiBlack).SprintFunc()(str) }, - 4: func(str string) string { return color.New(color.BgHiYellow).Add(color.FgHiBlack).SprintFunc()(str) }, - 5: func(str string) string { return color.New(color.BgHiRed).Add(color.FgHiBlack).SprintFunc()(str) }, - } - - for i, _x := range x { - if _y, ok := colorCode[i]; ok { - y = append(y, _y(_x)) - } - } - return strings.Join(y, "\n") -} - -func LongMessage(message string) string { - if !DisableHeaderBanner { - return "Ksctl ascii [logo]" - } - return fmt.Sprintf("%s\n\n%s", newLogo(), color.New(color.BgHiYellow).Add(color.FgBlack).SprintFunc()(message)) -} - -func createManaged(ctx context.Context, log types.LoggerFactory, approval bool) { - cli.Client.Metadata.ManagedNodeType = nodeSizeMP - cli.Client.Metadata.NoMP = noMP - - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro) - cli.Client.Metadata.K8sVersion = k8sVer - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - if len(cni) > 0 { - _cni := strings.Split(cni, "@") - cli.Client.Metadata.CNIPlugin = types.KsctlApp{ - StackName: _cni[0], - Overrides: map[string]map[string]any{ - _cni[0]: { - "version": func() string { - if len(_cni) != 2 { - return "latest" - } - return _cni[1] - }(), - }, - }, - } - } - if err := createApproval(ctx, log, approval); err != nil { - log.Error("createApproval", "Reason", err) - os.Exit(1) - } - m, err := controllers.NewManagerClusterManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to create self-managed HA cluster", "Reason", err) - os.Exit(1) - } - - err = m.CreateCluster() - if err != nil { - log.Error("Failed to create managed cluster", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Created the managed cluster successfully") -} - -func createHA(ctx context.Context, log types.LoggerFactory, approval bool) { - cli.Client.Metadata.IsHA = true - - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro) - cli.Client.Metadata.K8sVersion = k8sVer - cli.Client.Metadata.Region = region - - cli.Client.Metadata.NoCP = noCP - cli.Client.Metadata.NoWP = noWP - cli.Client.Metadata.NoDS = noDS - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - cli.Client.Metadata.LoadBalancerNodeType = nodeSizeLB - cli.Client.Metadata.ControlPlaneNodeType = nodeSizeCP - cli.Client.Metadata.WorkerPlaneNodeType = nodeSizeWP - cli.Client.Metadata.DataStoreNodeType = nodeSizeDS - - if len(cni) > 0 { - _cni := strings.Split(cni, "@") - cli.Client.Metadata.CNIPlugin = types.KsctlApp{ - StackName: _cni[0], - Overrides: map[string]map[string]any{ - _cni[0]: { - "version": func() string { - if len(_cni) != 2 { - return "latest" - } - return _cni[1] - }(), - }, - }, - } - } - - if err := createApproval(ctx, log, approval); err != nil { - log.Error("createApproval", "Reason", err) - os.Exit(1) - } - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to create self-managed HA cluster", "Reason", err) - os.Exit(1) - } - - err = m.CreateCluster() - if err != nil { - log.Error("Failed to create self-managed HA cluster", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Created the self-managed HA cluster successfully") -} - -func deleteManaged(ctx context.Context, log types.LoggerFactory, approval bool) { - - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro) - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := deleteApproval(ctx, log, approval); err != nil { - log.Error("deleteApproval", "Reason", err) - os.Exit(1) - } - - m, err := controllers.NewManagerClusterManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to create self-managed HA cluster", "Reason", err) - os.Exit(1) - } - err = m.DeleteCluster() - if err != nil { - log.Error("Failed to delete managed cluster", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Deleted the managed cluster successfully") -} - -func deleteHA(ctx context.Context, log types.LoggerFactory, approval bool) { - - cli.Client.Metadata.IsHA = true - - cli.Client.Metadata.ClusterName = clusterName - cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro) - cli.Client.Metadata.Region = region - cli.Client.Metadata.StateLocation = consts.KsctlStore(storage) - - if err := deleteApproval(ctx, log, approval); err != nil { - log.Error("deleteApproval", "Reason", err) - os.Exit(1) - } - m, err := controllers.NewManagerClusterSelfManaged( - ctx, - log, - &cli.Client, - ) - if err != nil { - log.Error("Failed to create self-managed HA cluster", "Reason", err) - os.Exit(1) - } - - err = m.DeleteCluster() - if err != nil { - log.Error("Failed to delete self-managed HA cluster", "Reason", err) - os.Exit(1) - } - log.Success(ctx, "Deleted the self-managed HA cluster successfully") -} - -func getRequestPayload() ([]byte, error) { - a, err := json.MarshalIndent(cli.Client.Metadata, "", " ") - if err != nil { - return nil, err - } - return a, nil -} - -func deleteApproval(ctx context.Context, log types.LoggerFactory, showMsg bool) error { - - a, err := getRequestPayload() - if err != nil { - return err - } - log.Box(ctx, "Input in Json", string(a)) - - if !showMsg { - log.Box(ctx, "Warning ๐Ÿšจ", "THIS IS A DESTRUCTIVE STEP MAKE SURE IF YOU WANT TO DELETE THE CLUSTER") - - log.Print(ctx, "Enter your choice to continue..[y/N]") - choice := "n" - unsafe := false - fmt.Scanf("%s", &choice) - if strings.Compare("y", choice) == 0 || - strings.Compare("yes", choice) == 0 || - strings.Compare("Y", choice) == 0 { - unsafe = true - } - - if !unsafe { - return log.NewError(ctx, "approval cancelled by user") - } - } - return nil -} - -func createApproval(ctx context.Context, log types.LoggerFactory, showMsg bool) error { - - a, err := getRequestPayload() - if err != nil { - return err - } - log.Box(ctx, "Input in Json", string(a)) - - if !showMsg { - log.Box(ctx, "Warning ๐Ÿšจ", "THIS IS A CREATION STEP MAKE SURE IF YOU WANT TO CREATE THE CLUSTER") - - log.Print(ctx, "Enter your choice to continue..[y/N]") - choice := "n" - unsafe := false - fmt.Scanf("%s", &choice) - if strings.Compare("y", choice) == 0 || - strings.Compare("yes", choice) == 0 || - strings.Compare("Y", choice) == 0 { - unsafe = true - } - - if !unsafe { - return log.NewError(ctx, "approval cancelled by user") - } - } - return nil -} - -func SetDefaults(provider consts.KsctlCloud, clusterType consts.KsctlClusterType) { - switch string(provider) + string(clusterType) { - case string(consts.CloudLocal) + string(consts.ClusterTypeMang): - if noMP == -1 { - noMP = 2 - } - if len(k8sVer) == 0 { - k8sVer = "1.30.0" - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudAzure) + string(consts.ClusterTypeMang): - if len(nodeSizeMP) == 0 { - nodeSizeMP = "Standard_DS2_v2" - } - if noMP == -1 { - noMP = 1 - } - if len(region) == 0 { - region = "eastus" - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudCivo) + string(consts.ClusterTypeMang): - if len(nodeSizeMP) == 0 { - nodeSizeMP = "g4s.kube.small" - } - if noMP == -1 { - noMP = 1 - } - if len(region) == 0 { - region = "LON1" - } - if len(k8sVer) == 0 { - k8sVer = "1.28.7" - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudAzure) + string(consts.ClusterTypeHa): - if len(nodeSizeCP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeCP = "Standard_F2s" - } else { - nodeSizeCP = "Standard_F2s" - } - } - if len(nodeSizeWP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeWP = "Standard_F4s" - } else { - nodeSizeWP = "Standard_F2s" - } - } - if len(nodeSizeDS) == 0 { - nodeSizeDS = "Standard_F2s" - } - if len(nodeSizeLB) == 0 { - nodeSizeLB = "Standard_F2s" - } - if len(region) == 0 { - region = "eastus" - } - if noWP == -1 { - if distro == string(consts.K8sKubeadm) { - noWP = 2 - } else { - noWP = 1 - } - } - if noCP == -1 { - noCP = 3 - } - if noDS == -1 { - noDS = 3 - } - if len(distro) == 0 { - distro = string(consts.K8sK3s) - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudAws) + string(consts.ClusterTypeMang): - if len(nodeSizeMP) == 0 { - nodeSizeMP = "t2.micro" - } - if noMP == -1 { - noMP = 2 - } - if len(region) == 0 { - region = "ap-south-1" - } - if len(k8sVer) == 0 { - k8sVer = "1.30" - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudAws) + string(consts.ClusterTypeHa): - if len(nodeSizeCP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeCP = "t2.medium" - } else { - nodeSizeCP = "t2.micro" - } - } - if len(nodeSizeWP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeWP = "t2.medium" - } else { - nodeSizeWP = "t2.micro" - } - } - if len(nodeSizeDS) == 0 { - nodeSizeDS = "t2.micro" - } - if len(nodeSizeLB) == 0 { - nodeSizeLB = "t2.micro" - } - if len(region) == 0 { - region = "us-east-1" - } - if noWP == -1 { - if distro == string(consts.K8sKubeadm) { - noWP = 2 - } else { - noWP = 1 - } - } - if noCP == -1 { - noCP = 3 - } - if noDS == -1 { - noDS = 3 - } - if len(distro) == 0 { - distro = string(consts.K8sK3s) - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - - case string(consts.CloudCivo) + string(consts.ClusterTypeHa): - if len(nodeSizeCP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeCP = "g3.large" - } else { - nodeSizeCP = "g3.medium" - } - } - if len(nodeSizeWP) == 0 { - if distro == string(consts.K8sKubeadm) { - nodeSizeWP = "g3.large" - } else { - nodeSizeWP = "g3.medium" - } - } - if len(nodeSizeDS) == 0 { - nodeSizeDS = "g3.small" - } - if len(nodeSizeLB) == 0 { - nodeSizeLB = "g3.small" - } - if len(region) == 0 { - region = "LON1s" - } - if noWP == -1 { - if distro == string(consts.K8sKubeadm) { - noWP = 2 - } else { - noWP = 1 - } - } - if noCP == -1 { - noCP = 3 - } - if noDS == -1 { - noDS = 3 - } - if len(storage) == 0 { - storage = string(consts.StoreLocal) - } - if len(distro) == 0 { - distro = string(consts.K8sK3s) - } - } -} - -func argsFlags() { - // Managed Azure - clusterNameFlag(createClusterAzure) - nodeSizeManagedFlag(createClusterAzure) - regionFlag(createClusterAzure) - noOfMPFlag(createClusterAzure) - k8sVerFlag(createClusterAzure) - distroFlag(createClusterAzure) - cniFlag(createClusterAzure) - storageFlag(createClusterAzure) - - // Managed Aws - clusterNameFlag(createClusterAws) - nodeSizeManagedFlag(createClusterAws) - regionFlag(createClusterAws) - noOfMPFlag(createClusterAws) - k8sVerFlag(createClusterAws) - distroFlag(createClusterAws) - cniFlag(createClusterAws) - storageFlag(createClusterAws) - - // Managed Civo - clusterNameFlag(createClusterCivo) - nodeSizeManagedFlag(createClusterCivo) - regionFlag(createClusterCivo) - cniFlag(createClusterCivo) - noOfMPFlag(createClusterCivo) - distroFlag(createClusterCivo) - k8sVerFlag(createClusterCivo) - storageFlag(createClusterCivo) - - // Managed Local - clusterNameFlag(createClusterLocal) - cniFlag(createClusterLocal) - noOfMPFlag(createClusterLocal) - distroFlag(createClusterLocal) - k8sVerFlag(createClusterLocal) - storageFlag(createClusterLocal) - - // HA Civo - clusterNameFlag(createClusterHACivo) - nodeSizeCPFlag(createClusterHACivo) - nodeSizeDSFlag(createClusterHACivo) - nodeSizeWPFlag(createClusterHACivo) - nodeSizeLBFlag(createClusterHACivo) - regionFlag(createClusterHACivo) - cniFlag(createClusterHACivo) - noOfWPFlag(createClusterHACivo) - noOfCPFlag(createClusterHACivo) - noOfDSFlag(createClusterHACivo) - distroFlag(createClusterHACivo) - k8sVerFlag(createClusterHACivo) - storageFlag(createClusterHACivo) - - // HA Aws - clusterNameFlag(createClusterHAAws) - nodeSizeCPFlag(createClusterHAAws) - nodeSizeDSFlag(createClusterHAAws) - nodeSizeWPFlag(createClusterHAAws) - nodeSizeLBFlag(createClusterHAAws) - regionFlag(createClusterHAAws) - cniFlag(createClusterHAAws) - noOfWPFlag(createClusterHAAws) - noOfCPFlag(createClusterHAAws) - noOfDSFlag(createClusterHAAws) - distroFlag(createClusterHAAws) - k8sVerFlag(createClusterHAAws) - storageFlag(createClusterHAAws) - - // HA Azure - clusterNameFlag(createClusterHAAzure) - nodeSizeCPFlag(createClusterHAAzure) - nodeSizeDSFlag(createClusterHAAzure) - nodeSizeWPFlag(createClusterHAAzure) - nodeSizeLBFlag(createClusterHAAzure) - regionFlag(createClusterHAAzure) - cniFlag(createClusterHAAzure) - noOfWPFlag(createClusterHAAzure) - noOfCPFlag(createClusterHAAzure) - noOfDSFlag(createClusterHAAzure) - distroFlag(createClusterHAAzure) - k8sVerFlag(createClusterHAAzure) - storageFlag(createClusterHAAzure) - - // Delete commands - // Managed Local - clusterNameFlag(deleteClusterLocal) - storageFlag(deleteClusterLocal) - - // managed Azure - clusterNameFlag(deleteClusterAzure) - regionFlag(deleteClusterAzure) - storageFlag(deleteClusterAzure) - - // managed Aws - clusterNameFlag(deleteClusterAws) - regionFlag(deleteClusterAws) - storageFlag(deleteClusterAws) - - // Managed Civo - clusterNameFlag(deleteClusterCivo) - regionFlag(deleteClusterCivo) - storageFlag(deleteClusterCivo) - - // HA Civo - clusterNameFlag(deleteClusterHAAws) - regionFlag(deleteClusterHAAws) - storageFlag(deleteClusterHAAws) - - // HA Aws - clusterNameFlag(deleteClusterHACivo) - regionFlag(deleteClusterHACivo) - storageFlag(deleteClusterHACivo) - - // HA Azure - clusterNameFlag(deleteClusterHAAzure) - regionFlag(deleteClusterHAAzure) - storageFlag(deleteClusterHAAzure) - - AllFeatures() -} - -func AllFeatures() { - - featureFlag(createClusterAzure) - featureFlag(createClusterHAAzure) - featureFlag(createClusterCivo) - featureFlag(createClusterHACivo) - featureFlag(createClusterLocal) - featureFlag(createClusterHAAws) - featureFlag(createClusterAws) - - featureFlag(deleteClusterAzure) - featureFlag(deleteClusterHAAzure) - featureFlag(deleteClusterCivo) - featureFlag(deleteClusterHACivo) - featureFlag(deleteClusterLocal) - featureFlag(deleteClusterHAAws) - - featureFlag(addMoreWorkerNodesHACivo) - featureFlag(addMoreWorkerNodesHAAzure) - - featureFlag(deleteNodesHAAzure) - featureFlag(deleteNodesHACivo) - - featureFlag(getClusterCmd) - featureFlag(switchCluster) - featureFlag(infoClusterCmd) -} diff --git a/cli/cmd/version.go b/cli/cmd/version.go deleted file mode 100644 index 25af9d9..0000000 --- a/cli/cmd/version.go +++ /dev/null @@ -1,41 +0,0 @@ -package cmd - -import ( - "fmt" - "github.com/ksctl/ksctl/commons" - - "github.com/fatih/color" - "github.com/spf13/cobra" -) - -const ( - logoKsctl = ` -โ–‘ โ–‘โ–‘โ–‘โ–‘ โ–‘โ–‘โ–‘ โ–‘โ–‘โ–‘โ–‘ โ–‘โ–‘โ–‘ โ–‘โ–‘ โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ -โ–’ โ–’โ–’โ–’ โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’ โ–’โ–’โ–’โ–’โ–’โ–’โ–’ -โ–“ โ–“โ–“โ–“โ–“โ–“โ–“ โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“โ–“โ–“ -โ–“ โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“ โ–“โ–“ โ–“โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“ โ–“โ–“โ–“โ–“โ–“โ–“โ–“ -โ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆ -` -) - -// change this using ldflags -var Version string = "dev" - -var BuildDate string - -// versionCmd represents the version command -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of ksctl", - Run: func(cmd *cobra.Command, args []string) { - - fmt.Println(newLogo()) - fmt.Printf("%s@%s\n", color.HiGreenString("ksctl:cli"), color.HiBlueString(Version)) - fmt.Printf("%s@%s\n", color.HiGreenString("ksctl:core"), color.HiBlueString(commons.GetOCIVersion())) - fmt.Println("BuildDate:", BuildDate) - }, -} - -func init() { - RootCmd.AddCommand(versionCmd) -} diff --git a/cli/main.go b/cli/main.go deleted file mode 100644 index b15203f..0000000 --- a/cli/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "github.com/ksctl/cli/cli/cmd" - -func main() { - cmd.Execute() -} diff --git a/cmd/cli.go b/cmd/cli.go new file mode 100644 index 0000000..2dc910d --- /dev/null +++ b/cmd/cli.go @@ -0,0 +1,82 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "os" + + "github.com/ksctl/cli/pkg/config" + cLogger "github.com/ksctl/cli/pkg/logger" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/logger" + "github.com/ksctl/ksctl/v2/pkg/provider" + "github.com/ksctl/ksctl/v2/pkg/storage" + "github.com/spf13/cobra" +) + +type KsctlCommand struct { + Ctx context.Context + CliLog logger.Logger + l logger.Logger + ksctlStorage storage.Storage + root *cobra.Command + verbose int + dryRun bool + KsctlConfig *config.Config + inMemInstanceTypesInReg map[string]provider.InstanceRegionOutput +} + +func New() (*KsctlCommand, error) { + k := new(KsctlCommand) + k.KsctlConfig = new(config.Config) + + k.Ctx = context.WithValue( + context.WithValue( + context.Background(), + consts.KsctlModuleNameKey, + "cli", + ), + consts.KsctlContextUserID, + "cli", + ) + + k.root = k.NewRootCmd() + + k.CliLog = cLogger.NewLogger(0, os.Stdout) + + return k, nil +} + +func (k *KsctlCommand) ForDocs() (*cobra.Command, error) { + if err := k.CommandMapping(); err != nil { + return nil, err + } + + return k.root, nil +} + +func (k *KsctlCommand) Execute() error { + + if err := config.LoadConfig(k.KsctlConfig); err != nil { + return err + } + + if err := k.CommandMapping(); err != nil { + return err + } + + return k.root.Execute() +} diff --git a/cmd/configure.go b/cmd/configure.go new file mode 100644 index 0000000..5ef7101 --- /dev/null +++ b/cmd/configure.go @@ -0,0 +1,245 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "encoding/json" + "os" + "strconv" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/cli/pkg/config" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/statefile" + "github.com/ksctl/ksctl/v2/pkg/utilities" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) Configure() *cobra.Command { + + cmd := &cobra.Command{ + Use: "configure", + + Short: "Configure ksctl cli", + Long: "It will help you to configure the ksctl cli", + } + + return cmd +} + +func (k *KsctlCommand) ConfigureStorage() *cobra.Command { + cmd := &cobra.Command{ + Use: "storage", + + Short: "Configure storage", + Long: "It will help you to configure the storage", + Run: func(cmd *cobra.Command, args []string) { + if ok := k.handleStorageConfig(); !ok { + os.Exit(1) + } + }, + } + + return cmd +} + +func (k *KsctlCommand) ConfigureCloud() *cobra.Command { + cmd := &cobra.Command{ + Use: "cloud", + + Short: "Configure cloud", + Long: "It will help you to configure the cloud", + Run: func(cmd *cobra.Command, args []string) { + if ok := k.handleCloudConfig(); !ok { + os.Exit(1) + } + }, + } + + return cmd +} + +func (k *KsctlCommand) handleStorageConfig() bool { + if v, err := cli.DropDown( + "What should be your default storageDriver?", + map[string]string{ + "MongoDb": string(consts.StoreExtMongo), + "Local": string(consts.StoreLocal), + }, + "Local", + ); err != nil { + k.l.Error("Failed to get the storageDriver", "Reason", err) + return false + } else { + k.KsctlConfig.PreferedStateStore = consts.KsctlStore(v) + errL := config.SaveConfig(k.KsctlConfig) + if errL != nil { + k.l.Error("Failed to save the configuration", "Reason", errL) + return false + } + + if consts.KsctlStore(v) == consts.StoreExtMongo { + k.l.Note(k.Ctx, "You need to provide the credentials for the MongoDB") + if err := k.storeMongoCredentials(); err != nil { + k.l.Error("Failed to store the MongoDB credentials", "Reason", err) + return false + } + } + } + return true +} + +func (k *KsctlCommand) handleCloudConfig() bool { + if v, err := cli.DropDown( + "Credentials", + map[string]string{ + "Amazon Web Services": string(consts.CloudAws), + "Azure": string(consts.CloudAzure), + }, + "", + ); err != nil { + k.l.Error("Failed to get the credentials", "Reason", err) + return false + } else { + switch consts.KsctlCloud(v) { + case consts.CloudAws: + if err := k.storeAwsCredentials(); err != nil { + k.l.Error("Failed to store the AWS credentials", "Reason", err) + return false + } + case consts.CloudAzure: + if err := k.storeAzureCredentials(); err != nil { + k.l.Error("Failed to store the Azure credentials", "Reason", err) + return false + } + } + } + + return true +} + +func (k *KsctlCommand) storeAwsCredentials() (err error) { + c := new(statefile.CredentialsAws) + c.AccessKeyId, err = cli.TextInputPassword("Enter your AWS Access Key ID") + if err != nil { + return err + } + c.SecretAccessKey, err = cli.TextInputPassword("Enter your AWS Secret Access Key") + if err != nil { + return err + } + + return config.SaveCloudCreds(c, consts.CloudAws) +} + +func (k *KsctlCommand) loadAwsCredentials() error { + c := new(statefile.CredentialsAws) + if err := config.LoadCloudCreds(c, consts.CloudAws); err != nil { + return err + } + v, err := json.Marshal(c) + if err != nil { + return err + } + k.Ctx = context.WithValue(k.Ctx, consts.KsctlAwsCredentials, v) + return nil +} + +func (k *KsctlCommand) storeAzureCredentials() (err error) { + c := new(statefile.CredentialsAzure) + c.SubscriptionID, err = cli.TextInputPassword("Enter your Azure Subscription ID") + if err != nil { + return err + } + + c.TenantID, err = cli.TextInputPassword("Enter your Azure Tenant ID") + if err != nil { + return err + } + + c.ClientID, err = cli.TextInputPassword("Enter your Azure Client ID") + if err != nil { + return err + } + c.ClientSecret, err = cli.TextInputPassword("Enter your Azure Client Secret") + if err != nil { + return err + } + + return config.SaveCloudCreds(c, consts.CloudAzure) +} + +func (k *KsctlCommand) loadAzureCredentials() error { + c := new(statefile.CredentialsAzure) + if err := config.LoadCloudCreds(c, consts.CloudAzure); err != nil { + return err + } + v, err := json.Marshal(c) + if err != nil { + return err + } + k.Ctx = context.WithValue(k.Ctx, consts.KsctlAzureCredentials, v) + return nil +} + +func (k *KsctlCommand) storeMongoCredentials() (err error) { + c := new(statefile.CredentialsMongodb) + srv, err := cli.Confirmation("Enter whether MongoDB has SRV record or not", "no") + if err != nil { + return err + } + c.SRV = srv + + c.Domain, err = cli.TextInput("Enter your MongoDB URI", "") + if err != nil { + return err + } + c.Username, err = cli.TextInputPassword("Enter your MongoDB Username") + if err != nil { + return err + } + c.Password, err = cli.TextInputPassword("Enter your MongoDB Password") + if err != nil { + return err + } + port := "" + if port, err = cli.TextInput("Enter your MongoDB Port", ""); err != nil { + return err + } + if len(port) != 0 { + v, err := strconv.Atoi(port) + if err != nil { + return err + } + c.Port = utilities.Ptr(v) + } + + return config.SaveStorageCreds(c, consts.StoreExtMongo) +} + +func (k *KsctlCommand) loadMongoCredentials() error { + c := new(statefile.CredentialsMongodb) + if err := config.LoadStorageCreds(c, consts.StoreExtMongo); err != nil { + return err + } + v, err := json.Marshal(c) + if err != nil { + return err + } + + k.Ctx = context.WithValue(k.Ctx, consts.KsctlMongodbCredentials, v) + return nil +} diff --git a/cmd/connect.go b/cmd/connect.go new file mode 100644 index 0000000..9917868 --- /dev/null +++ b/cmd/connect.go @@ -0,0 +1,256 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "fmt" + "io" + "os" + "os/exec" + "os/signal" + "path/filepath" + "strconv" + "strings" + "syscall" + + "github.com/creack/pty" + "github.com/fatih/color" + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/common" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + "github.com/ksctl/ksctl/v2/pkg/logger" + "github.com/spf13/cobra" + "golang.org/x/term" + "k8s.io/client-go/tools/clientcmd" + clientcmdapi "k8s.io/client-go/tools/clientcmd/api" +) + +func (k *KsctlCommand) Connect() *cobra.Command { + + cmd := &cobra.Command{ + Use: "connect", + Example: ` +ksctl connect --help + `, + Short: "Connect to existing cluster", + Long: "It is used to connect to existing cluster", + + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Error("No clusters found to delete") + os.Exit(1) + } + + selectDisplay := make(map[string]string, len(clusters)) + valueMaping := make(map[string]controller.Metadata, len(clusters)) + + for idx, cluster := range clusters { + selectDisplay[makeHumanReadableList(cluster)] = strconv.Itoa(idx) + valueMaping[strconv.Itoa(idx)] = controller.Metadata{ + ClusterName: cluster.Name, + ClusterType: cluster.ClusterType, + Provider: cluster.CloudProvider, + Region: cluster.Region, + StateLocation: k.KsctlConfig.PreferedStateStore, + K8sDistro: cluster.K8sDistro, + } + } + + selectedCluster, err := cli.DropDown( + "Select the cluster to delete", + selectDisplay, + "", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + m := valueMaping[selectedCluster] + + c, err := common.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + kubeconfig, err := c.Switch() + if err != nil { + k.l.Error("Failed to connect to the cluster", "Reason", err) + os.Exit(1) + } + + k.l.Note(k.Ctx, "Downloaded the kubeconfig") + + k.writeKubeconfig([]byte(*kubeconfig)) + + accessMode, err := cli.DropDown( + "Select the access mode", + map[string]string{ + "k9s": "k9s", + "bash": "shell", + "none": "none", + }, + "none", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + if accessMode == "k9s" { + K9sAccess(k.l) + } else if accessMode == "shell" { + shellAccess(k.l) + } else { + k.l.Box(k.Ctx, "Kubeconfig", "You can access the cluster using $ kubectl commands or any other k8s client as its saved to ~/.kube/config") + } + }, + } + + return cmd +} + +func shellAccess(log logger.Logger) { + home, err := os.UserHomeDir() + if err != nil { + log.Error("Failed to get home dir", "Reason", err) + os.Exit(1) + } + + home = filepath.Join(home, ".kube", "config") + cmd := exec.Command("/bin/bash") + + cmd.Env = append(os.Environ(), "KUBECONFIG="+home) + + ptmx, err := pty.Start(cmd) + if err != nil { + fmt.Println("Error creating pseudo-terminal:", err) + return + } + defer func() { _ = ptmx.Close() }() + + ch := make(chan os.Signal, 1) + signal.Notify(ch, syscall.SIGWINCH) + go func() { + for range ch { + if err := pty.InheritSize(os.Stdin, ptmx); err != nil { + fmt.Println("Error resizing pty:", err) + } + } + }() + ch <- syscall.SIGWINCH + + oldState, err := term.MakeRaw(int(os.Stdin.Fd())) + if err != nil { + fmt.Println("Error setting raw mode:", err) + return + } + defer func() { _ = term.Restore(int(os.Stdin.Fd()), oldState) }() + + fmt.Fprintln(ptmx, "echo Hi from Ksctl team! You are now in the shell session having cluster context.") + fmt.Fprintln(ptmx, "kubectl get nodes -owide && kubectl cluster-info") + + go func() { _, _ = io.Copy(ptmx, os.Stdin) }() + _, _ = io.Copy(os.Stdout, ptmx) +} + +func K9sAccess(log logger.Logger) { + // home = filepath.Join(home, ".ksctl", "kubeconfig") + // _cmd := exec.Command("k9s", "--kubeconfig", home) + _cmd := exec.Command("k9s") + + _bout := new(strings.Builder) + _berr := new(strings.Builder) + _cmd.Stdout = _bout + _cmd.Stderr = _berr + + if err := _cmd.Run(); err != nil { + log.Error("Failed to run k9s", "Reason", err) + } + _stdout, _stderr := _bout.String(), _berr.String() + fmt.Println(color.HiBlueString(_stdout)) + fmt.Println(color.HiRedString(_stderr)) +} + +func mergeKubeConfigs(configs ...*clientcmdapi.Config) *clientcmdapi.Config { + merged := clientcmdapi.NewConfig() + for _, cfg := range configs { + for name, cluster := range cfg.Clusters { + merged.Clusters[name] = cluster + } + for name, authInfo := range cfg.AuthInfos { + merged.AuthInfos[name] = authInfo + } + for name, context := range cfg.Contexts { + merged.Contexts[name] = context + } + if cfg.CurrentContext != "" { + merged.CurrentContext = cfg.CurrentContext + } + } + return merged +} + +func (k *KsctlCommand) writeKubeconfig(newKubeconfig []byte) { + home, err := os.UserHomeDir() + if err != nil { + k.l.Error("Failed to get the home directory", "Reason", err) + os.Exit(1) + } + orgConfig, err := os.ReadFile(filepath.Join(home, ".kube", "config")) + if err != nil { + k.l.Error("Failed to read the kubeconfig", "Reason", err) + os.Exit(1) + } + + config1, err := clientcmd.Load(orgConfig) + if err != nil { + k.l.Error("Failed to load the kubeconfig in ~/.kube/config", "Reason", err) + os.Exit(1) + } + config2, err := clientcmd.Load(newKubeconfig) + if err != nil { + k.l.Error("Failed to load the new kubeconfig", "Reason", err) + os.Exit(1) + } + + mergedConfig := mergeKubeConfigs(config1, config2) + + mergedConfig.CurrentContext = config2.CurrentContext + + mergedYAML, err := clientcmd.Write(*mergedConfig) + if err != nil { + k.l.Error("Failed to write the merged kubeconfig", "Reason", err) + os.Exit(1) + } + + if err := os.WriteFile(filepath.Join(home, ".kube", "config"), mergedYAML, 0640); err != nil { + k.l.Error("Failed to write the kubeconfig", "Reason", err) + os.Exit(1) + } +} diff --git a/cmd/create.go b/cmd/create.go new file mode 100644 index 0000000..283751f --- /dev/null +++ b/cmd/create.go @@ -0,0 +1,273 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "os" + + "github.com/ksctl/ksctl/v2/pkg/addons" + "github.com/ksctl/ksctl/v2/pkg/consts" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + + controllerManaged "github.com/ksctl/ksctl/v2/pkg/handler/cluster/managed" + controllerMeta "github.com/ksctl/ksctl/v2/pkg/handler/cluster/metadata" + controllerSelfManaged "github.com/ksctl/ksctl/v2/pkg/handler/cluster/selfmanaged" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) Create() *cobra.Command { + + cmd := &cobra.Command{ + Use: "create", + Example: ` +ksctl create --help + `, + Short: "Use to create a cluster", + Long: "It is used to create cluster with the given name from user", + + Run: func(cmd *cobra.Command, args []string) { + meta := controller.Metadata{} + + k.baseMetadataFields(&meta) + + if meta.ClusterType == consts.ClusterTypeMang { + k.metadataForManagedCluster(&meta) + } else { + k.metadataForSelfManagedCluster(&meta) + } + + k.l.Success(k.Ctx, "Created the cluster", "Name", meta.ClusterName) + }, + } + + return cmd +} + +func (k *KsctlCommand) metadataForSelfManagedCluster( + meta *controller.Metadata, +) { + metaClient, err := controllerMeta.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: *meta, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + k.handleRegionSelection(metaClient, meta) + + cp := k.handleInstanceTypeSelection(metaClient, meta, "Select instance_type for Control Plane") + wp := k.handleInstanceTypeSelection(metaClient, meta, "Select instance_type for Worker Nodes") + etcd := k.handleInstanceTypeSelection(metaClient, meta, "Select instance_type for Etcd Nodes") + lb := k.handleInstanceTypeSelection(metaClient, meta, "Select instance_type for Load Balancer") + + meta.ControlPlaneNodeType = cp.Sku + meta.WorkerPlaneNodeType = wp.Sku + meta.DataStoreNodeType = etcd.Sku + meta.LoadBalancerNodeType = lb.Sku + + if v, ok := k.getCounterValue("Enter the number of Control Plane Nodes", func(v int) bool { + return v >= 3 + }, 3); !ok { + k.l.Error("Failed to get the number of control plane nodes") + os.Exit(1) + } else { + meta.NoCP = v + } + + if v, ok := k.getCounterValue("Enter the number of Worker Nodes", func(v int) bool { + return v > 0 + }, 1); !ok { + k.l.Error("Failed to get the number of worker nodes") + os.Exit(1) + } else { + meta.NoWP = v + } + + if v, ok := k.getCounterValue("Enter the number of Etcd Nodes", func(v int) bool { + return v >= 3 + }, 3); !ok { + k.l.Error("Failed to get the number of etcd nodes") + os.Exit(1) + } else { + meta.NoDS = v + } + + bootstrapVers, err := metaClient.ListAllBootstrapVersions() + if err != nil { + k.l.Error("Failed to get the list of bootstrap versions", "Reason", err) + os.Exit(1) + } + if v, err := cli.DropDownList("Select the bootstrap version", bootstrapVers, bootstrapVers[0]); err != nil { + k.l.Error("Failed to get the bootstrap version", "Reason", err) + os.Exit(1) + } else { + k.l.Debug(k.Ctx, "Selected bootstrap version", "Version", v) + meta.K8sVersion = v + } + + etcdVers, err := metaClient.ListAllEtcdVersions() + if err != nil { + k.l.Error("Failed to get the list of etcd versions", "Reason", err) + os.Exit(1) + } + if v, err := cli.DropDownList("Select the etcd version", etcdVers, etcdVers[0]); err != nil { + k.l.Error("Failed to get the etcd version", "Reason", err) + os.Exit(1) + } else { + k.l.Debug(k.Ctx, "Selected etcd version", "Version", v) + meta.EtcdVersion = v + } + + _, err = metaClient.PriceCalculator( + controllerMeta.PriceCalculatorInput{ + Currency: cp.Price.Currency, + NoOfWorkerNodes: meta.NoWP, + NoOfControlPlaneNodes: meta.NoCP, + NoOfEtcdNodes: meta.NoDS, + ControlPlaneMachine: cp, + WorkerMachine: wp, + EtcdMachine: etcd, + LoadBalancerMachine: lb, + }) + if err != nil { + k.l.Error("Failed to calculate the price", "Reason", err) + os.Exit(1) + } + + k.metadataSummary(*meta) + + if ok, _ := cli.Confirmation("Do you want to proceed with the cluster creation", "no"); !ok { + os.Exit(1) + } + + c, err := controllerSelfManaged.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: *meta, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + if err := c.Create(); err != nil { + k.l.Error("Failed to create the cluster", "Reason", err) + os.Exit(1) + } + + return +} + +func (k *KsctlCommand) metadataForManagedCluster( + meta *controller.Metadata, +) { + metaClient, err := controllerMeta.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: *meta, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + if v, ok := k.getCounterValue("Enter the number of Managed Nodes", func(v int) bool { + return v > 0 + }, 1); !ok { + k.l.Error("Failed to get the number of managed nodes") + os.Exit(1) + } else { + meta.NoMP = v + } + + if meta.Provider != consts.CloudLocal { + k.handleRegionSelection(metaClient, meta) + vm := k.handleInstanceTypeSelection(metaClient, meta, "Select instance_type for Managed Nodes") + meta.ManagedNodeType = vm.Sku + + ss := cli.GetSpinner() + ss.Start("Fetching the managed cluster offerings") + + listOfOfferings, err := metaClient.ListAllManagedClusterManagementOfferings(meta.Region, nil) + if err != nil { + ss.Stop() + k.l.Error("Failed to sync the metadata", "Reason", err) + os.Exit(1) + } + ss.Stop() + + offeringSelected := "" + + if v, ok := k.getSelectedManagedClusterOffering("Select the managed cluster offering", listOfOfferings); !ok { + k.l.Error("Failed to get the managed cluster offering") + os.Exit(1) + } else { + offeringSelected = v + } + + _, err = metaClient.PriceCalculator( + controllerMeta.PriceCalculatorInput{ + ManagedControlPlaneMachine: listOfOfferings[offeringSelected], + NoOfWorkerNodes: meta.NoMP, + WorkerMachine: vm, + }) + if err != nil { + k.l.Error("Failed to calculate the price", "Reason", err) + os.Exit(1) + } + } + + k.handleManagedK8sVersion(metaClient, meta) + + k.metadataSummary(*meta) + + if ok, _ := cli.Confirmation("Do you want to proceed with the cluster creation", "no"); !ok { + os.Exit(1) + } + + c, err := controllerManaged.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: *meta, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + if err := c.Create(); err != nil { + k.l.Error("Failed to create the cluster", "Reason", err) + os.Exit(1) + } + + return +} + +func (k *KsctlCommand) processAddons() (_ addons.ClusterAddons, _ error) { + return nil, nil +} diff --git a/cmd/delete.go b/cmd/delete.go new file mode 100644 index 0000000..dd6cc3c --- /dev/null +++ b/cmd/delete.go @@ -0,0 +1,144 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "fmt" + "os" + "strconv" + "strings" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/managed" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/selfmanaged" + "github.com/ksctl/ksctl/v2/pkg/provider" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) Delete() *cobra.Command { + + cmd := &cobra.Command{ + Use: "delete", + Example: ` +ksctl delete --help + `, + Short: "Use to delete a cluster", + Long: "It is used to delete cluster with the given name from user", + + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Error("No clusters found to delete") + os.Exit(1) + } + + selectDisplay := make(map[string]string, len(clusters)) + valueMaping := make(map[string]controller.Metadata, len(clusters)) + + for idx, cluster := range clusters { + selectDisplay[makeHumanReadableList(cluster)] = strconv.Itoa(idx) + valueMaping[strconv.Itoa(idx)] = controller.Metadata{ + ClusterName: cluster.Name, + ClusterType: cluster.ClusterType, + Provider: cluster.CloudProvider, + Region: cluster.Region, + StateLocation: k.KsctlConfig.PreferedStateStore, + K8sDistro: cluster.K8sDistro, + } + } + + selectedCluster, err := cli.DropDown( + "Select the cluster to delete", + selectDisplay, + "", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + m := valueMaping[selectedCluster] + + if ok, _ := cli.Confirmation("Do you want to proceed with the cluster deletion", "no"); !ok { + os.Exit(1) + } + + if k.loadCloudProviderCreds(m.Provider) != nil { + os.Exit(1) + } + + if m.ClusterType == consts.ClusterTypeMang { + c, err := managed.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + if err := c.Delete(); err != nil { + k.l.Error("Failed to delete your managed cluster", "Reason", err) + os.Exit(1) + } + + } else { + c, err := selfmanaged.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("Failed to create the controller", "Reason", err) + os.Exit(1) + } + + if err := c.Delete(); err != nil { + k.l.Error("Failed to delete your selfmanaged cluster", "Reason", err) + os.Exit(1) + } + } + + k.l.Success(k.Ctx, "Deleted your cluster", "Name", m.ClusterName) + }, + } + + return cmd +} + +func makeHumanReadableList(m provider.ClusterData) string { + fields := []string{"%s", "[%s]", "=>"} + args := []any{m.Name, m.ClusterType} + if m.CloudProvider == consts.CloudLocal { + fields = append(fields, "local") + } else { + fields = append(fields, "%s โŸจ%sโŸฉ") + args = append(args, m.CloudProvider, m.Region) + } + + return fmt.Sprintf(strings.Join(fields, " "), args...) +} diff --git a/cmd/get.go b/cmd/get.go new file mode 100644 index 0000000..ee5945f --- /dev/null +++ b/cmd/get.go @@ -0,0 +1,127 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "os" + "strconv" + "strings" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/logger" + "github.com/ksctl/ksctl/v2/pkg/provider" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) Get() *cobra.Command { + + cmd := &cobra.Command{ + Use: "get", + Example: ` +ksctl get --help +`, + Short: "Use to get the cluster", + Long: "It is used to get the cluster created by the user", + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Print(k.Ctx, "No clusters found") + os.Exit(1) + } + + selectDisplay := make(map[string]string, len(clusters)) + valueMaping := make(map[string]provider.ClusterData, len(clusters)) + + for idx, cluster := range clusters { + selectDisplay[makeHumanReadableList(cluster)] = strconv.Itoa(idx) + valueMaping[strconv.Itoa(idx)] = cluster + } + + selectedCluster, err := cli.DropDown( + "Select the cluster to delete", + selectDisplay, + "", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + cluster := valueMaping[selectedCluster] + + handleTableOutputGet(k.Ctx, k.l, cluster) + + }, + } + + return cmd +} + +func handleTableOutputGet(ctx context.Context, l logger.Logger, data provider.ClusterData) { + + headers := []string{"Attributes", "Values"} + dataToPrint := [][]string{ + {"ClusterName", data.Name}, + {"CloudProvider", string(data.CloudProvider)}, + {"ClusterType", string(data.ClusterType)}, + } + if data.CloudProvider != consts.CloudLocal { + dataToPrint = append(dataToPrint, + []string{"Region", data.Region}, + ) + } + + if data.ClusterType == consts.ClusterTypeSelfMang { + nodes := func(vm []provider.VMData) string { + slice := make([]string, 0, len(vm)) + for _, v := range vm { + slice = append(slice, v.VMSize) + } + return strings.Join(slice, ",") + } + + dataToPrint = append( + dataToPrint, + []string{"BootstrapProvider", string(data.K8sDistro)}, + []string{"BootstrapKubernetesVersion", data.K8sVersion}, + []string{"ControlPlaneNodes", nodes(data.CP)}, + []string{"WorkerPlaneNodes", nodes(data.WP)}, + []string{"EtcdNodes", nodes(data.DS)}, + []string{"LoadBalancer", data.LB.VMSize}, + []string{"EtcdVersion", data.EtcdVersion}, + []string{"HaProxyVersion", data.HAProxyVersion}, + ) + } else { + dataToPrint = append( + dataToPrint, + []string{"ManagedNodes", strconv.Itoa(data.NoMgt) + " X " + data.Mgt.VMSize}, + []string{"ManagedK8sVersion", data.K8sVersion}, + ) + } + + dataToPrint = append(dataToPrint, + []string{"Addons", strings.Join(data.Apps, ",")}, + []string{"CNI", data.Cni}, + ) + + l.Table(ctx, headers, dataToPrint) +} diff --git a/cmd/handle_meta.go b/cmd/handle_meta.go new file mode 100644 index 0000000..0cda0c2 --- /dev/null +++ b/cmd/handle_meta.go @@ -0,0 +1,206 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "encoding/json" + "os" + "strconv" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + controllerMeta "github.com/ksctl/ksctl/v2/pkg/handler/cluster/metadata" + "github.com/ksctl/ksctl/v2/pkg/provider" +) + +func (k *KsctlCommand) baseMetadataFields(m *controller.Metadata) { + if v, ok := k.getClusterName(); !ok { + os.Exit(1) + } else { + m.ClusterName = v + } + + if v, ok := k.getSelectedClusterType(); !ok { + os.Exit(1) + } else { + m.ClusterType = v + } + + if v, ok := k.getSelectedCloudProvider(m.ClusterType); !ok { + os.Exit(1) + } else { + m.Provider = v + } + + if v, ok := k.getSelectedStorageDriver(); !ok { + os.Exit(1) + } else { + m.StateLocation = consts.KsctlStore(v) + } + + if m.ClusterType == consts.ClusterTypeSelfMang { + if v, ok := k.getBootstrap(); ok { + m.K8sDistro = v + } else { + os.Exit(1) + } + } +} + +func (k *KsctlCommand) handleRegionSelection(meta *controllerMeta.Controller, m *controller.Metadata) { + ss := cli.GetSpinner() + ss.Start("Fetching the region list") + + listOfRegions, err := meta.ListAllRegions() + if err != nil { + ss.Stop() + k.l.Error("Failed to sync the metadata", "Reason", err) + os.Exit(1) + } + ss.Stop() + + if v, ok := k.getSelectedRegion(listOfRegions); !ok { + os.Exit(1) + } else { + m.Region = v + } +} + +func (k *KsctlCommand) handleInstanceTypeSelection(meta *controllerMeta.Controller, m *controller.Metadata, prompt string) provider.InstanceRegionOutput { + if len(k.inMemInstanceTypesInReg) == 0 { + ss := cli.GetSpinner() + ss.Start("Fetching the instance type list") + + listOfVMs, err := meta.ListAllInstances(m.Region) + if err != nil { + ss.Stop() + k.l.Error("Failed to sync the metadata", "Reason", err) + os.Exit(1) + } + ss.Stop() + k.inMemInstanceTypesInReg = listOfVMs + } + + v, ok := k.getSelectedInstanceType(prompt, k.inMemInstanceTypesInReg) + if !ok { + k.l.Error("Failed to get the instance type") + os.Exit(1) + } + return k.inMemInstanceTypesInReg[v] +} + +func (k *KsctlCommand) handleManagedK8sVersion(meta *controllerMeta.Controller, m *controller.Metadata) { + ss := cli.GetSpinner() + ss.Start("Fetching the managed cluster k8s versions") + + listOfK8sVersions, err := meta.ListAllManagedClusterK8sVersions(m.Region) + if err != nil { + ss.Stop() + k.l.Error("Failed to sync the metadata", "Reason", err) + os.Exit(1) + } + ss.Stop() + + if v, ok := k.getSelectedK8sVersion("Select the k8s version for Managed Cluster", listOfK8sVersions); !ok { + k.l.Error("Failed to get the k8s version") + os.Exit(1) + } else { + m.K8sVersion = v + } +} + +func (k *KsctlCommand) metadataSummary(meta controller.Metadata) { + k.l.Box(k.Ctx, "Cluster Blueprint", "Here is the blueprint of the cluster") + + headers := []string{"Attributes", "Values"} + + { + k.l.Box(k.Ctx, "Ksctl Cluster Summary", "Key attributes of the cluster") + dd := [][]string{} + dd = append(dd, + []string{"ClusterName", meta.ClusterName}, + []string{"Region", meta.Region}, + []string{"CloudProvider", string(meta.Provider)}, + []string{"ClusterType", string(meta.ClusterType)}, + ) + + k.l.Table(k.Ctx, headers, dd) + } + + println() + + { + dd := [][]string{} + + if meta.NoCP > 0 { + dd = append(dd, []string{"ControlPlaneNodes", strconv.Itoa(meta.NoCP) + " X " + meta.ControlPlaneNodeType}) + } + if meta.NoWP > 0 { + dd = append(dd, []string{"WorkerPlaneNodes", strconv.Itoa(meta.NoWP) + " X " + meta.WorkerPlaneNodeType}) + } + if meta.NoDS > 0 { + dd = append(dd, []string{"EtcdNodes", strconv.Itoa(meta.NoDS) + " X " + meta.DataStoreNodeType}) + } + if meta.LoadBalancerNodeType != "" { + dd = append(dd, []string{"LoadBalancer", meta.LoadBalancerNodeType}) + } + if len(meta.ManagedNodeType) > 0 { + dd = append(dd, []string{"ManagedNodes", strconv.Itoa(meta.NoMP) + " X " + meta.ManagedNodeType}) + } + + if len(dd) > 0 { + k.l.Box(k.Ctx, "Ksctl Cluster Summary", "Infrastructure details of the cluster") + k.l.Table(k.Ctx, headers, dd) + } + } + println() + + { + dd := [][]string{} + + if meta.K8sDistro != "" { + dd = append(dd, []string{"BootstrapProvider", string(meta.K8sDistro)}) + } + if meta.EtcdVersion != "" { + dd = append(dd, []string{"EtcdVersion", meta.EtcdVersion}) + } + if meta.K8sVersion != "" { + dd = append(dd, []string{"BootstrapKubernetesVersion", meta.K8sVersion}) + } + + if len(dd) > 0 { + k.l.Box(k.Ctx, "Ksctl Cluster Summary", "Bootstrap details of the cluster") + k.l.Table(k.Ctx, headers, dd) + } + + } + println() + + { + // Addons Summary + if len(meta.Addons) > 0 { + dd := [][]string{} + + k.l.Box(k.Ctx, "Ksctl Cluster Summary", "Addons details of the cluster") + + v, _ := json.MarshalIndent(meta.Addons, "", " ") + dd = append(dd, []string{"Addons", string(v)}) + k.l.Table(k.Ctx, headers, dd) + println() + } + } + +} diff --git a/cmd/handler.go b/cmd/handler.go new file mode 100644 index 0000000..e48e88d --- /dev/null +++ b/cmd/handler.go @@ -0,0 +1,53 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import "github.com/ksctl/cli/pkg/cli" + +func (k *KsctlCommand) CommandMapping() error { + c := k.Cluster() + cr := k.Configure() + cl := k.List() + + cli.RegisterCommand( + k.root, + c, + k.Version(), + cr, + ) + cli.RegisterCommand( + c, + k.Create(), + k.Delete(), + cl, + k.Get(), + k.Connect(), + k.ScaleUp(), + k.ScaleDown(), + ) + + cli.RegisterCommand( + cl, + k.ListAll(), + ) + + cli.RegisterCommand( + cr, + k.ConfigureStorage(), + k.ConfigureCloud(), + ) + + return nil +} diff --git a/cmd/list.go b/cmd/list.go new file mode 100644 index 0000000..c0ea363 --- /dev/null +++ b/cmd/list.go @@ -0,0 +1,132 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "os" + + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/errors" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + "github.com/ksctl/ksctl/v2/pkg/logger" + "github.com/ksctl/ksctl/v2/pkg/provider" + "github.com/ksctl/ksctl/v2/pkg/validation" + "github.com/spf13/cobra" + + controllerCommon "github.com/ksctl/ksctl/v2/pkg/handler/cluster/common" +) + +func (k *KsctlCommand) List() *cobra.Command { + + var clusterType = "" + + cmd := &cobra.Command{ + Use: "list", + Example: ` +ksctl list --help +`, + Short: "Use to list the clusters", + Long: "It is used to list the clusters created by the user", + Run: func(cmd *cobra.Command, args []string) { + if !validation.ValidateClusterType(consts.KsctlClusterType(clusterType)) { + k.l.Error("Invalid cluster type", "Type", clusterType) + os.Exit(1) + } + }, + } + + cmd.Flags().StringVar(&clusterType, "cluster-type", "", "Type of cluster to list") + + return cmd +} + +func (k *KsctlCommand) ListAll() *cobra.Command { + + cmd := &cobra.Command{ + Use: "all", + Example: ` +ksctl list all --help +`, + Short: "Use to list all the clusters", + Long: "It is used to list all the clusters created by the user", + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Print(k.Ctx, "No clusters found") + return + } + + HandleTableOutputListAll(k.Ctx, k.l, clusters) + }, + } + + return cmd +} + +func (k *KsctlCommand) fetchAllClusters() ([]provider.ClusterData, error) { + m := controller.Metadata{} + if v, ok := k.getSelectedStorageDriver(); !ok { + return nil, errors.NewError(errors.ErrInvalidStorageProvider) + } else { + m.StateLocation = v + } + + m.Provider = consts.CloudAll + + managerClient, err := controllerCommon.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("unable to initialize the ksctl manager", "Reason", err) + return nil, err + } + + clusters, err := managerClient.ListClusters() + if err != nil { + return nil, err + } + return clusters, nil +} + +func HandleTableOutputListAll(ctx context.Context, l logger.Logger, data []provider.ClusterData) { + headers := []string{"Name", "Type", "Cloud", "Region", "BootstrapProvider"} + var dataToPrint [][]string = make([][]string, 0, len(data)) + for _, v := range data { + var row []string + row = append(row, v.Name, string(v.ClusterType), string(v.CloudProvider)) + if v.CloudProvider == consts.CloudLocal { + row = append(row, "") + } else { + row = append(row, v.Region) + } + row = append( + row, + string(v.K8sDistro), + ) + dataToPrint = append(dataToPrint, row) + } + + l.Table(ctx, headers, dataToPrint) +} diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..369a204 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,75 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "context" + "os" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + + cLogger "github.com/ksctl/cli/pkg/logger" + "github.com/spf13/cobra" +) + +// for the newController we should be able to pass some option fields for control more things +// for example whther it is a dry-run for testing + +func (k *KsctlCommand) NewRootCmd() *cobra.Command { + + v := false + + cmd := &cobra.Command{ + Use: "ksctl", + Short: "CLI tool for managing multiple K8s clusters", + Long: "CLI tool which can manage multiple K8s clusters from local clusters to cloud provider specific clusters.", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + if k.dryRun { + k.Ctx = context.WithValue( + k.Ctx, + consts.KsctlTestFlagKey, + "true", + ) + } + + if v { + k.verbose = -1 + } + + k.l = cLogger.NewLogger(k.verbose, os.Stdout) + }, + } + + cmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + cli.AddDryRunFlag(cmd, &k.dryRun) + cli.AddVerboseFlag(cmd, &v) + + return cmd +} + +func (k *KsctlCommand) Cluster() *cobra.Command { + + cmd := &cobra.Command{ + Use: "cluster", + Example: ` +ksctl cluster --help + `, + Short: "Use to work with clusters", + Long: "It is used to work with cluster", + } + + return cmd +} diff --git a/cmd/scale.go b/cmd/scale.go new file mode 100644 index 0000000..246cfe8 --- /dev/null +++ b/cmd/scale.go @@ -0,0 +1,172 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "os" + "strconv" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller" + "github.com/ksctl/ksctl/v2/pkg/handler/cluster/selfmanaged" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) ScaleUp() *cobra.Command { + cmd := &cobra.Command{ + Use: "scaleup", + Example: ` +ksctl update scaleup --help + `, + Short: "Use to manually scaleup a selfmanaged cluster", + Long: "It is used to manually scaleup a selfmanaged cluster", + + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Error("No clusters found to delete") + os.Exit(1) + } + + selectDisplay := make(map[string]string, len(clusters)) + valueMaping := make(map[string]controller.Metadata, len(clusters)) + + for idx, cluster := range clusters { + if cluster.ClusterType == consts.ClusterTypeSelfMang { + selectDisplay[makeHumanReadableList(cluster)] = strconv.Itoa(idx) + valueMaping[strconv.Itoa(idx)] = controller.Metadata{ + ClusterName: cluster.Name, + ClusterType: cluster.ClusterType, + Provider: cluster.CloudProvider, + Region: cluster.Region, + StateLocation: k.KsctlConfig.PreferedStateStore, + K8sDistro: cluster.K8sDistro, + } + } + } + + selectedCluster, err := cli.DropDown( + "Select the cluster to scaleup", + selectDisplay, + "", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + m := valueMaping[selectedCluster] + + c, err := selfmanaged.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("Error in creating the controller", "Error", err) + os.Exit(1) + } + + if err := c.AddWorkerNodes(); err != nil { + k.l.Error("Error in scaling up the cluster", "Error", err) + os.Exit(1) + } + + k.l.Success(k.Ctx, "Cluster workernode scaled up successfully") + }, + } + return cmd +} + +func (k *KsctlCommand) ScaleDown() *cobra.Command { + cmd := &cobra.Command{ + Use: "scaledown", + Example: ` +ksctl update scaledown --help + `, + Short: "Use to manually scaledown a selfmanaged cluster", + Long: "It is used to manually scaledown a selfmanaged cluster", + + Run: func(cmd *cobra.Command, args []string) { + clusters, err := k.fetchAllClusters() + if err != nil { + k.l.Error("Error in fetching the clusters", "Error", err) + os.Exit(1) + } + + if len(clusters) == 0 { + k.l.Error("No clusters found to delete") + os.Exit(1) + } + + selectDisplay := make(map[string]string, len(clusters)) + valueMaping := make(map[string]controller.Metadata, len(clusters)) + + for idx, cluster := range clusters { + if cluster.ClusterType == consts.ClusterTypeSelfMang { + selectDisplay[makeHumanReadableList(cluster)] = strconv.Itoa(idx) + valueMaping[strconv.Itoa(idx)] = controller.Metadata{ + ClusterName: cluster.Name, + ClusterType: cluster.ClusterType, + Provider: cluster.CloudProvider, + Region: cluster.Region, + StateLocation: k.KsctlConfig.PreferedStateStore, + K8sDistro: cluster.K8sDistro, + } + } + } + + selectedCluster, err := cli.DropDown( + "Select the cluster to scaledown", + selectDisplay, + "", + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + os.Exit(1) + } + + m := valueMaping[selectedCluster] + + c, err := selfmanaged.NewController( + k.Ctx, + k.l, + &controller.Client{ + Metadata: m, + }, + ) + if err != nil { + k.l.Error("Error in creating the controller", "Error", err) + os.Exit(1) + } + + if err := c.DeleteWorkerNodes(); err != nil { + k.l.Error("Error in scaling down the cluster", "Error", err) + os.Exit(1) + } + + k.l.Success(k.Ctx, "Cluster workernode scaled down successfully") + }, + } + return cmd +} diff --git a/cmd/userinput.go b/cmd/userinput.go new file mode 100644 index 0000000..de035d4 --- /dev/null +++ b/cmd/userinput.go @@ -0,0 +1,255 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "fmt" + "strconv" + + "github.com/ksctl/cli/pkg/cli" + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/provider" +) + +func (k *KsctlCommand) getClusterName() (string, bool) { + v, err := cli.TextInput("Enter Cluster Name", "") + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } + if len(v) == 0 { + k.l.Error("Cluster name cannot be empty") + return "", false + } + k.l.Debug(k.Ctx, "Text input", "clusterName", v) + return v, true +} + +func (k *KsctlCommand) getBootstrap() (consts.KsctlKubernetes, bool) { + v, err := cli.DropDown( + "Select the bootstrap type", + map[string]string{ + "Kubeadm": string(consts.K8sKubeadm), + "K3s": string(consts.K8sK3s), + }, + string(consts.K8sK3s), + ) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } + k.l.Debug(k.Ctx, "DropDown input", "bootstrapType", v) + return consts.KsctlKubernetes(v), true +} + +type userInputValidation func(int) bool + +func (k *KsctlCommand) getCounterValue(prompt string, validate userInputValidation, defaultVal int) (int, bool) { + v, err := cli.TextInput(prompt, strconv.Itoa(defaultVal)) + if err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return 0, false + } + _v, err := strconv.Atoi(v) + if err != nil { + k.l.Error("Invalid input", "Reason", err) + return 0, false + } + + if !validate(_v) { + k.l.Error("Invalid input") + return 0, false + } + k.l.Debug(k.Ctx, "Text input", "counterValue", v) + return _v, true +} + +func (k *KsctlCommand) getSelectedRegion(regions []provider.RegionOutput) (string, bool) { + vr := make(map[string]string, len(regions)) + for _, r := range regions { + vr[r.Name] = r.Sku + } + + k.l.Debug(k.Ctx, "Regions", "regions", vr) + + if v, err := cli.DropDown( + "Select the region", + vr, + "", + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "region", v) + return v, true + } +} + +func (k *KsctlCommand) getSelectedK8sVersion(prompt string, vers []string) (string, bool) { + k.l.Debug(k.Ctx, "List of k8s versions", "versions", vers) + + if v, err := cli.DropDownList( + prompt, + vers, + vers[0], + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "k8sVersion", v) + return v, true + } +} + +func (k *KsctlCommand) getSelectedInstanceType( + prompt string, + vms map[string]provider.InstanceRegionOutput, +) (string, bool) { + vr := make(map[string]string, len(vms)) + for sku, vm := range vms { + if vm.CpuArch == provider.ArchAmd64 { + displayName := fmt.Sprintf("%s (vCPUs: %d, Memory: %dGB)", + vm.Description, + vm.VCpus, + vm.Memory, + ) + displayName += fmt.Sprintf(", Price: %.2f %s/month", + vm.GetCost(), + vm.Price.Currency, + ) + + vr[displayName] = sku + } + } + + k.l.Debug(k.Ctx, "Instance types", "vms", vr) + + if v, err := cli.DropDown( + prompt, + vr, + "", + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "instanceType", v) + return v, true + } +} + +func (k *KsctlCommand) getSelectedManagedClusterOffering( + prompt string, + offerings map[string]provider.ManagedClusterOutput, +) (string, bool) { + vr := make(map[string]string, len(offerings)) + for _, o := range offerings { + displayName := fmt.Sprintf("%s, Price: %.2f %s/month", + o.Description, + o.GetCost(), + o.Price.Currency, + ) + + vr[displayName] = o.Sku + } + + k.l.Debug(k.Ctx, "Offerings", "offerings", vr) + + if v, err := cli.DropDown( + prompt, + vr, + "", + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "managedClusterOffering", v) + return v, true + } +} + +func (k *KsctlCommand) getSelectedClusterType() (consts.KsctlClusterType, bool) { + if v, err := cli.DropDown( + "Select the cluster type", + map[string]string{ + "Cloud Managed (For ex. EKS, AKS, Kind)": string(consts.ClusterTypeMang), + "Self Managed (For example, K3s, Kubeadm)": string(consts.ClusterTypeSelfMang), + }, + string(consts.ClusterTypeMang), + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "clusterType", v) + return consts.KsctlClusterType(v), true + } +} + +func (k *KsctlCommand) getSelectedCloudProvider(v consts.KsctlClusterType) (consts.KsctlCloud, bool) { + options := map[string]string{ + "Amazon Web Services": string(consts.CloudAws), + "Azure": string(consts.CloudAzure), + } + + if v == consts.ClusterTypeMang { + options["Kind"] = string(consts.CloudLocal) + } + + if v, err := cli.DropDown( + "Select the cloud provider", + options, + "", + ); err != nil { + k.l.Error("Failed to get userinput", "Reason", err) + return "", false + } else { + k.l.Debug(k.Ctx, "DropDown input", "cloudProvider", v) + + if err := k.loadCloudProviderCreds(consts.KsctlCloud(v)); err != nil { + return "", false + } + + return consts.KsctlCloud(v), true + } +} + +func (k *KsctlCommand) loadCloudProviderCreds(v consts.KsctlCloud) error { + switch v { + case consts.CloudAws: + if err := k.loadAwsCredentials(); err != nil { + k.l.Error("Failed to load the AWS credentials", "Reason", err) + return err + } + case consts.CloudAzure: + if err := k.loadAzureCredentials(); err != nil { + k.l.Error("Failed to load the Azure credentials", "Reason", err) + return err + } + } + return nil +} + +func (k *KsctlCommand) getSelectedStorageDriver() (consts.KsctlStore, bool) { + if k.KsctlConfig.PreferedStateStore != consts.StoreExtMongo && k.KsctlConfig.PreferedStateStore != consts.StoreLocal { + k.l.Error("Failed to determine StorageDriver", "message", "Please use $ksctl configure to set the storage driver", "currentSetValue", k.KsctlConfig.PreferedStateStore) + return "", false + } + + if errS := k.loadMongoCredentials(); errS != nil { + k.l.Error("Failed to load the MongoDB credentials", "Reason", errS) + return "", false + } + + return k.KsctlConfig.PreferedStateStore, true +} diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..7308dcd --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,59 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "fmt" + + "github.com/fatih/color" + "github.com/ksctl/cli/pkg/config" + "github.com/spf13/cobra" +) + +func (k *KsctlCommand) Version() *cobra.Command { + + logoKsctl := ` +โกฏโฃบโขฝโข•โกฏโกฏโฃบโข•โฃ—โฃ—โขฝโฃบโฃบโกชโฃ—โกฝโ ตโกณโ ฝโขโกฎโฃณโฃโกฎโ ทโ โฃ—โขฝโกชโฃ—โขทโขโฃ—โขฝโกชโฃฏโกณโกฝโฃโขฎโขฏโฃณโกณโกฝโฃโฃžโขฎโฃณโกณโกฝโฃโขžโขฎโฃณโกณโกฝโฃโขžโขฎโฃณโกณโกฝโฃโขฎโขฏโกณ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโข•โฃ—โฃ—โขฝโกบโกœโขŠโ กโก€โขโ  โ €โข”โกฏโฃžโ Žโ  โขโฃฐโกณโฃโขฎโฃณโขโฃ—โขฝโฃ•โขฏโกบโกฎโกฏโฃบโขฝโข•โฃ—โขฝโขโกฎโกฎโฃณโกณโฃโฃžโขฎโขฏโฃณโกณโ ™โ šโ Šโขนโกณโกตโฃโฃžโขฎโขฏโกณโกฝ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโข•โฃ—โข—โก—โ กโ โฃฐโขโ ‚โ „โก€โ ‚โฃฏโกบโ โ ‚โฃกโขžโฃžโขฎโกณโฃโกฎโฃณโขฝโฃ•โขทโขโกฎโกฏโกฏโฃบโขฝโขตโขฝโขโกตโฃซโขฏโ Žโขˆโ €โก€โขœโฃ—โขตโ …โ โ ˆโก€โฃฝโฃชโฃปโกบโฃชโขฏโกณโกฝโฃ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขตโขฝโกโข€โ โกธโฃ•โกฏโ โข€โ โขธโ Žโ โฃˆโขฎโฃณโขโกฎโฃณโขโกฎโ ปโ ชโ “โขณโฃโฃ—โขฝโขโกฎโฃณโ ฝโ ตโกซโข—โกฝโฃชโขฏโ โ „โ  โข€โขฏโขฎโ ฏโ €โ Œโข€โขฐโกณโฃ•โฃ—โขฝโกชโฃ—โขฝโฃโขฎ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกงโก€โ „โขโฃžโ †โ โ €โ „โ ‘โ  โ ผโขฎโขฏโกบโกตโฃปโกชโกŸโก€โ โ €โ ‚โขฑโกณโฃ•โขฏโกณโ ‹โก€โ ‚โฃ„โกคโ €โ ™โฃžโกคโ โ €โ ‚โขคโฃขโฃบโขƒโ โ โก€โขผโฃบโกบโฃชโข—โกฝโฃบโข•โขทโข +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโกณโกฆโกณโฃโ €โ Œโ  โขจโขคโก…โ โข€โ ˆโขซโขฏโฃบโฃบโ โฃโ ˆโก€โขโขธโขโกฎโกโ  โ €โ „โฃฒโขณโขโ €โฃขโฃณโ …โ โ ˆโก€โฃ—โขตโขฝโ €โ „โขโข โกปโฃœโขฎโฃณโขโกฎโฃ—โขฏโขฏโฃซ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโกฏโฃซโขฏโกƒโ „โ ‚โ โฃธโฃ•โขฏโ ‚โข€โ ‚โขธโกณโกตโกƒโข โก—โก€โ „โ  โ จโฃ—โกโ €โกโ €โขขโขฏโกซโฃโขฏโกบโกฎโ €โกˆโ „โขฐโขโกฝโก•โ €โกโ €โฃธโขฎโฃณโกซโฃžโขตโกซโฃžโขฝโฃ•โฃ— +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโกฏโฃบโขตโ โ  โ ˆโข โกณโฃณโ ฃโ โ €โ „โกฝโกชโ ƒโ „โขทโขฝโ €โ โก€โ Œโฃžโ †โ โ  โ ˆโกฎโฃณโขโกฎโฃ—โขฝโ •โ €โ „โ ‚โกผโกณโฃโ ‚โ „โ โข€โฃ—โข—โฃ—โขฝโกบโฃโขฎโข—โฃ—โฃ—โขต +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโกฏโกบโก‡โ ‚โขโ ˆโกฐโกฏโฃบโ โ  โ โฃจโฃปโ €โขกโก โกฏโกซโ ‚โ โ  โ โ ฉโก€โ Œโ €โ ‚โขฏโกบโฃโกฎโก—โ ‹โ  โ ˆโก€โ ‚โกฏโกฏโ Žโข€โ ‚โขโขฐโกณโฃโขฎโกณโฃโขฎโขฏโฃณโกณโกณโกฝ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโฃซโฃปโ ‚โขˆโ €โ „โกฏโฃซโกŽโ €โ ‚โกโขธโกบโฃ„โ  โ ‰โก‰โ „โขโ ˆโฃ โฃขโกปโฃ†โ  โ โ ‚โกˆโข‰โ ˆโข„โกฐโฃผโกโ  โ โข€โ กโ โฃฐโก€โ โก€โ „โขˆโฃœโฃ—โขฝโกบโกฝโฃ•โขทโขฝโขโกฝ +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโฃบโกบโฃ”โขฆโข–โกผโฃโขžโฃžโกคโกฅโกคโกฆโฃปโกชโฃ—โขฆโขฆโขฆโฃฒโขณโกณโกตโฃโขฎโกณโกงโกฆโกฆโฃฒโกบโฃชโขžโฃžโขžโขถโขดโข”โฃ–โขฏโฃณโกณโกตโกดโฃ”โฃ—โขตโกณโฃโขฎโฃปโกชโกฏโฃณโขโฃž +โกฏโฃบโขฝโข•โกฏโกฏโฃบโขฝโข•โกฏโกฎโกฏโฃบโขฝโข•โกฏโฃบโข•โฃ—โขฝโขโฃโขฎโกณโฃโขฎโขฏโกณโฃณโกณโฃโขฎโขฏโกบโกตโฃซโกณโฃโขฎโกณโฃโขฎโฃณโกณโกฝโฃโขตโฃซโขฎโฃณโกฃโฃฏโกบโฃ•โฃ—โขตโกซโฃžโขตโกซโฃžโขฎโฃปโกชโฃ—โฃ— +` + + cmd := &cobra.Command{ + Use: "version", + Example: ` +ksctl version --help + `, + Short: "ksctl version", + Long: "To get version for ksctl components", + Run: func(cmd *cobra.Command, args []string) { + + fmt.Println(logoKsctl) + + k.l.Note(k.Ctx, "Components", color.HiGreenString("ksctl:cli"), color.HiBlueString(config.Version), color.HiGreenString("ksctl:core"), color.HiBlueString(config.KsctlCoreVer)) + k.l.Note(k.Ctx, "Build Information", "date", config.BuildDate) + }, + } + + return cmd +} diff --git a/gen/docs.go b/gen/docs.go new file mode 100644 index 0000000..63a2737 --- /dev/null +++ b/gen/docs.go @@ -0,0 +1,63 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "fmt" + "log" + "os" + "path/filepath" + + "github.com/ksctl/cli/cmd" + "github.com/spf13/cobra/doc" +) + +func filePrepender(filename string) string { + cmdName := filepath.Base(filename) + cmdName = cmdName[:len(cmdName)-3] // Remove .md extension + + return fmt.Sprintf(`--- +title: %s +description: Command documentation for %s +--- + +`, cmdName, cmdName) +} + +func linkHandler(name string) string { + return name +} + +func main() { + outputDir := filepath.Join("gen", "docs") + if err := os.MkdirAll(outputDir, 0755); err != nil { + log.Fatal(err) + } + + c, err := cmd.New() + if err != nil { + c.CliLog.Error("cli initialization failed", "Reason", err) + os.Exit(1) + } + cc, err := c.ForDocs() + if err != nil { + c.CliLog.Error("failed to get the cobra root command", "Reason", err) + os.Exit(1) + } + + if err := doc.GenMarkdownTreeCustom(cc, outputDir, filePrepender, linkHandler); err != nil { + log.Fatal(err) + } +} diff --git a/gen_docs.go b/gen_docs.go deleted file mode 100644 index c841286..0000000 --- a/gen_docs.go +++ /dev/null @@ -1,34 +0,0 @@ -package main - -import ( - "fmt" - "log" - "path/filepath" - - "github.com/ksctl/cli/cli/cmd" - "github.com/spf13/cobra/doc" -) - -func filePrepender(filename string) string { - cmdName := filepath.Base(filename) - cmdName = cmdName[:len(cmdName)-3] // Remove .md extension - - return fmt.Sprintf(`--- -title: %s -description: Command documentation for %s ---- - -`, cmdName, cmdName) -} - -func linkHandler(name string) string { - return name -} - -func main() { - outputDir := "./gen/docs.md" - - if err := doc.GenMarkdownTreeCustom(cmd.RootCmd, outputDir, filePrepender, linkHandler); err != nil { - log.Fatal(err) - } -} diff --git a/go.mod b/go.mod index 445460b..b9e9791 100644 --- a/go.mod +++ b/go.mod @@ -1,99 +1,102 @@ module github.com/ksctl/cli -go 1.22.2 +go 1.23.3 -toolchain go1.22.5 +toolchain go1.23.4 require ( github.com/Delta456/box-cli-maker/v2 v2.3.0 github.com/creack/pty v1.1.18 - github.com/fatih/color v1.17.0 - github.com/ksctl/ksctl v1.2.7 - github.com/pterm/pterm v0.12.79 + github.com/fatih/color v1.18.0 + github.com/ksctl/ksctl/v2 v2.0.0-rc.5 + github.com/pterm/pterm v0.12.80 github.com/rodaine/table v1.2.0 - github.com/rogpeppe/go-internal v1.12.0 github.com/spf13/cobra v1.8.1 - golang.org/x/term v0.21.0 + golang.org/x/term v0.28.0 + k8s.io/client-go v0.32.0 ) require ( atomicgo.dev/cursor v0.2.0 // indirect atomicgo.dev/keyboard v0.2.9 // indirect atomicgo.dev/schedule v0.1.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/BurntSushi/toml v1.3.2 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 // indirect + github.com/BurntSushi/toml v1.4.0 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/Masterminds/semver/v3 v3.3.0 // indirect + github.com/Masterminds/sprig/v3 v3.3.0 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect - github.com/Microsoft/hcsshim v0.11.4 // indirect - github.com/alessio/shellescape v1.4.1 // indirect - github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect - github.com/aws/aws-sdk-go-v2 v1.30.3 // indirect - github.com/aws/aws-sdk-go-v2/config v1.27.27 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0 // indirect - github.com/aws/aws-sdk-go-v2/service/eks v1.42.5 // indirect - github.com/aws/aws-sdk-go-v2/service/iam v1.32.6 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect - github.com/aws/smithy-go v1.20.3 // indirect + github.com/alessio/shellescape v1.4.2 // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect + github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ec2 v1.198.1 // indirect + github.com/aws/aws-sdk-go-v2/service/eks v1.56.0 // indirect + github.com/aws/aws-sdk-go-v2/service/iam v1.38.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect + github.com/aws/aws-sdk-go-v2/service/pricing v1.32.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect + github.com/aws/smithy-go v1.22.1 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect - github.com/civo/civogo v0.3.69 // indirect github.com/containerd/console v1.0.3 // indirect - github.com/containerd/containerd v1.7.12 // indirect + github.com/containerd/containerd v1.7.23 // indirect + github.com/containerd/errdefs v0.3.0 // indirect github.com/containerd/log v0.1.0 // indirect + github.com/containerd/platforms v0.2.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect - github.com/cyphar/filepath-securejoin v0.2.4 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/distribution/reference v0.5.0 // indirect + github.com/cyphar/filepath-securejoin v0.3.4 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/distribution/reference v0.6.0 // indirect github.com/docker/cli v26.1.1+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v27.1.1+incompatible // indirect + github.com/docker/docker v27.4.1+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v5.7.0+incompatible // indirect + github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-gorp/gorp/v3 v3.1.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/swag v0.22.7 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/golang/snappy v0.0.1 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect @@ -102,17 +105,16 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gosuri/uitable v0.0.4 // indirect - github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect + github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/huandu/xstrings v1.4.0 // indirect - github.com/imdario/mergo v0.3.16 // indirect + github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/jmoiron/sqlx v1.3.5 // indirect + github.com/jmoiron/sqlx v1.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.16.0 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect @@ -122,38 +124,38 @@ require ( 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/mattn/go-runewidth v0.0.15 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/locker v1.0.1 // indirect - github.com/moby/spdystream v0.2.0 // indirect + github.com/moby/spdystream v0.5.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect - github.com/montanaflynn/stats v0.7.0 // indirect + github.com/montanaflynn/stats v0.7.1 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc6 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect - github.com/rubenv/sql-migrate v1.5.2 // indirect + github.com/rubenv/sql-migrate v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/shopspring/decimal v1.3.1 // indirect + github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect - github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/cast v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/x448/float16 v0.8.4 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect @@ -162,44 +164,45 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xlab/treeprint v1.2.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect - go.mongodb.org/mongo-driver v1.15.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect + go.mongodb.org/mongo-driver v1.17.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/time v0.5.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/time v0.7.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - helm.sh/helm/v3 v3.14.4 // indirect - k8s.io/api v0.30.1 // indirect - k8s.io/apiextensions-apiserver v0.30.1 // indirect - k8s.io/apimachinery v0.30.1 // indirect - k8s.io/apiserver v0.30.1 // indirect - k8s.io/cli-runtime v0.29.0 // indirect - k8s.io/client-go v0.30.1 // indirect - k8s.io/component-base v0.30.1 // indirect - k8s.io/klog/v2 v2.120.1 // indirect - k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/kubectl v0.29.0 // indirect - k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect + gotest.tools/v3 v3.5.1 // indirect + helm.sh/helm/v3 v3.16.4 // indirect + k8s.io/api v0.32.0 // indirect + k8s.io/apiextensions-apiserver v0.31.3 // indirect + k8s.io/apimachinery v0.32.0 // indirect + k8s.io/apiserver v0.31.3 // indirect + k8s.io/cli-runtime v0.31.3 // indirect + k8s.io/component-base v0.31.3 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/kubectl v0.31.3 // indirect + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect oras.land/oras-go v1.2.5 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/kind v0.22.0 // indirect - sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect - sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/kind v0.26.0 // indirect + sigs.k8s.io/kustomize/api v0.17.2 // indirect + sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index ede12ff..c3e30f1 100644 --- a/go.sum +++ b/go.sum @@ -7,22 +7,32 @@ atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtE atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs= atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 h1:jBQA3cKT4L2rWMpgE7Yt3Hwh2aUj8KXjIGLxjHeYNNo= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 h1:LkHbJbgF3YyvC53aqYGR+wWQDn2Rdp9AQdGndf9QvY4= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0/go.mod h1:QyiQdW4f4/BIfB8ZutZ2s+28RAgfa/pT+zS++ZHyM1I= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 h1:0nGmzwBv5ougvzfGPCO2ljFRHvun57KpNrVCMrlk0ns= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0/go.mod h1:gYq8wyDgv6JLhGbAU6gg8amCPgQWRE+aCvrV2gyzdfs= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 h1:g0EZJwz7xkXQiZAI5xi9f3WWFYBlX1CPTrR+NDToRkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 h1:B/dfvscEQtew9dVuoxqxrUKKv8Ih2f55PydknDamU+g= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0/go.mod h1:fiPSssYvltE08HJchL04dOy+RD4hgrjph0cwGGMntdI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0 h1:+m0M/LFxN43KvULkDNfdXOgrjtg6UYJPFBJyuEcRCAw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0/go.mod h1:PwOyop78lveYMRs6oCxjiVyBdyCgIYH6XHIVZO9/SFQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.3.0 h1:Dc9miZr1Mhaqbb3cmJCRokkG16uk8JKkqOADf084zy4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 v6.3.0/go.mod h1:CHo9QYhWEvrKVeXsEMJSl2bpmYYNu6aG12JsSaFBXlY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v5 v5.0.0 h1:5n7dPVqsWfVKw+ZiEKSd3Kzu7gwBkbEBkeXb8rgaE9Q= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v5 v5.0.0/go.mod h1:HcZY0PHPo/7d75p99lB6lK0qYOP4vLRJUBpiehYXtLQ= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0 h1:4ZTvMq5AWtRIPM06RzdfKwKyVJ0eUOfm4QUBVDQFqQ4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0/go.mod h1:drbnYtukMoZqUQq9hJASf41w3RB4VoTJPoPpe+XDHPU= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0/go.mod h1:ceIuwmxDWptoW3eCqSXlnPsZFKh4X+R38dWPv7GS9Vs= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 h1:QM6sE5k2ZT/vI5BEe0r7mqjsUSnhVBFbOsVkEuaEfiA= @@ -33,12 +43,13 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 h1:kYRSnvJju5gYVyhkij+RTJ/VR6QIUaCfWeaFm2ycsjQ= +github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/Delta456/box-cli-maker/v2 v2.3.0 h1:rGdoK/Qt3shdT1uqRMGgPqrhtisGD7PamTW8vY5MyCA= @@ -56,64 +67,67 @@ github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= -github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/Microsoft/hcsshim v0.11.7 h1:vl/nj3Bar/CvJSYo7gIQPyRWc9f3c6IeSNavBTSZNZQ= +github.com/Microsoft/hcsshim v0.11.7/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= -github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= +github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0= +github.com/alessio/shellescape v1.4.2/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 h1:4daAzAu0S6Vi7/lbWECcX0j45yZReDZ56BQsrVBOEEY= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= -github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY= -github.com/aws/aws-sdk-go-v2 v1.30.3/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc= -github.com/aws/aws-sdk-go-v2/config v1.27.27 h1:HdqgGt1OAP0HkEDDShEl0oSYa9ZZBSOmKpdpsDMdO90= -github.com/aws/aws-sdk-go-v2/config v1.27.27/go.mod h1:MVYamCg76dFNINkZFu4n4RjDixhVr51HLj4ErWzrVwg= -github.com/aws/aws-sdk-go-v2/credentials v1.17.27 h1:2raNba6gr2IfA0eqqiP2XiQ0UVOpGPgDSi0I9iAP+UI= -github.com/aws/aws-sdk-go-v2/credentials v1.17.27/go.mod h1:gniiwbGahQByxan6YjQUMcW4Aov6bLC3m+evgcoN4r4= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 h1:KreluoV8FZDEtI6Co2xuNk/UqI9iwMrOx/87PBNIKqw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11/go.mod h1:SeSUYBLsMYFoRvHE0Tjvn7kbxaUhl75CJi1sbfhMxkU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 h1:SoNJ4RlFEQEbtDcCEt+QG56MY4fm4W8rYirAmq+/DdU= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15/go.mod h1:U9ke74k1n2bf+RIgoX1SXFed1HLs51OgUSs+Ph0KJP8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 h1:C6WHdGnTDIYETAm5iErQUiVNsclNx9qbJVPIt03B6bI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0 h1:ta62lid9JkIpKZtZZXSj6rP2AqY5x1qYGq53ffxqD9Q= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.173.0/go.mod h1:o6QDjdVKpP5EF0dp/VlvqckzuSDATr1rLdHt3A5m0YY= -github.com/aws/aws-sdk-go-v2/service/eks v1.42.5 h1:wQUW0CJ7C40gYGX7IYqG/3BbePub4Zj8ySnFnjFaWB8= -github.com/aws/aws-sdk-go-v2/service/eks v1.42.5/go.mod h1:+DcodqLze5C9zSc9lobCR25JDgE+YME4AJvTHeZoeXo= -github.com/aws/aws-sdk-go-v2/service/iam v1.32.6 h1:NRlKKQ/BPHPqsuN2Hy6v4WA8/bsRTP0j8/BFPBC5+SU= -github.com/aws/aws-sdk-go-v2/service/iam v1.32.6/go.mod h1:S+s7/UH0UIqRX4GyXvZihMJNR9nqlB0kxO4NKSFeRak= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 h1:dT3MqvGhSoaIhRseqw2I0yH81l7wiR2vjs57O51EAm8= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3/go.mod h1:GlAeCkHwugxdHaueRr4nhPuY+WW+gR8UjlcqzPr1SPI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 h1:HGErhhrxZlQ044RiM+WdoZxp0p+EGM62y3L6pwA4olE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17/go.mod h1:RkZEx4l0EHYDJpWppMJ3nD9wZJAa8/0lq9aVC+r2UII= -github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 h1:BXx0ZIxvrJdSgSvKTZ+yRBeSqqgPM89VPlulEcl37tM= -github.com/aws/aws-sdk-go-v2/service/sso v1.22.4/go.mod h1:ooyCOXjvJEsUw7x+ZDHeISPMhtwI3ZCB7ggFMcFfWLU= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 h1:yiwVzJW2ZxZTurVbYWA7QOrAaCYQR72t0wrSBfoesUE= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4/go.mod h1:0oxfLkpz3rQ/CHlx5hB7H69YUpFiI1tql6Q6Ne+1bCw= -github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 h1:ZsDKRLXGWHk8WdtyYMoGNO7bTudrvuKpDKgMVRlepGE= -github.com/aws/aws-sdk-go-v2/service/sts v1.30.3/go.mod h1:zwySh8fpFyXp9yOr/KVzxOl8SRqgf/IDw5aUt9UKFcQ= -github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE= -github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go-v2 v1.32.7 h1:ky5o35oENWi0JYWUZkB7WYvVPP+bcRF5/Iq7JWSb5Rw= +github.com/aws/aws-sdk-go-v2 v1.32.7/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U= +github.com/aws/aws-sdk-go-v2/config v1.28.7 h1:GduUnoTXlhkgnxTD93g1nv4tVPILbdNQOzav+Wpg7AE= +github.com/aws/aws-sdk-go-v2/config v1.28.7/go.mod h1:vZGX6GVkIE8uECSUHB6MWAUsd4ZcG2Yq/dMa4refR3M= +github.com/aws/aws-sdk-go-v2/credentials v1.17.48 h1:IYdLD1qTJ0zanRavulofmqut4afs45mOWEI+MzZtTfQ= +github.com/aws/aws-sdk-go-v2/credentials v1.17.48/go.mod h1:tOscxHN3CGmuX9idQ3+qbkzrjVIx32lqDSU1/0d/qXs= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 h1:kqOrpojG71DxJm/KDPO+Z/y1phm1JlC8/iT+5XRmAn8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22/go.mod h1:NtSFajXVVL8TA2QNngagVZmUtXciyrHOt7xgz4faS/M= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 h1:I/5wmGMffY4happ8NOCuIUEWGUvvFp5NSeQcXl9RHcI= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26/go.mod h1:FR8f4turZtNy6baO0KJ5FJUmXH/cSkI9fOngs0yl6mA= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 h1:zXFLuEuMMUOvEARXFUVJdfqZ4bvvSgdGRq/ATcrQxzM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26/go.mod h1:3o2Wpy0bogG1kyOPrgkXA8pgIfEEv0+m19O9D5+W8y8= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.198.1 h1:YbNopxjd9baM83YEEmkaYHi+NuJt0AszeaSLqo0CVr0= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.198.1/go.mod h1:mwr3iRm8u1+kkEx4ftDM2Q6Yr0XQFBKrP036ng+k5Lk= +github.com/aws/aws-sdk-go-v2/service/eks v1.56.0 h1:x31cGGE/t/QkrHVh5m2uWvYwDiaDXpj88nh6OdnI5r0= +github.com/aws/aws-sdk-go-v2/service/eks v1.56.0/go.mod h1:kNUWaiotRWCnfQlprrxSMg8ALqbZyA9xLCwKXuLumSk= +github.com/aws/aws-sdk-go-v2/service/iam v1.38.3 h1:2sFIoFzU1IEL9epJWubJm9Dhrn45aTNEJuwsesaCGnk= +github.com/aws/aws-sdk-go-v2/service/iam v1.38.3/go.mod h1:KzlNINwfr/47tKkEhgk0r10/OZq3rjtyWy0txL3lM+I= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 h1:8eUsivBQzZHqe/3FE+cqwfH+0p5Jo8PFM/QYQSmeZ+M= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7/go.mod h1:kLPQvGUmxn/fqiCrDeohwG33bq2pQpGeY62yRO6Nrh0= +github.com/aws/aws-sdk-go-v2/service/pricing v1.32.8 h1:R3X3UwwZKYLCNVVeJ+WLefvrjI5HonYCMlf40BYvJ8E= +github.com/aws/aws-sdk-go-v2/service/pricing v1.32.8/go.mod h1:4kkTK4zhY31emmt9VGgq3S+ElECNsiI5h6bqSBt71b0= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 h1:CvuUmnXI7ebaUAhbJcDy9YQx8wHR69eZ9I7q5hszt/g= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.8/go.mod h1:XDeGv1opzwm8ubxddF0cgqkZWsyOtw4lr6dxwmb6YQg= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 h1:F2rBfNAL5UyswqoeWv9zs74N/NanhK16ydHW1pahX6E= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7/go.mod h1:JfyQ0g2JG8+Krq0EuZNnRwX0mU0HrwY/tG6JNfcqh4k= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 h1:Xgv/hyNgvLda/M9l9qxXc4UFSgppnRczLxlMs5Ae/QY= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.3/go.mod h1:5Gn+d+VaaRgsjewpMvGazt0WfcFO+Md4wLOuBfGR9Bc= +github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro= +github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bshuster-repo/logrus-logstash-hook v1.0.0 h1:e+C0SB5R1pu//O4MQ3f9cFuPGoOVeF2fE4Og9otCc70= github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd h1:rFt+Y/IK1aEZkEHchZRSq9OQbsSzIT/OrI8YFFmRIng= @@ -130,40 +144,44 @@ github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHe github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/civo/civogo v0.3.69 h1:Not+F3Z1mxtXjMvDhUD5Nwi/1ql3uBT0ioRfhKXYhOA= -github.com/civo/civogo v0.3.69/go.mod h1:7UCYX+qeeJbrG55E1huv+0ySxcHTqq/26FcHLVelQJM= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/containerd/containerd v1.7.12 h1:+KQsnv4VnzyxWcfO9mlxxELaoztsDEjOuCMPAuPqgU0= -github.com/containerd/containerd v1.7.12/go.mod h1:/5OMpE1p0ylxtEUGY8kuCYkDRzJm9NO1TFMWjUpdevk= +github.com/containerd/containerd v1.7.23 h1:H2CClyUkmpKAGlhQp95g2WXHfLYc7whAuvZGBNYOOwQ= +github.com/containerd/containerd v1.7.23/go.mod h1:7QUzfURqZWCZV7RLNEn1XjUCQLEf0bkaK4GjUaZehxw= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/errdefs v0.3.0 h1:FSZgGOeK4yuT/+DnF07/Olde/q4KBoMsaamhXxIMDp4= +github.com/containerd/errdefs v0.3.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= -github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cyphar/filepath-securejoin v0.3.4 h1:VBWugsJh2ZxJmLFSM06/0qzQyiQX2Qs0ViKrUAcqdZ8= +github.com/cyphar/filepath-securejoin v0.3.4/go.mod h1:8s/MCNJREmFK0H02MF6Ihv1nakJe4L/w3WZLHNkvlYM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc= github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI= -github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= -github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v26.1.1+incompatible h1:bE1/uE2tCa08fMv+7ikLR/RDPoCqytwrLtkIkSzxLvw= github.com/docker/cli v26.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v27.1.1+incompatible h1:hO/M4MtV36kzKldqnA37IWhebRA+LnqqcqDja6kVaKY= -github.com/docker/docker v27.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.4.1+incompatible h1:ZJvcY7gfwHn1JF48PfbyXg7Jyt9ZCWDW+GGXOIxEwp4= +github.com/docker/docker v27.4.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= @@ -180,21 +198,22 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= -github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= +github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= +github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI= -github.com/foxcpp/go-mockdns v1.0.0/go.mod h1:lgRN6+KxQBawyIghpnl5CezHFGS9VLzvtVlwxvzXTQ4= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI= +github.com/foxcpp/go-mockdns v1.1.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +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-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs= @@ -207,28 +226,19 @@ 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-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +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.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/swag v0.22.7 h1:JWrc1uc/P9cSomxfnsFSVWoE1FW6bNbrVPmpQYpCcR8= -github.com/go-openapi/swag v0.22.7/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +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-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= 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/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= -github.com/gobuffalo/logger v1.0.6/go.mod h1:J31TBEHR1QLV2683OXTAItYIg8pv2JMHnF/quuAbMjs= -github.com/gobuffalo/packd v1.0.1 h1:U2wXfRr4E9DH8IdsDLlRFwTZTK7hLfq9qT/QHXGVe/0= -github.com/gobuffalo/packd v1.0.1/go.mod h1:PP2POP3p3RXGz7Jh6eYEf93S7vA2za6xM7QT85L4+VY= -github.com/gobuffalo/packr/v2 v2.8.3 h1:xE1yzvnO56cUC0sTpKR3DIbxZgB54AftTFMhB2XEWlY= -github.com/gobuffalo/packr/v2 v2.8.3/go.mod h1:0SahksCVcx4IMnigTjiFuyldmTrdTctXsOdiU5KwbKc= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -249,8 +259,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.8.2 h1:H5XSIre1MB5NbPYFp+i1NBbb5qN1W8Y8YAQoAYbkm8k= github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= @@ -263,23 +273,19 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +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/safetext v0.0.0-20220905092116-b49f7bc46da2 h1:SJ+NtwL6QaZ21U+IrK7d0gGgpjGGvd2kz+FzTHVzdqI= github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2/go.mod h1:Tv1PlzqC9t8wNnpPdctvtSUOPUUg4SHeE6vR1Ir2hmg= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= @@ -287,19 +293,18 @@ github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl github.com/gookit/color v1.5.2/go.mod h1:w8h4bGiHeeBpvQVePTutdbERIUf3oJE5lZ8HM0UgXyg= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= -github.com/gookit/goutil v0.6.15 h1:mMQ0ElojNZoyPD0eVROk5QXJPh2uKR4g06slgPDF5Jo= -github.com/gookit/goutil v0.6.15/go.mod h1:qdKdYEHQdEtyH+4fNdQNZfJHhI0jUZzHxQVAV3DaMDY= +github.com/gookit/goutil v0.6.18 h1:MUVj0G16flubWT8zYVicIuisUiHdgirPAkmnfD2kKgw= +github.com/gookit/goutil v0.6.18/go.mod h1:AY/5sAwKe7Xck+mEbuxj0n/bc3qwrGNe3Oeulln7zBA= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= +github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -308,22 +313,16 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= +github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= 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.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -331,12 +330,12 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u 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/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= -github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= +github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= 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/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= -github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= @@ -352,15 +351,14 @@ 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/ksctl/ksctl v1.2.7 h1:raf9YAX2Rs27xSxTsiIk2xXDhvt7lvA/gh+Z2zxmjcA= -github.com/ksctl/ksctl v1.2.7/go.mod h1:zsvtX9ZPgOYv41MeF1kNuFAq0SDAoBVPS5WnQ49rq4E= +github.com/ksctl/ksctl/v2 v2.0.0-rc.5 h1:/rcreYp//9mwsLTl7ttFsMvTy6hx2H90kUZ+8qnFAHY= +github.com/ksctl/ksctl/v2 v2.0.0-rc.5/go.mod h1:0YSItxAJYCXFZlAodcoFaa9UFoxp4cgafrUTUB5ZS8c= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= @@ -369,47 +367,38 @@ github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8 github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= -github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= -github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= -github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= -github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= 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.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 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/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg= -github.com/miekg/dns v1.1.25/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= +github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= -github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= -github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= +github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -421,8 +410,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= -github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU= -github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= +github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= @@ -430,16 +419,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0= -github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA= -github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os= -github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo= +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/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= -github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= @@ -449,32 +436,32 @@ github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rK github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY= github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/pterm/pterm v0.12.27/go.mod h1:PhQ89w4i95rhgE+xedAoqous6K9X+r6aSOI2eFF7DZI= github.com/pterm/pterm v0.12.29/go.mod h1:WI3qxgvoQFFGKGjGnJR849gU0TsEOvKn5Q8LlY1U7lg= github.com/pterm/pterm v0.12.30/go.mod h1:MOqLIyMOgmTDz9yorcYbcw+HsgoZo3BQfg2wtl3HEFE= @@ -482,8 +469,10 @@ github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEej github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE= github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8= github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s= -github.com/pterm/pterm v0.12.79 h1:lH3yrYMhdpeqX9y5Ep1u7DejyHy7NSQg9qrBjF9dFT4= -github.com/pterm/pterm v0.12.79/go.mod h1:1v/gzOF1N0FsjbgTHZ1wVycRkKiatFvJSJC4IGaQAAo= +github.com/pterm/pterm v0.12.80 h1:mM55B+GnKUnLMUSqhdINe4s6tOuVQIetQ3my8JGyAIg= +github.com/pterm/pterm v0.12.80/go.mod h1:c6DeF9bSnOSeFPZlfs4ZRAFcf5SCoTwvwQ5xaKGQlHo= +github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= +github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= @@ -492,22 +481,19 @@ github.com/rodaine/table v1.2.0 h1:38HEnwK4mKSHQJIkavVj+bst1TEY7j9zhLMWu4QJrMA= github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/rubenv/sql-migrate v1.5.2 h1:bMDqOnrJVV/6JQgQ/MxOpU+AdO8uzYYA/TxFUBzFtS0= -github.com/rubenv/sql-migrate v1.5.2/go.mod h1:H38GW8Vqf8F0Su5XignRyaRcbXbJunSWxs+kmzlg0Is= +github.com/rubenv/sql-migrate v1.7.0 h1:HtQq1xyTN2ISmQDggnh0c9U3JlP8apWh8YO2jzlXpTI= +github.com/rubenv/sql-migrate v1.7.0/go.mod h1:S4wtDEG1CKn+0ShpTtzWhFpHHI5PvCUtiGI+C+Z2THE= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -521,14 +507,16 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +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/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -547,8 +535,8 @@ github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= 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= @@ -558,31 +546,33 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 h1:hlE8//ciYMzt github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f h1:ERexzlUfuTvpE74urLSbIQW0Z/6hF9t8U4NsJLaioAY= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUSLc= -go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= +go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= +go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 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/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -590,8 +580,8 @@ 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/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -604,13 +594,12 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL 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.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -619,8 +608,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ 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/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -633,7 +622,6 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/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-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -641,32 +629,29 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc 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.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20221017184919-83659145692c/go.mod h1:VTIZ7TEbF0BS9Sv9lPTvGbtW8i4z6GGbJBCM37uMCzY= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= 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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -677,8 +662,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY 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.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +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= @@ -688,8 +673,8 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -703,21 +688,21 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/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.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -726,44 +711,43 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -helm.sh/helm/v3 v3.14.4 h1:6FSpEfqyDalHq3kUr4gOMThhgY55kXUEjdQoyODYnrM= -helm.sh/helm/v3 v3.14.4/go.mod h1:Tje7LL4gprZpuBNTbG34d1Xn5NmRT3OWfBRwpOSer9I= +helm.sh/helm/v3 v3.16.4 h1:rBn/h9MACw+QlhxQTjpl8Ifx+VTWaYsw3rguGBYBzr0= +helm.sh/helm/v3 v3.16.4/go.mod h1:k8QPotUt57wWbi90w3LNmg3/MWcLPigVv+0/X4B8BzA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY= -k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM= -k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws= -k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4= -k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U= -k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/apiserver v0.30.1 h1:BEWEe8bzS12nMtDKXzCF5Q5ovp6LjjYkSp8qOPk8LZ8= -k8s.io/apiserver v0.30.1/go.mod h1:i87ZnQ+/PGAmSbD/iEKM68bm1D5reX8fO4Ito4B01mo= -k8s.io/cli-runtime v0.29.0 h1:q2kC3cex4rOBLfPOnMSzV2BIrrQlx97gxHJs21KxKS4= -k8s.io/cli-runtime v0.29.0/go.mod h1:VKudXp3X7wR45L+nER85YUzOQIru28HQpXr0mTdeCrk= -k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q= -k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc= -k8s.io/component-base v0.30.1 h1:bvAtlPh1UrdaZL20D9+sWxsJljMi0QZ3Lmw+kmZAaxQ= -k8s.io/component-base v0.30.1/go.mod h1:e/X9kDiOebwlI41AvBHuWdqFriSRrX50CdwA9TFaHLI= -k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= -k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= -k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/kubectl v0.29.0 h1:Oqi48gXjikDhrBF67AYuZRTcJV4lg2l42GmvsP7FmYI= -k8s.io/kubectl v0.29.0/go.mod h1:0jMjGWIcMIQzmUaMgAzhSELv5WtHo2a8pq67DtviAJs= -k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= -k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= +k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= +k8s.io/apiextensions-apiserver v0.31.3 h1:+GFGj2qFiU7rGCsA5o+p/rul1OQIq6oYpQw4+u+nciE= +k8s.io/apiextensions-apiserver v0.31.3/go.mod h1:2DSpFhUZZJmn/cr/RweH1cEVVbzFw9YBu4T+U3mf1e4= +k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= +k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/apiserver v0.31.3 h1:+1oHTtCB+OheqFEz375D0IlzHZ5VeQKX1KGXnx+TTuY= +k8s.io/apiserver v0.31.3/go.mod h1:PrxVbebxrxQPFhJk4powDISIROkNMKHibTg9lTRQ0Qg= +k8s.io/cli-runtime v0.31.3 h1:fEQD9Xokir78y7pVK/fCJN090/iYNrLHpFbGU4ul9TI= +k8s.io/cli-runtime v0.31.3/go.mod h1:Q2jkyTpl+f6AtodQvgDI8io3jrfr+Z0LyQBPJJ2Btq8= +k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= +k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= +k8s.io/component-base v0.31.3 h1:DMCXXVx546Rfvhj+3cOm2EUxhS+EyztH423j+8sOwhQ= +k8s.io/component-base v0.31.3/go.mod h1:xME6BHfUOafRgT0rGVBGl7TuSg8Z9/deT7qq6w7qjIU= +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-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/kubectl v0.31.3 h1:3r111pCjPsvnR98oLLxDMwAeM6OPGmPty6gSKaLTQes= +k8s.io/kubectl v0.31.3/go.mod h1:lhMECDCbJN8He12qcKqs2QfmVo9Pue30geovBVpH5fs= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo= oras.land/oras-go v1.2.5/go.mod h1:PuAwRShRZCsZb7g8Ar3jKKQR/2A/qN+pkYxIOd/FAoo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/kind v0.22.0 h1:z/+yr/azoOfzsfooqRsPw1wjJlqT/ukXP0ShkHwNlsI= -sigs.k8s.io/kind v0.22.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= -sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 h1:XX3Ajgzov2RKUdc5jW3t5jwY7Bo7dcRm+tFxT+NfgY0= -sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3/go.mod h1:9n16EZKMhXBNSiUC5kSdFQJkdH3zbxS/JoO619G1VAY= -sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 h1:W6cLQc5pnqM7vh3b7HvGNfXrJ/xL6BDMS0v1V/HHg5U= -sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3/go.mod h1:JWP1Fj0VWGHyw3YUPjXSQnRnrwezrZSrApfX5S0nIag= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +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/kind v0.26.0 h1:8fS6I0Q5WGlmLprSpH0DarlOSdcsv0txnwc93J2BP7M= +sigs.k8s.io/kind v0.26.0/go.mod h1:t7ueEpzPYJvHA8aeLtI52rtFftNgUYUaCwvxjk7phfw= +sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g= +sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0= +sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ= +sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/logger/logging.go b/logger/logging.go deleted file mode 100644 index a95d417..0000000 --- a/logger/logging.go +++ /dev/null @@ -1,54 +0,0 @@ -package logger - -import ( - "context" - "strings" - - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/helpers/utilities" -) - -func getPackageName(ctx context.Context) string { - if v, ok := ctx.Value(consts.KsctlModuleNameKey).(string); ok { - return v - } else { - return "!!NOT_SET" - } -} - -const ( - limitCol int = 80 -) - -func addLineTerminationForLongStrings(str string) string { - - //arr with endline split - arrStr := strings.Split(str, "\n") - - var helper func(string) string - - helper = func(_str string) string { - - if len(_str) <= limitCol { - return _str - } - - x := string(utilities.DeepCopySlice[byte]([]byte(_str[:limitCol]))) - y := string(utilities.DeepCopySlice[byte]([]byte(helper(_str[limitCol:])))) - - // ks - // ^^ - if x[len(x)-1] != ' ' && y[0] != ' ' { - x += "-" - } - - _new := x + "\n" + y - return _new - } - - for idx, line := range arrStr { - arrStr[idx] = helper(line) - } - - return strings.Join(arrStr, "\n") -} diff --git a/main.go b/main.go new file mode 100644 index 0000000..5e06c9d --- /dev/null +++ b/main.go @@ -0,0 +1,41 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "os" + "time" + + "github.com/ksctl/cli/cmd" +) + +func main() { + c, err := cmd.New() + if err != nil { + c.CliLog.Error("cli initialization failed", "Reason", err) + os.Exit(1) + } + + timer := time.Now() + defer func() { + c.CliLog.Print(c.Ctx, "Time Took", "time", time.Since(timer).String()) + }() + + err = c.Execute() + if err != nil { + c.CliLog.Error("command execution failed", "Reason", err) + os.Exit(1) + } +} diff --git a/pkg/cli/flags.go b/pkg/cli/flags.go new file mode 100644 index 0000000..fdf0d4f --- /dev/null +++ b/pkg/cli/flags.go @@ -0,0 +1,34 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cli + +import "github.com/spf13/cobra" + +func MarkFlagsRequired(command *cobra.Command, flagNames ...string) error { + for _, flagName := range flagNames { + if err := command.MarkFlagRequired(flagName); err != nil { + return err + } + } + return nil +} + +func AddVerboseFlag(command *cobra.Command, verbose *bool) { + command.PersistentFlags().BoolVarP(verbose, "verbose", "v", false, "Enable verbose output") +} + +func AddDryRunFlag(command *cobra.Command, dryRun *bool) { + command.PersistentFlags().BoolVar(dryRun, "dry-run", false, "Perform a dry run") +} diff --git a/pkg/cli/mapping.go b/pkg/cli/mapping.go new file mode 100644 index 0000000..4c16cf1 --- /dev/null +++ b/pkg/cli/mapping.go @@ -0,0 +1,23 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cli + +import "github.com/spf13/cobra" + +func RegisterCommand(parent *cobra.Command, children ...*cobra.Command) { + for _, child := range children { + parent.AddCommand(child) + } +} diff --git a/pkg/cli/menudriven.go b/pkg/cli/menudriven.go new file mode 100644 index 0000000..4836d81 --- /dev/null +++ b/pkg/cli/menudriven.go @@ -0,0 +1,115 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cli + +import ( + "fmt" + "os" + "strings" + + "github.com/pterm/pterm" +) + +type Spinner struct { + c pterm.SpinnerPrinter + s *pterm.SpinnerPrinter +} + +func GetSpinner() *Spinner { + spinner := pterm.DefaultSpinner + spinner.Sequence = []string{"โก", "โกŸ", "โกฟ", "โขฟ", "โฃป", "โฃฝ", "โฃพ", "โฃท", "โฃฏ", "โฃ"} + + return &Spinner{ + c: spinner, + } +} + +func (s *Spinner) Start(msg ...any) { + s.s, _ = s.c.Start(msg...) +} + +func (s *Spinner) StopWithSuccess(msg ...any) { + s.s.Success(msg...) +} + +func (s *Spinner) Stop() { + _, _ = fmt.Fprint(os.Stderr, "\r"+strings.Repeat(" ", pterm.GetTerminalWidth())) // Clear the spinner + _ = s.s.Stop() +} + +func (s *Spinner) StopWithFailure(msg ...any) { + s.s.Fail(msg...) +} + +func Confirmation(prompt, defaultOption string) (proceed bool, err error) { + x := pterm.DefaultInteractiveConfirm + if len(defaultOption) != 0 { + x = *x.WithDefaultText(defaultOption) + } + return x.Show(prompt) +} + +func TextInput(prompt string, defaultValue string) (string, error) { + if len(defaultValue) == 0 { + return pterm.DefaultInteractiveTextInput.Show(prompt) + } + x := pterm.DefaultInteractiveTextInput.WithDefaultValue(defaultValue) + return x.Show(prompt) +} + +func TextInputPassword(prompt string) (string, error) { + x := pterm.DefaultInteractiveTextInput.WithMask("*") + return x.Show(prompt) +} + +func DropDown(prompt string, options map[string]string, defaultOption string) (string, error) { + var _options []string + for k := range options { + _options = append(_options, k) + } + + x := pterm.DefaultInteractiveSelect.WithOptions(_options) + if len(defaultOption) != 0 { + for k, v := range options { + if v == defaultOption { + defaultOption = k + break + } + } + x = x.WithDefaultOption(defaultOption) + } + + if v, err := x.Show(prompt); err != nil { + return "", err + } else { + // pterm.DefaultArea.Clear() + return options[v], nil + } + +} + +func DropDownList(prompt string, options []string, defaultOption string) (string, error) { + + x := pterm.DefaultInteractiveSelect.WithOptions(options) + if len(defaultOption) != 0 { + x = x.WithDefaultOption(defaultOption) + } + + if v, err := x.Show(prompt); err != nil { + return "", err + } else { + return v, nil + } +} diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..59ee5bd --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,92 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/ksctl/ksctl/v2/pkg/consts" +) + +// ksctl config in ~/.config/ksctl/config.json (handled by ksctl:cli) +// ksctl credentials in ~/.config/ksctl/creds/(aws|azure|mongodb).json (handled by ksctl:cli) +// ksctl state in ~/.ksctl/state/..... (handled by the ksctl:core:storage) + +// NOTE +// store all the credentials in the local file system and for state we decide on the external storage +// we will retrieve the credentials and load them in the context.Background() and pass it to the respective clients +// So we need to initialize the HostStorage() to get the credentials from the local file system once thats done +// we can populate the context.Background() with the credentials. and initialze the client which that preferedstateStore unless specified in the command argument + +type Config struct { + PreferedStateStore consts.KsctlStore `json:"preferedStateStore"` +} + +func LoadConfig(c *Config) (errC error) { + + configFile, err := locateConfig() + if err != nil { + return err + } + + file, err := os.Open(configFile) + if err != nil { + if os.IsNotExist(err) { + // NOTE: writing default config + *c = Config{ + PreferedStateStore: consts.StoreLocal, + } + return SaveConfig(c) + } + return fmt.Errorf("failed to open file %s: %v", configFile, err) + } + defer file.Close() + + return json.NewDecoder(file).Decode(c) +} + +func locateConfig() (fileLoc string, err error) { + homeDir, err := os.UserHomeDir() + if err != nil { + return "", err + } + + configDir := filepath.Join(homeDir, ".config", "ksctl") + configFile := filepath.Join(configDir, "config.json") + if _, err := os.Stat(configDir); os.IsNotExist(err) { + if err := os.MkdirAll(configDir, 0755); err != nil { + return configFile, fmt.Errorf("failed to create directory %s: %v", configDir, err) + } + } + return configFile, nil +} + +func SaveConfig(c *Config) error { + configFile, err := locateConfig() + if err != nil { + return err + } + + file, err := os.Create(configFile) + if err != nil { + return fmt.Errorf("failed to create file %s: %v", configFile, err) + } + defer file.Close() + + return json.NewEncoder(file).Encode(c) +} diff --git a/pkg/config/creds.go b/pkg/config/creds.go new file mode 100644 index 0000000..69acf2b --- /dev/null +++ b/pkg/config/creds.go @@ -0,0 +1,121 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/ksctl/ksctl/v2/pkg/consts" + ksctlErrors "github.com/ksctl/ksctl/v2/pkg/errors" + "github.com/ksctl/ksctl/v2/pkg/statefile" +) + +func locateCreds(s, prefix string) (fileLoc string, err error) { + if len(s) == 0 { + return "", fmt.Errorf("sku is empty") + } + + homeDir, err := os.UserHomeDir() + if err != nil { + return "", err + } + + configDir := filepath.Join(homeDir, ".config", "ksctl", "creds") + configFile := filepath.Join(configDir, prefix+s+".json") + if _, err := os.Stat(configDir); os.IsNotExist(err) { + if err := os.MkdirAll(configDir, 0755); err != nil { + return configFile, fmt.Errorf("failed to create directory %s: %v", configDir, err) + } + } + return configFile, nil +} + +func SaveStorageCreds[T statefile.CredentialsMongodb](c *T, s consts.KsctlStore) error { + credsFile, err := locateCreds(string(s), "s-") + if err != nil { + return err + } + + file, err := os.Create(credsFile) + if err != nil { + return fmt.Errorf("failed to create file %s: %v", credsFile, err) + } + defer file.Close() + + return json.NewEncoder(file).Encode(c) +} + +func LoadStorageCreds[T statefile.CredentialsMongodb](c *T, s consts.KsctlStore) (errC error) { + credsFile, err := locateCreds(string(s), "s-") + if err != nil { + return err + } + + file, err := os.Open(credsFile) + if err != nil { + if os.IsNotExist(err) { + return ksctlErrors.WrapErrorf( + ksctlErrors.ErrNilCredentials, + "credentials for storage driver %s not found", + s, + ) + } + return fmt.Errorf("failed to open file %s: %v", credsFile, err) + } + defer file.Close() + + return json.NewDecoder(file).Decode(c) +} + +func SaveCloudCreds[T statefile.CredentialsAws | statefile.CredentialsAzure](c *T, s consts.KsctlCloud) error { + credsFile, err := locateCreds(string(s), "c-") + if err != nil { + return err + } + + file, err := os.Create(credsFile) + if err != nil { + return fmt.Errorf("failed to create file %s: %v", credsFile, err) + } + defer file.Close() + + return json.NewEncoder(file).Encode(c) +} + +func LoadCloudCreds[T statefile.CredentialsAws | statefile.CredentialsAzure](c *T, s consts.KsctlCloud) (errC error) { + credsFile, err := locateCreds(string(s), "c-") + if err != nil { + return err + } + + file, err := os.Open(credsFile) + if err != nil { + if os.IsNotExist(err) { + return ksctlErrors.WrapErrorf( + ksctlErrors.ErrNilCredentials, + "credentials for cloud %s not found", + s, + ) + } + + return fmt.Errorf("failed to open file %s: %v", credsFile, err) + } + defer file.Close() + + return json.NewDecoder(file).Decode(c) +} diff --git a/pkg/config/vars.go b/pkg/config/vars.go new file mode 100644 index 0000000..4b2a237 --- /dev/null +++ b/pkg/config/vars.go @@ -0,0 +1,24 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config + +import "time" + +// change this using ldflags +var ( + Version string = "v0.0.1-dev" + KsctlCoreVer string = "v0.0.1-dev" + BuildDate string = time.Now().UTC().String() +) diff --git a/logger/general_logging.go b/pkg/logger/general_logging.go similarity index 59% rename from logger/general_logging.go rename to pkg/logger/general_logging.go index 0957c42..1da5bdf 100644 --- a/logger/general_logging.go +++ b/pkg/logger/general_logging.go @@ -1,8 +1,21 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package logger import ( "context" - "encoding/json" "fmt" "io" "math" @@ -12,12 +25,10 @@ import ( box "github.com/Delta456/box-cli-maker/v2" "github.com/fatih/color" - cloudController "github.com/ksctl/ksctl/pkg/types/controllers/cloud" + "github.com/ksctl/ksctl/v2/pkg/logger" "github.com/rodaine/table" "time" - - "github.com/ksctl/ksctl/pkg/helpers/consts" ) type GeneralLog struct { @@ -26,11 +37,11 @@ type GeneralLog struct { level uint } -func (l *GeneralLog) ExternalLogHandler(ctx context.Context, msgType consts.CustomExternalLogLevel, message string) { +func (l *GeneralLog) ExternalLogHandler(ctx context.Context, msgType logger.CustomExternalLogLevel, message string) { l.log(false, false, ctx, msgType, message) } -func (l *GeneralLog) ExternalLogHandlerf(ctx context.Context, msgType consts.CustomExternalLogLevel, format string, args ...interface{}) { +func (l *GeneralLog) ExternalLogHandlerf(ctx context.Context, msgType logger.CustomExternalLogLevel, format string, args ...interface{}) { l.log(false, false, ctx, msgType, format, args...) } @@ -45,7 +56,7 @@ func formGroups(disableContext bool, ctx context.Context, v ...any) (format stri }() if !disableContext { _format.WriteString(color.HiBlackString("component=") + "%s ") - vals = append(vals, getPackageName(ctx)) + vals = append(vals, color.HiBlackString(getPackageName(ctx))) } i := 0 for ; i+1 < len(v); i += 2 { @@ -69,8 +80,8 @@ func formGroups(disableContext bool, ctx context.Context, v ...any) (format stri return } -func isLogEnabled(level uint, msgType consts.CustomExternalLogLevel) bool { - if msgType == consts.LogDebug { +func isLogEnabled(level uint, msgType logger.CustomExternalLogLevel) bool { + if msgType == logger.LogDebug { return level >= 9 } return true @@ -80,7 +91,7 @@ func (l *GeneralLog) logErrorf(disableContext bool, disablePrefix bool, ctx cont l.mu.Lock() defer l.mu.Unlock() if !disablePrefix { - prefix := fmt.Sprintf("%s%s ", getTime(l.level), consts.LogError) + prefix := fmt.Sprintf("%s%s ", getTime(l.level), logger.LogError) msg = prefix + msg } format, _args := formGroups(disableContext, ctx, args...) @@ -95,7 +106,7 @@ func (l *GeneralLog) logErrorf(disableContext bool, disablePrefix bool, ctx cont return errMsg } -func (l *GeneralLog) log(disableContext bool, useGroupFormer bool, ctx context.Context, msgType consts.CustomExternalLogLevel, msg string, args ...any) { +func (l *GeneralLog) log(disableContext bool, useGroupFormer bool, ctx context.Context, msgType logger.CustomExternalLogLevel, msg string, args ...any) { if !isLogEnabled(l.level, msgType) { return } @@ -104,17 +115,32 @@ func (l *GeneralLog) log(disableContext bool, useGroupFormer bool, ctx context.C prefix := fmt.Sprintf("%s%s ", getTime(l.level), msgType) if useGroupFormer { - msg = prefix + msg + msgColored := "" + switch msgType { + case logger.LogSuccess: + msgColored = color.HiGreenString(msg) + case logger.LogWarning: + msgColored = color.HiYellowString(msg) + case logger.LogDebug: + msgColored = color.HiMagentaString(msg) + case logger.LogNote: + msgColored = color.HiCyanString(msg) + case logger.LogInfo: + msgColored = color.HiBlueString(msg) + case logger.LogError: + msgColored = color.HiRedString(msg) + } + msg = prefix + msgColored format, _args := formGroups(disableContext, ctx, args...) if _args == nil { - if disableContext && msgType == consts.LogError { + if disableContext && msgType == logger.LogError { l.boxBox( "Error", msg+" "+format, "Red") return } fmt.Fprint(l.writter, msg+" "+format) } else { - if disableContext && msgType == consts.LogError { + if disableContext && msgType == logger.LogError { l.boxBox( "Error", fmt.Sprintf(msg+" "+format, _args...), "Red") return @@ -122,7 +148,7 @@ func (l *GeneralLog) log(disableContext bool, useGroupFormer bool, ctx context.C fmt.Fprintf(l.writter, msg+" "+format, _args...) } } else { - args = append([]any{getPackageName(ctx)}, args...) + args = append([]any{color.HiBlackString(getPackageName(ctx))}, args...) fmt.Fprintf(l.writter, prefix+color.HiBlackString("component=")+"%s "+msg+"\n", args...) } } @@ -148,23 +174,23 @@ func NewLogger(verbose int, out io.Writer) *GeneralLog { } func (l *GeneralLog) Print(ctx context.Context, msg string, args ...any) { - l.log(false, true, ctx, consts.LogInfo, msg, args...) + l.log(false, true, ctx, logger.LogInfo, msg, args...) } func (l *GeneralLog) Success(ctx context.Context, msg string, args ...any) { - l.log(false, true, ctx, consts.LogSuccess, msg, args...) + l.log(false, true, ctx, logger.LogSuccess, msg, args...) } func (l *GeneralLog) Note(ctx context.Context, msg string, args ...any) { - l.log(false, true, ctx, consts.LogNote, msg, args...) + l.log(false, true, ctx, logger.LogNote, msg, args...) } func (l *GeneralLog) Debug(ctx context.Context, msg string, args ...any) { - l.log(false, true, ctx, consts.LogDebug, msg, args...) + l.log(false, true, ctx, logger.LogDebug, msg, args...) } func (l *GeneralLog) Error(msg string, args ...any) { - l.log(true, true, nil, consts.LogError, msg, args...) + l.log(true, true, nil, logger.LogError, msg, args...) } func (l *GeneralLog) NewError(ctx context.Context, msg string, args ...any) error { @@ -172,39 +198,34 @@ func (l *GeneralLog) NewError(ctx context.Context, msg string, args ...any) erro } func (l *GeneralLog) Warn(ctx context.Context, msg string, args ...any) { - l.log(false, true, ctx, consts.LogWarning, msg, args...) + l.log(false, true, ctx, logger.LogWarning, msg, args...) } -func (l *GeneralLog) Table(ctx context.Context, op consts.LogClusterDetail, data []cloudController.AllClusterData) { - headerFmt := color.New(color.FgGreen, color.Underline).SprintfFunc() - columnFmt := color.New(color.FgYellow).SprintfFunc() - - if op == consts.LoggingGetClusters { - tbl := table.New("ClusterName", "Region", "ClusterType", "CloudProvider", "BootStrap", "WorkerPlaneNodes", "ControlPlaneNodes", "EtcdNodes", "CloudManagedNodes") - tbl.WithHeaderFormatter(headerFmt).WithFirstColumnFormatter(columnFmt) +func (l *GeneralLog) Table(ctx context.Context, headers []string, data [][]string) { + headerFmt := color.New(color.FgHiBlack, color.Underline).SprintfFunc() + columnFmt := color.New(color.FgHiGreen).SprintfFunc() - for _, row := range data { - tbl.AddRow(row.Name, - row.Region, - string(row.ClusterType), - string(row.CloudProvider), - string(row.K8sDistro), - row.NoWP, row.NoCP, row.NoDS, row.NoMgt, - ) + var dataToPrint [][]interface{} = make([][]interface{}, 0, len(data)) + for _, v := range data { + var row []interface{} + for _, vv := range v { + row = append(row, vv) } + dataToPrint = append(dataToPrint, row) + } - println() - tbl.Print() - println() - println() - } else if op == consts.LoggingInfoCluster { - a, err := json.MarshalIndent(data[0], "", " ") - if err != nil { - panic(err) - } - l.Box(ctx, "Cluster Data", string(a)) + var header []interface{} + for _, v := range headers { + header = append(header, v) } + tbl := table.New(header...) + tbl.WithHeaderFormatter(headerFmt).WithFirstColumnFormatter(columnFmt) + + for _, row := range dataToPrint { + tbl.AddRow(row...) + } + tbl.Print() } func (l *GeneralLog) boxBox(title, lines string, color string) { @@ -230,5 +251,5 @@ func (l *GeneralLog) Box(ctx context.Context, title string, lines string) { l.Debug(ctx, "PostUpdate Box", "title", len(title), "lines", len(lines)) - l.boxBox(title, lines, "Yellow") + l.boxBox(title, lines, "Green") } diff --git a/logger/logger_test.go b/pkg/logger/logger_test.go similarity index 67% rename from logger/logger_test.go rename to pkg/logger/logger_test.go index fe76c1a..cd4d9c4 100644 --- a/logger/logger_test.go +++ b/pkg/logger/logger_test.go @@ -1,3 +1,17 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package logger import ( @@ -7,13 +21,11 @@ import ( "strings" "testing" - "github.com/ksctl/ksctl/pkg/helpers/consts" - "github.com/ksctl/ksctl/pkg/types" - "github.com/ksctl/ksctl/pkg/types/controllers/cloud" + "github.com/ksctl/ksctl/v2/pkg/logger" ) var ( - gL types.LoggerFactory + gL logger.Logger dummyCtx = context.TODO() ) @@ -62,20 +74,6 @@ func TestPrinters(t *testing.T) { gL.Print(dummyCtx, "FAKE", "type", "print") }) - t.Run("Table", func(t *testing.T) { - gL.Table(dummyCtx, - consts.LoggingGetClusters, - []cloud.AllClusterData{ - { - Name: "fake-demo", - CloudProvider: "fake", - Region: "fake-reg", - }, - }) - - gL.Table(dummyCtx, consts.LoggingGetClusters, nil) - }) - t.Run("Box", func(t *testing.T) { gL.Box(dummyCtx, "Abcd", "1") gL.Box(dummyCtx, "Abcddedefe", "1") @@ -84,7 +82,7 @@ func TestPrinters(t *testing.T) { }) t.Run("external", func(t *testing.T) { - gL.ExternalLogHandler(dummyCtx, consts.LogSuccess, "cdcc") - gL.ExternalLogHandlerf(dummyCtx, consts.LogSuccess, "cdcc", "Reason", fmt.Errorf("Error")) + gL.ExternalLogHandler(dummyCtx, logger.LogSuccess, "cdcc") + gL.ExternalLogHandlerf(dummyCtx, logger.LogSuccess, "cdcc", "Reason", fmt.Errorf("Error")) }) } diff --git a/pkg/logger/logging.go b/pkg/logger/logging.go new file mode 100644 index 0000000..68067d9 --- /dev/null +++ b/pkg/logger/logging.go @@ -0,0 +1,68 @@ +// Copyright 2025 Ksctl Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logger + +import ( + "context" + "strings" + + "github.com/ksctl/ksctl/v2/pkg/consts" + "github.com/ksctl/ksctl/v2/pkg/utilities" +) + +func getPackageName(ctx context.Context) string { + if v, ok := ctx.Value(consts.KsctlModuleNameKey).(string); ok { + return v + } else { + return "!!NOT_SET" + } +} + +const ( + limitCol int = 80 +) + +func addLineTerminationForLongStrings(str string) string { + + //arr with endline split + arrStr := strings.Split(str, "\n") + + var helper func(string) string + + helper = func(_str string) string { + + if len(_str) <= limitCol { + return _str + } + + x := string(utilities.DeepCopySlice([]byte(_str[:limitCol]))) + y := string(utilities.DeepCopySlice([]byte(helper(_str[limitCol:])))) + + // ks + // ^^ + if x[len(x)-1] != ' ' && y[0] != ' ' { + x += "-" + } + + _new := x + "\n" + y + return _new + } + + for idx, line := range arrStr { + arrStr[idx] = helper(line) + } + + return strings.Join(arrStr, "\n") +} diff --git a/scripts/builder-mock.ps1 b/scripts/builder-mock.ps1 deleted file mode 100644 index 30cbef5..0000000 --- a/scripts/builder-mock.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -#Requires -Version 5 - -$erroractionpreference = 'stop' # quit if anything goes wrong - -if (($PSVersionTable.PSVersion.Major) -lt 5) { - Write-Output "PowerShell 5 or later is required to run Ksctl." - Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell" - break -} - -Write-Host "Welcome to Installation" -ForegroundColor DarkGreen - -$env:GOOS = 'windows' -$env:GOARCH = 'amd64' -Set-Location .\.. - -Set-Location .\cli\ - -go build -tags testing_civo,testing_azure,testing_aws,testing_local -v -o ksctl.exe . - -#Move-Item ksctl.exe $env:USERPROFILE\.ksctl\ - -$localAppDataPath = $env:LOCALAPPDATA -$ksctl = Join-Path "$localAppDataPath" 'ksctl' - -Write-Information "Path of AppDataPath $ksctl" - -New-Item -ItemType Directory -Force -Path $ksctl | Out-Null - -Copy-Item ksctl.exe -Destination "$ksctl/" -Force | Out-Null - -Remove-Item ksctl.exe - -Set-Location ..\.. | Out-Null - -Write-Host "[V] Finished Installation" -ForegroundColor DarkGreen -Write-Host "" -Write-Host "To run ksctl globally, please follow these steps:" -ForegroundColor Cyan -Write-Host "" -Write-Host " 1. Run the following command as administrator: ``setx PATH `"`$env:path;$ksctl`" -m``" diff --git a/scripts/builder-mock.sh b/scripts/builder-mock.sh deleted file mode 100755 index ba9c4d8..0000000 --- a/scripts/builder-mock.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -cd .. || echo -e "\033[1;31mUnable to cd into ksctl root\033[0m\n" - -# Get the binary from the source code -cd cli || echo -e "\033[1;31mPath couldn't be found\033[0m\n" -# Check if sudo access -go get -d -go build -tags testing_civo,testing_azure,testing_aws,testing_local -v -o ksctl . -chmod +x ksctl - -sudo mv -v ksctl /usr/local/bin/ksctl - -echo -e "\033[1;32mINSTALL COMPLETE\033[0m\n" - -cd - || echo -e "\033[1;31mFailed to move to previous directory\033[0m\n" diff --git a/scripts/builder.ps1 b/scripts/builder.ps1 deleted file mode 100644 index 60039b7..0000000 --- a/scripts/builder.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -#Requires -Version 5 - -$erroractionpreference = 'stop' # quit if anything goes wrong - -if (($PSVersionTable.PSVersion.Major) -lt 5) { - Write-Output "PowerShell 5 or later is required to run Ksctl." - Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell" - break -} - -Write-Host "Welcome to Installation" -ForegroundColor DarkGreen - -$env:GOOS = 'windows' -$env:GOARCH = 'amd64' -Set-Location .\.. - -Set-Location .\cli\ - -go build -v -o ksctl.exe . - -#Move-Item ksctl.exe $env:USERPROFILE\.ksctl\ - -$localAppDataPath = $env:LOCALAPPDATA -$ksctl = Join-Path "$localAppDataPath" 'ksctl' - -Write-Information "Path of AppDataPath $ksctl" - -New-Item -ItemType Directory -Force -Path $ksctl | Out-Null - -Copy-Item ksctl.exe -Destination "$ksctl/" -Force | Out-Null - -Remove-Item ksctl.exe - -Set-Location ..\.. | Out-Null - -Write-Host "[V] Finished Installation" -ForegroundColor DarkGreen -Write-Host "" -Write-Host "To run ksctl globally, please follow these steps:" -ForegroundColor Cyan -Write-Host "" -Write-Host " 1. Run the following command as administrator: ``setx PATH `"`$env:path;$ksctl`" -m``" diff --git a/scripts/builder.sh b/scripts/builder.sh index 856c2ec..30ba5b7 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -2,9 +2,6 @@ cd .. || echo -e "\033[1;31mUnable to cd into ksctl root\033[0m\n" -# Get the binary from the source code -cd cli || echo -e "\033[1;31mPath couldn't be found\033[0m\n" -# Check if sudo access go get -d go build -v -o ksctl . chmod +x ksctl @@ -12,5 +9,3 @@ chmod +x ksctl sudo mv -v ksctl /usr/local/bin/ksctl echo -e "\033[1;32mINSTALL COMPLETE\033[0m\n" - -cd - || echo -e "\033[1;31mFailed to move to previous directory\033[0m\n"