├── .ci-operator.yaml ├── .dockerignore ├── .github ├── dependabot.yml └── workflows │ ├── create_release.yml │ └── validate_goreleaser.yml ├── .gitignore ├── .golangci.yaml ├── .goreleaser.yml ├── Dockerfile ├── LICENSE ├── Makefile ├── OWNERS ├── README.md ├── cmd ├── aao │ ├── cmd.go │ ├── pool.go │ └── pool_test.go ├── account │ ├── clean-velero-snapshots.go │ ├── clean-velero-snapshots_test.go │ ├── cli.go │ ├── cmd.go │ ├── console.go │ ├── console_test.go │ ├── generate-secret.go │ ├── generate-secret_test.go │ ├── get │ │ ├── account-claim.go │ │ ├── account-claim_test.go │ │ ├── account.go │ │ ├── account_test.go │ │ ├── cmd.go │ │ ├── id.go │ │ ├── id_test.go │ │ ├── legal-entity.go │ │ ├── legal-entity_test.go │ │ ├── secrets.go │ │ └── secrets_test.go │ ├── list │ │ ├── account-claim.go │ │ ├── account-claim_test.go │ │ ├── account.go │ │ ├── account_test.go │ │ └── cmd.go │ ├── mgmt │ │ ├── account-assign.go │ │ ├── account-assign_test.go │ │ ├── account-iam.go │ │ ├── account-list.go │ │ ├── account-list_test.go │ │ ├── account-unassign.go │ │ ├── account-unassign_test.go │ │ └── cmd.go │ ├── reset.go │ ├── reset_test.go │ ├── rotate-secret.go │ ├── rotate-secret_test.go │ ├── servicequotas │ │ ├── cmd.go │ │ └── describe.go │ ├── set.go │ ├── set_test.go │ ├── verify-secrets.go │ └── verify-secrets_test.go ├── alerts │ ├── cmd.go │ ├── list_alerts.go │ ├── silence │ │ ├── add_silence.go │ │ ├── clear_silence.go │ │ ├── cmd.go │ │ ├── list_silence.go │ │ └── silence_org.go │ └── utils │ │ ├── alert.go │ │ ├── silence.go │ │ └── utils.go ├── capability │ ├── add.go │ ├── capability_test.go │ ├── cmd.go │ └── remove.go ├── cloudtrail │ ├── cloudtrail_test.go │ ├── cmd.go │ ├── permission-denied.go │ ├── pkg │ │ ├── aws │ │ │ ├── aws.go │ │ │ ├── aws_test.go │ │ │ └── testdata │ │ │ │ └── valid_event.json │ │ ├── util.go │ │ └── util_test.go │ └── write-events.go ├── cluster │ ├── access │ │ ├── access.go │ │ ├── access_test.go │ │ ├── cleanup.go │ │ ├── cleanup_test.go │ │ ├── common.go │ │ └── common_test.go │ ├── checkbanneduser.go │ ├── cmd.go │ ├── context.go │ ├── context_test.go │ ├── cpd.go │ ├── detachstuckvolume.go │ ├── etcd_health.go │ ├── etcd_health_test.go │ ├── etcd_replace.go │ ├── etcd_replace_test.go │ ├── from_infra_id.go │ ├── from_infra_id_test.go │ ├── health.go │ ├── hypershift_info.go │ ├── loggingcheck.go │ ├── org_id.go │ ├── owner.go │ ├── resize │ │ ├── cmd.go │ │ ├── controlplane_node.go │ │ ├── infra_node.go │ │ └── infra_node_test.go │ ├── resync.go │ ├── sre_operators │ │ ├── describeCmd.go │ │ ├── listCmd.go │ │ └── rootCmd.go │ ├── ssh │ │ ├── key.go │ │ ├── key_test.go │ │ └── ssh.go │ ├── support │ │ ├── cmd.go │ │ ├── common.go │ │ ├── delete.go │ │ ├── delete_test.go │ │ ├── post.go │ │ ├── post_test.go │ │ ├── sdkmock.go │ │ └── status.go │ ├── transferowner.go │ ├── transferowner_test.go │ ├── validatepullsecret.go │ ├── validatepullsecret_test.go │ ├── validatepullsecretext.go │ └── validatepullsecretext_test.go ├── cmd.go ├── common │ ├── const.go │ └── helpers.go ├── cost │ ├── cost.go │ ├── create.go │ ├── create_test.go │ ├── get.go │ ├── get_test.go │ ├── list.go │ ├── list_test.go │ ├── reconcile.go │ └── reconcile_test.go ├── dynatrace │ ├── cluster.go │ ├── dashCmd.go │ ├── dtquery.go │ ├── dtquery_test.go │ ├── hcpGatherLogsCmd.go │ ├── hcpGatherLogsCmd_test.go │ ├── logsCmd.go │ ├── requests.go │ ├── rootCmd.go │ ├── urlCmd.go │ └── vault.go ├── env │ ├── env.go │ └── kube-ps1.sh ├── getoutput │ └── getoutput.go ├── hcp │ ├── cmd.go │ └── mustgather │ │ ├── mustGather.go │ │ └── mustGather_test.go ├── hive │ ├── clusterdeployment │ │ ├── cmd.go │ │ ├── list.go │ │ ├── list_test.go │ │ ├── listresources.go │ │ ├── listresources_test.go │ │ └── mock │ │ │ ├── k8s │ │ │ └── client.go │ │ │ └── printer │ │ │ └── printer.go │ ├── clustersync.go │ ├── clustersync_test.go │ └── cmd.go ├── iampermissions │ ├── cmd.go │ ├── diff.go │ ├── diff_test.go │ ├── get.go │ ├── get_test.go │ ├── save.go │ └── save_test.go ├── jira │ ├── cmd.go │ └── quick-task.go ├── jumphost │ ├── cmd.go │ ├── cmd_test.go │ ├── create.go │ ├── create_test.go │ ├── delete.go │ └── delete_test.go ├── mc │ ├── cmd.go │ └── list.go ├── network │ ├── aws.go │ ├── aws_test.go │ ├── cmd.go │ ├── gcp.go │ ├── gcp_test.go │ ├── packet-capture.go │ ├── packet-capture_test.go │ ├── verification.go │ └── verification_test.go ├── org │ ├── aws-accounts.go │ ├── clusters.go │ ├── clusters_test.go │ ├── cmd.go │ ├── common.go │ ├── common_test.go │ ├── context.go │ ├── context_test.go │ ├── current.go │ ├── current_test.go │ ├── customers.go │ ├── customers_test.go │ ├── describe.go │ ├── describe_test.go │ ├── get.go │ ├── get_test.go │ ├── labels.go │ ├── labels_test.go │ ├── testdata │ │ ├── jsonClusters.txt │ │ └── tableClusters.txt │ └── users.go ├── promote │ ├── cmd.go │ ├── dynatrace │ │ ├── dt_app_interface.go │ │ ├── dt_app_interface_test.go │ │ ├── dt_git_cmd.go │ │ ├── dt_git_cmd_test.go │ │ ├── dt_service_repo.go │ │ ├── dt_service_repo_test.go │ │ ├── dt_utils.go │ │ ├── dynatrace.go │ │ ├── dynatrace_config.go │ │ ├── dynatrace_config_test.go │ │ ├── dynatrace_suite_test.go │ │ ├── tf_file_update.go │ │ ├── tf_file_update_test.go │ │ └── utils_test.go │ ├── git │ │ ├── app_interface.go │ │ ├── app_interface_test.go │ │ ├── git_cmd.go │ │ └── service_repo.go │ ├── iexec │ │ └── iexec.go │ ├── pko │ │ └── pko.go │ └── saas │ │ ├── saas.go │ │ ├── utils.go │ │ └── utils_test.go ├── servicelog │ ├── cmd.go │ ├── common.go │ ├── common_test.go │ ├── list.go │ ├── post.go │ └── post_test.go ├── setup │ ├── setup.go │ └── setup_test.go ├── swarm │ ├── cmd.go │ └── secondary.go ├── upgrade.go └── version.go ├── docs ├── README.md ├── osdctl.md ├── osdctl_aao.md ├── osdctl_aao_pool.md ├── osdctl_account.md ├── osdctl_account_clean-velero-snapshots.md ├── osdctl_account_cli.md ├── osdctl_account_console.md ├── osdctl_account_generate-secret.md ├── osdctl_account_get.md ├── osdctl_account_get_account-claim.md ├── osdctl_account_get_account.md ├── osdctl_account_get_aws-account.md ├── osdctl_account_get_legal-entity.md ├── osdctl_account_get_secrets.md ├── osdctl_account_list.md ├── osdctl_account_list_account-claim.md ├── osdctl_account_list_account.md ├── osdctl_account_mgmt.md ├── osdctl_account_mgmt_assign.md ├── osdctl_account_mgmt_iam.md ├── osdctl_account_mgmt_list.md ├── osdctl_account_mgmt_unassign.md ├── osdctl_account_reset.md ├── osdctl_account_rotate-secret.md ├── osdctl_account_servicequotas.md ├── osdctl_account_servicequotas_describe.md ├── osdctl_account_set.md ├── osdctl_account_verify-secrets.md ├── osdctl_alert.md ├── osdctl_alert_list.md ├── osdctl_alert_silence.md ├── osdctl_alert_silence_add.md ├── osdctl_alert_silence_expire.md ├── osdctl_alert_silence_list.md ├── osdctl_alert_silence_org.md ├── osdctl_cloudtrail.md ├── osdctl_cloudtrail_permission-denied-events.md ├── osdctl_cloudtrail_write-events.md ├── osdctl_cluster.md ├── osdctl_cluster_break-glass.md ├── osdctl_cluster_break-glass_cleanup.md ├── osdctl_cluster_check-banned-user.md ├── osdctl_cluster_context.md ├── osdctl_cluster_cpd.md ├── osdctl_cluster_detach-stuck-volume.md ├── osdctl_cluster_etcd-health-check.md ├── osdctl_cluster_etcd-member-replace.md ├── osdctl_cluster_from-infra-id.md ├── osdctl_cluster_health.md ├── osdctl_cluster_hypershift-info.md ├── osdctl_cluster_logging-check.md ├── osdctl_cluster_orgId.md ├── osdctl_cluster_owner.md ├── osdctl_cluster_resize.md ├── osdctl_cluster_resize_control-plane.md ├── osdctl_cluster_resize_infra.md ├── osdctl_cluster_resync.md ├── osdctl_cluster_sre-operators.md ├── osdctl_cluster_sre-operators_describe.md ├── osdctl_cluster_sre-operators_list.md ├── osdctl_cluster_ssh.md ├── osdctl_cluster_ssh_key.md ├── osdctl_cluster_support.md ├── osdctl_cluster_support_delete.md ├── osdctl_cluster_support_post.md ├── osdctl_cluster_support_status.md ├── osdctl_cluster_transfer-owner.md ├── osdctl_cluster_validate-pull-secret-ext.md ├── osdctl_cluster_validate-pull-secret.md ├── osdctl_cost.md ├── osdctl_cost_create.md ├── osdctl_cost_get.md ├── osdctl_cost_list.md ├── osdctl_cost_reconcile.md ├── osdctl_dynatrace.md ├── osdctl_dynatrace_dashboard.md ├── osdctl_dynatrace_gather-logs.md ├── osdctl_dynatrace_logs.md ├── osdctl_dynatrace_url.md ├── osdctl_env.md ├── osdctl_hcp.md ├── osdctl_hcp_must-gather.md ├── osdctl_hive.md ├── osdctl_hive_clusterdeployment.md ├── osdctl_hive_clusterdeployment_list.md ├── osdctl_hive_clusterdeployment_listresources.md ├── osdctl_hive_clustersync-failures.md ├── osdctl_iampermissions.md ├── osdctl_iampermissions_diff.md ├── osdctl_iampermissions_get.md ├── osdctl_iampermissions_save.md ├── osdctl_jira.md ├── osdctl_jira_quick-task.md ├── osdctl_jumphost.md ├── osdctl_jumphost_create.md ├── osdctl_jumphost_delete.md ├── osdctl_mc.md ├── osdctl_mc_list.md ├── osdctl_network.md ├── osdctl_network_packet-capture.md ├── osdctl_network_verify-egress.md ├── osdctl_org.md ├── osdctl_org_aws-accounts.md ├── osdctl_org_clusters.md ├── osdctl_org_context.md ├── osdctl_org_current.md ├── osdctl_org_customers.md ├── osdctl_org_describe.md ├── osdctl_org_get.md ├── osdctl_org_labels.md ├── osdctl_org_users.md ├── osdctl_promote.md ├── osdctl_promote_dynatrace.md ├── osdctl_promote_package.md ├── osdctl_promote_saas.md ├── osdctl_servicelog.md ├── osdctl_servicelog_list.md ├── osdctl_servicelog_post.md ├── osdctl_setup.md ├── osdctl_swarm.md ├── osdctl_swarm_secondary.md ├── osdctl_upgrade.md └── osdctl_version.md ├── go.mod ├── go.sum ├── hack └── example_template.json ├── internal ├── servicelog │ ├── clustersFile.go │ ├── reply.go │ └── template.go ├── support │ └── template.go └── utils │ ├── errors.go │ ├── file.go │ ├── file_test.go │ ├── globalflags │ └── globalflags.go │ ├── network.go │ ├── network_test.go │ └── testdata │ └── a-folder-that-exists │ └── file.txt ├── main.go ├── pkg ├── docgen │ └── docgen.go ├── envConfig │ └── config.go ├── graphviz │ └── graphviz.go ├── k8s │ ├── account.go │ ├── account_test.go │ ├── client.go │ └── fakeClient.go ├── osdCloud │ ├── aws.go │ ├── gcp.go │ └── interfaces.go ├── osdctlCommand │ └── command.go ├── osdctlConfig │ └── osdctlConfig.go ├── policies │ ├── aws.go │ ├── cloudspec.go │ ├── gcp.go │ ├── gcp_models.go │ └── policy.go ├── printer │ ├── print_flags.go │ ├── printer.go │ └── printer_test.go ├── provider │ ├── aws │ │ ├── client.go │ │ ├── iam.go │ │ ├── iam_test.go │ │ ├── mock │ │ │ └── client.go │ │ ├── s3.go │ │ ├── s3_test.go │ │ ├── sts.go │ │ └── sts_test.go │ └── pagerduty │ │ ├── mocks │ │ └── pagerduty_mock.go │ │ ├── pagerduty.go │ │ ├── pagerduty_suite_test.go │ │ └── pagerduty_test.go └── utils │ ├── delay_tracker.go │ ├── jira.go │ ├── network.go │ ├── ocm.go │ ├── ocm_test.go │ ├── print.go │ ├── utils.go │ ├── utils_test.go │ └── version.go ├── scripts └── verify-docs.sh └── utils └── docgen └── main.go /.ci-operator.yaml: -------------------------------------------------------------------------------- 1 | build_root_image: 2 | name: boilerplate 3 | namespace: openshift 4 | tag: image-v7.2.0 5 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | LICENSE 3 | bin/ 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'gomod' 4 | directory: '/' 5 | labels: 6 | - "ok-to-test" 7 | allow: 8 | - dependency-name: "github.com/openshift/osd-network-verifier" 9 | - dependency-name: "github.com/openshift/backplane-cli" 10 | schedule: 11 | interval: 'daily' 12 | -------------------------------------------------------------------------------- /.github/workflows/create_release.yml: -------------------------------------------------------------------------------- 1 | # Create a project release automatically on tag creation 2 | 3 | name: create_release_on_tag 4 | 5 | on: 6 | push: 7 | tags: 8 | - "*" # triggers only if push new tag version, like `0.8.4` 9 | 10 | jobs: 11 | build: 12 | name: create_release_on_tag 13 | runs-on: ubuntu-latest 14 | permissions: 15 | repository-projects: write 16 | 17 | steps: 18 | - name: Check out code into the Go module directory 19 | uses: actions/checkout@v4.1.0 20 | with: 21 | fetch-depth: 0 # See: https://goreleaser.com/ci/actions/ 22 | 23 | - name: Set up Go 24 | uses: actions/setup-go@v4.1.0 25 | with: 26 | go-version: 1.21 27 | id: go 28 | 29 | - name: Run GoReleaser 30 | uses: goreleaser/goreleaser-action@v5.0.0 31 | with: 32 | distribution: goreleaser 33 | version: 'v1.21.2' 34 | args: release --clean 35 | env: 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 37 | 38 | -------------------------------------------------------------------------------- /.github/workflows/validate_goreleaser.yml: -------------------------------------------------------------------------------- 1 | # Validate the goReleaser configuration 2 | 3 | name: validate_goreleaser 4 | 5 | on: 6 | push: 7 | branches: 8 | - master 9 | pull_request: 10 | branches: 11 | - master 12 | 13 | jobs: 14 | validate_goreleaser: 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Check out code into the Go module directory 19 | uses: actions/checkout@v4.1.0 20 | with: 21 | fetch-depth: 0 # See: https://goreleaser.com/ci/actions/ 22 | 23 | - name: Set up Go 24 | uses: actions/setup-go@v4.1.0 25 | with: 26 | go-version: 1.21 27 | id: go 28 | 29 | - name: Run GoReleaser 30 | uses: goreleaser/goreleaser-action@v5.0.0 31 | with: 32 | distribution: goreleaser 33 | version: 'v1.21.2' 34 | args: check 35 | env: 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | bin/ 8 | osdctl 9 | # Test binary, built with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | 15 | # Dependency directories (remove the comment below to include it) 16 | # vendor/ 17 | 18 | # IDE 19 | .idea 20 | .vscode 21 | *.code-workspace 22 | 23 | # MacOS 24 | .DS_Store 25 | 26 | # goReleaser 27 | dist/ 28 | -------------------------------------------------------------------------------- /.golangci.yaml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | run: 3 | concurrency: 10 4 | linters: 5 | default: none 6 | enable: 7 | - errcheck 8 | - gosec 9 | - govet 10 | - ineffassign 11 | - misspell 12 | - staticcheck 13 | - unused 14 | settings: 15 | misspell: 16 | extra-words: 17 | - typo: openshit 18 | correction: OpenShift 19 | exclusions: 20 | generated: lax 21 | presets: 22 | - comments 23 | - common-false-positives 24 | - legacy 25 | - std-error-handling 26 | paths: 27 | - third_party/ 28 | - builtin/ 29 | - examples/ 30 | issues: 31 | max-issues-per-linter: 0 32 | max-same-issues: 0 33 | new-from-rev: 8d912e328ca7d7a640fc1c39d3fd9e365b6d5bf7 34 | formatters: 35 | exclusions: 36 | generated: lax 37 | paths: 38 | - third_party/ 39 | - builtin/ 40 | - examples/ 41 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | project_name: osdctl 3 | builds: 4 | - env: 5 | - CGO_ENABLED=0 6 | - "GO111MODULE=on" # make sure to use go modules 7 | - "GOFLAGS=-mod=readonly -trimpath" # trimpath helps with producing verifiable binaries 8 | goos: 9 | - linux 10 | - darwin 11 | goarch: 12 | - amd64 13 | - arm64 14 | ldflags: 15 | # the following line will inject the current git tag in the binary during the build process. 16 | # .Version are template variables that will be set during the GoReleaser run 17 | # The "-X" go flag injects the strings into the two global variables GitCommit and Version 18 | # See also: https://pkg.go.dev/cmd/link 19 | - -s 20 | - -w 21 | - -X github.com/openshift/osdctl/pkg/utils.Version={{.Version}} 22 | - "-extldflags=-zrelro" # binary hardening: For further explanation look here: https://www.redhat.com/en/blog/hardening-elf-binaries-using-relocation-read-only-relro 23 | - "-extldflags=-znow" 24 | 25 | archives: 26 | # https://goreleaser.com/deprecations/#archivesreplacements 27 | - name_template: >- 28 | {{ .ProjectName }}_ 29 | {{- .Version }}_ 30 | {{- title .Os }}_ 31 | {{- if eq .Arch "amd64" }}x86_64 32 | {{- else }}{{ .Arch }}{{ end}} 33 | 34 | checksum: 35 | name_template: 'sha256sum.txt' 36 | algorithm: sha256 37 | 38 | snapshot: 39 | version_template: "{{ .Tag }}-next" 40 | 41 | changelog: 42 | sort: asc 43 | filters: 44 | exclude: 45 | - '^test:' 46 | 47 | release: 48 | github: 49 | owner: "openshift" 50 | name: "osdctl" 51 | prerelease: auto 52 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.ci.openshift.org/openshift/release:golang-1.23 2 | 3 | WORKDIR /src 4 | COPY . . 5 | RUN make ci-build 6 | 7 | FROM registry.access.redhat.com/ubi8/ubi-minimal:latest 8 | LABEL io.openshift.managed.name="osdctl" \ 9 | io.openshift.managed.description="OSD related command line utilities" 10 | 11 | COPY --from=0 /src/dist/osdctl_linux_amd64_v1/osdctl /bin/osdctl 12 | 13 | ENTRYPOINT ["bin/osdctl"] 14 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - clcollins 3 | - dustman9000 4 | - fahlmant 5 | - iamkirkbater 6 | - sam-nguyen7 7 | - typeid 8 | - devppratik 9 | - Tafhim 10 | - joshbranham 11 | approvers: 12 | - clcollins 13 | - dustman9000 14 | - fahlmant 15 | - iamkirkbater 16 | - sam-nguyen7 17 | - typeid 18 | - devppratik 19 | - Tafhim 20 | - joshbranham 21 | maintainers: 22 | - clcollins 23 | - fahlmant 24 | -------------------------------------------------------------------------------- /cmd/aao/cmd.go: -------------------------------------------------------------------------------- 1 | package aao 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | "sigs.k8s.io/controller-runtime/pkg/client" 8 | ) 9 | 10 | // NewCmdAao implements the base aao command 11 | func NewCmdAao(client client.Client) *cobra.Command { 12 | aaoCmd := &cobra.Command{ 13 | Use: "aao", 14 | Short: "AWS Account Operator Debugging Utilities", 15 | Args: cobra.NoArgs, 16 | DisableAutoGenTag: true, 17 | } 18 | 19 | aaoCmd.AddCommand(newCmdPool(client)) 20 | 21 | return aaoCmd 22 | } 23 | 24 | func help(cmd *cobra.Command, _ []string) { 25 | err := cmd.Help() 26 | if err != nil { 27 | fmt.Println("Error while calling cmd.Help()", err.Error()) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cmd/account/clean-velero-snapshots_test.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | 10 | "k8s.io/cli-runtime/pkg/genericclioptions" 11 | ) 12 | 13 | func TestCleanVeleroSnapshotsCmdComplete(t *testing.T) { 14 | g := NewGomegaWithT(t) 15 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 16 | testCases := []struct { 17 | title string 18 | option *cleanVeleroSnapshotsOptions 19 | errExpected bool 20 | errContent string 21 | }{ 22 | { 23 | title: "succeed with empty credentials provided", 24 | option: &cleanVeleroSnapshotsOptions{ 25 | IOStreams: streams, 26 | accessKeyID: "", 27 | secretAccessKey: "", 28 | }, 29 | errExpected: false, 30 | }, 31 | { 32 | title: "provide accessKeyID but not secretAccessKey", 33 | option: &cleanVeleroSnapshotsOptions{ 34 | IOStreams: streams, 35 | accessKeyID: "foo", 36 | secretAccessKey: "", 37 | }, 38 | errExpected: true, 39 | errContent: cleanVeleroSnapshotsUsage, 40 | }, 41 | { 42 | title: "provide secretAccessKey but not accessKeyID", 43 | option: &cleanVeleroSnapshotsOptions{ 44 | IOStreams: streams, 45 | accessKeyID: "", 46 | secretAccessKey: "foo", 47 | }, 48 | errExpected: true, 49 | errContent: cleanVeleroSnapshotsUsage, 50 | }, 51 | } 52 | 53 | for _, tc := range testCases { 54 | t.Run(tc.title, func(t *testing.T) { 55 | cmd := newCmdCleanVeleroSnapshots(streams) 56 | err := tc.option.complete(cmd, nil) 57 | if tc.errExpected { 58 | g.Expect(err).Should(HaveOccurred()) 59 | if tc.errContent != "" { 60 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 61 | } 62 | } else { 63 | g.Expect(err).ShouldNot(HaveOccurred()) 64 | } 65 | }) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /cmd/account/cmd.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | 9 | "github.com/openshift/osdctl/cmd/account/get" 10 | "github.com/openshift/osdctl/cmd/account/list" 11 | "github.com/openshift/osdctl/cmd/account/mgmt" 12 | "github.com/openshift/osdctl/cmd/account/servicequotas" 13 | "github.com/openshift/osdctl/internal/utils/globalflags" 14 | "github.com/openshift/osdctl/pkg/k8s" 15 | ) 16 | 17 | // NewCmdAccount implements the base account command 18 | func NewCmdAccount(streams genericclioptions.IOStreams, client *k8s.LazyClient, globalOpts *globalflags.GlobalOptions) *cobra.Command { 19 | accountCmd := &cobra.Command{ 20 | Use: "account", 21 | Short: "AWS Account related utilities", 22 | Args: cobra.NoArgs, 23 | DisableAutoGenTag: true, 24 | } 25 | 26 | accountCmd.AddCommand(get.NewCmdGet(streams, client, globalOpts)) 27 | accountCmd.AddCommand(list.NewCmdList(streams, client, globalOpts)) 28 | accountCmd.AddCommand(servicequotas.NewCmdServiceQuotas(streams)) 29 | accountCmd.AddCommand(mgmt.NewCmdMgmt(streams, globalOpts)) 30 | accountCmd.AddCommand(newCmdReset(streams, client)) 31 | accountCmd.AddCommand(newCmdSet(streams, client)) 32 | accountCmd.AddCommand(newCmdConsole()) 33 | accountCmd.AddCommand(newCmdCli()) 34 | accountCmd.AddCommand(newCmdCleanVeleroSnapshots(streams)) 35 | accountCmd.AddCommand(newCmdVerifySecrets(streams, client)) 36 | accountCmd.AddCommand(newCmdRotateSecret(streams, client)) 37 | accountCmd.AddCommand(newCmdGenerateSecret(streams, client)) 38 | 39 | return accountCmd 40 | } 41 | 42 | func help(cmd *cobra.Command, _ []string) { 43 | err := cmd.Help() 44 | if err != nil { 45 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cmd/account/get/cmd.go: -------------------------------------------------------------------------------- 1 | package get 2 | 3 | import ( 4 | "fmt" 5 | "github.com/spf13/cobra" 6 | "sigs.k8s.io/controller-runtime/pkg/client" 7 | 8 | "github.com/openshift/osdctl/internal/utils/globalflags" 9 | "k8s.io/cli-runtime/pkg/genericclioptions" 10 | ) 11 | 12 | const ( 13 | accountIDRequired = "AWS Account ID is required. You can use -i or --account-id to specify it" 14 | ) 15 | 16 | // NewCmdGet implements the get command to get AWS Account related resources 17 | func NewCmdGet(streams genericclioptions.IOStreams, client client.Client, globalOpts *globalflags.GlobalOptions) *cobra.Command { 18 | getCmd := &cobra.Command{ 19 | Use: "get", 20 | Short: "Get resources", 21 | Args: cobra.NoArgs, 22 | DisableAutoGenTag: true, 23 | } 24 | 25 | getCmd.AddCommand(newCmdGetAccount(streams, client, globalOpts)) 26 | getCmd.AddCommand(newCmdGetAccountClaim(streams, client, globalOpts)) 27 | getCmd.AddCommand(newCmdGetLegalEntity(streams, client, globalOpts)) 28 | getCmd.AddCommand(newCmdGetSecrets(streams, client, globalOpts)) 29 | getCmd.AddCommand(newCmdGetAWSAccount(streams, client)) 30 | 31 | return getCmd 32 | } 33 | 34 | func help(cmd *cobra.Command, _ []string) { 35 | err := cmd.Help() 36 | if err != nil { 37 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 38 | return 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cmd/account/get/legal-entity_test.go: -------------------------------------------------------------------------------- 1 | package get 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | "go.uber.org/mock/gomock" 10 | 11 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 12 | "github.com/openshift/osdctl/internal/utils/globalflags" 13 | "k8s.io/cli-runtime/pkg/genericclioptions" 14 | ) 15 | 16 | func TestGetLegalEntityCmdComplete(t *testing.T) { 17 | g := NewGomegaWithT(t) 18 | mockCtrl := gomock.NewController(t) 19 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 20 | 21 | globalFlags := globalflags.GlobalOptions{Output: ""} 22 | testCases := []struct { 23 | title string 24 | option *getSecretsOptions 25 | errExpected bool 26 | errContent string 27 | }{ 28 | { 29 | title: "empty account id", 30 | option: &getSecretsOptions{ 31 | accountID: "", 32 | GlobalOptions: &globalFlags, 33 | }, 34 | errExpected: true, 35 | errContent: accountIDRequired, 36 | }, 37 | { 38 | title: "succeed", 39 | option: &getSecretsOptions{ 40 | accountID: "foo", 41 | GlobalOptions: &globalFlags, 42 | }, 43 | errExpected: false, 44 | }, 45 | } 46 | 47 | for _, tc := range testCases { 48 | t.Run(tc.title, func(t *testing.T) { 49 | cmd := newCmdGetLegalEntity(streams, mockk8s.NewMockClient(mockCtrl), &globalFlags) 50 | err := tc.option.complete(cmd, nil) 51 | if tc.errExpected { 52 | g.Expect(err).Should(HaveOccurred()) 53 | if tc.errContent != "" { 54 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 55 | } 56 | } else { 57 | g.Expect(err).ShouldNot(HaveOccurred()) 58 | } 59 | }) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /cmd/account/get/secrets_test.go: -------------------------------------------------------------------------------- 1 | package get 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | "go.uber.org/mock/gomock" 10 | 11 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 12 | "github.com/openshift/osdctl/internal/utils/globalflags" 13 | "k8s.io/cli-runtime/pkg/genericclioptions" 14 | ) 15 | 16 | func TestGetSecretsCmdComplete(t *testing.T) { 17 | g := NewGomegaWithT(t) 18 | mockCtrl := gomock.NewController(t) 19 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 20 | globalFlags := globalflags.GlobalOptions{Output: ""} 21 | testCases := []struct { 22 | title string 23 | option *getSecretsOptions 24 | errExpected bool 25 | errContent string 26 | }{ 27 | { 28 | title: "empty account id", 29 | option: &getSecretsOptions{ 30 | accountID: "", 31 | GlobalOptions: &globalFlags, 32 | }, 33 | errExpected: true, 34 | errContent: accountIDRequired, 35 | }, 36 | { 37 | title: "succeed", 38 | option: &getSecretsOptions{ 39 | accountID: "foo", 40 | GlobalOptions: &globalFlags, 41 | }, 42 | errExpected: false, 43 | }, 44 | } 45 | 46 | for _, tc := range testCases { 47 | t.Run(tc.title, func(t *testing.T) { 48 | cmd := newCmdGetSecrets(streams, mockk8s.NewMockClient(mockCtrl), &globalFlags) 49 | err := tc.option.complete(cmd, nil) 50 | if tc.errExpected { 51 | g.Expect(err).Should(HaveOccurred()) 52 | if tc.errContent != "" { 53 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 54 | } 55 | } else { 56 | g.Expect(err).ShouldNot(HaveOccurred()) 57 | } 58 | }) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /cmd/account/list/cmd.go: -------------------------------------------------------------------------------- 1 | package list 2 | 3 | import ( 4 | "fmt" 5 | "github.com/openshift/osdctl/internal/utils/globalflags" 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | "sigs.k8s.io/controller-runtime/pkg/client" 9 | ) 10 | 11 | // NewCmdList implements the list command 12 | func NewCmdList(streams genericclioptions.IOStreams, client client.Client, globalOpts *globalflags.GlobalOptions) *cobra.Command { 13 | listCmd := &cobra.Command{ 14 | Use: "list", 15 | Short: "List resources", 16 | Args: cobra.NoArgs, 17 | DisableAutoGenTag: true, 18 | } 19 | 20 | listCmd.AddCommand(newCmdListAccount(streams, client, globalOpts)) 21 | listCmd.AddCommand(newCmdListAccountClaim(streams, client, globalOpts)) 22 | 23 | return listCmd 24 | } 25 | 26 | func help(cmd *cobra.Command, _ []string) { 27 | err := cmd.Help() 28 | if err != nil { 29 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cmd/account/mgmt/cmd.go: -------------------------------------------------------------------------------- 1 | package mgmt 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/openshift/osdctl/internal/utils/globalflags" 7 | "github.com/spf13/cobra" 8 | "k8s.io/cli-runtime/pkg/genericclioptions" 9 | ) 10 | 11 | const ( 12 | osdStaging1 = "osd-staging-1" 13 | osdStaging2 = "osd-staging-2" 14 | envKeyAWSAccountName = "AWS_ACCOUNT_NAME" 15 | ) 16 | 17 | // NewCmdMgmt implements the mgmt command to get AWS Account resources 18 | func NewCmdMgmt(streams genericclioptions.IOStreams, globalOpts *globalflags.GlobalOptions) *cobra.Command { 19 | mgmtCmd := &cobra.Command{ 20 | Use: "mgmt", 21 | Short: "AWS Account Management", 22 | Args: cobra.NoArgs, 23 | DisableAutoGenTag: true, 24 | } 25 | 26 | mgmtCmd.AddCommand(newCmdAccountList(streams, globalOpts)) 27 | mgmtCmd.AddCommand(newCmdAccountAssign(streams, globalOpts)) 28 | mgmtCmd.AddCommand(newCmdAccountUnassign(streams)) 29 | mgmtCmd.AddCommand(newCmdAccountIAM(streams, globalOpts)) 30 | 31 | return mgmtCmd 32 | } 33 | 34 | func help(cmd *cobra.Command, _ []string) { 35 | err := cmd.Help() 36 | if err != nil { 37 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 38 | return 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cmd/account/reset_test.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | "go.uber.org/mock/gomock" 10 | 11 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 12 | "k8s.io/cli-runtime/pkg/genericclioptions" 13 | ) 14 | 15 | func TestResetCmdComplete(t *testing.T) { 16 | g := NewGomegaWithT(t) 17 | mockCtrl := gomock.NewController(t) 18 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 19 | testCases := []struct { 20 | title string 21 | option *resetOptions 22 | args []string 23 | errExpected bool 24 | errContent string 25 | }{ 26 | { 27 | title: "no args provided", 28 | args: []string{}, 29 | errExpected: true, 30 | errContent: "The name of Account CR is required for reset command", 31 | }, 32 | { 33 | title: "two args provided", 34 | args: []string{"foo", "bar"}, 35 | errExpected: true, 36 | errContent: "The name of Account CR is required for reset command", 37 | }, 38 | { 39 | title: "succeed", 40 | option: &resetOptions{}, 41 | args: []string{"foo"}, 42 | errExpected: false, 43 | }, 44 | } 45 | 46 | for _, tc := range testCases { 47 | t.Run(tc.title, func(t *testing.T) { 48 | cmd := newCmdReset(streams, mockk8s.NewMockClient(mockCtrl)) 49 | err := tc.option.complete(cmd, tc.args) 50 | if tc.errExpected { 51 | g.Expect(err).Should(HaveOccurred()) 52 | if tc.errContent != "" { 53 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 54 | } 55 | } else { 56 | g.Expect(err).ShouldNot(HaveOccurred()) 57 | } 58 | }) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /cmd/account/servicequotas/cmd.go: -------------------------------------------------------------------------------- 1 | package servicequotas 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | ) 9 | 10 | // NewCmdServiceQuotas implements commands related to AWS service-quotas 11 | func NewCmdServiceQuotas(streams genericclioptions.IOStreams) *cobra.Command { 12 | baseCmd := &cobra.Command{ 13 | Use: "servicequotas", 14 | Short: "Interact with AWS service-quotas", 15 | Args: cobra.NoArgs, 16 | DisableAutoGenTag: true, 17 | Aliases: []string{"service-quotas", "service-quota"}, 18 | } 19 | 20 | baseCmd.AddCommand(newCmdDescribe()) 21 | 22 | return baseCmd 23 | } 24 | 25 | func help(cmd *cobra.Command, _ []string) { 26 | err := cmd.Help() 27 | if err != nil { 28 | fmt.Println("Error while calling cmd.Help()", err.Error()) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cmd/account/set_test.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | "go.uber.org/mock/gomock" 10 | 11 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 12 | "k8s.io/cli-runtime/pkg/genericclioptions" 13 | ) 14 | 15 | func TestSetCmdComplete(t *testing.T) { 16 | g := NewGomegaWithT(t) 17 | mockCtrl := gomock.NewController(t) 18 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 19 | testCases := []struct { 20 | title string 21 | option *setOptions 22 | args []string 23 | errExpected bool 24 | errContent string 25 | }{ 26 | { 27 | title: "no args provided", 28 | args: []string{}, 29 | errExpected: true, 30 | errContent: "The name of Account CR is required for set command", 31 | }, 32 | { 33 | title: "two args provided", 34 | args: []string{"foo", "bar"}, 35 | errExpected: true, 36 | errContent: "The name of Account CR is required for set command", 37 | }, 38 | { 39 | title: "invalid state specified", 40 | option: &setOptions{ 41 | state: "bar", 42 | }, 43 | args: []string{"foo"}, 44 | errExpected: true, 45 | errContent: "unsupported account state bar", 46 | }, 47 | { 48 | title: "succeed", 49 | option: &setOptions{ 50 | state: "Creating", 51 | }, 52 | args: []string{"foo"}, 53 | errExpected: false, 54 | }, 55 | } 56 | 57 | for _, tc := range testCases { 58 | t.Run(tc.title, func(t *testing.T) { 59 | cmd := newCmdSet(streams, mockk8s.NewMockClient(mockCtrl)) 60 | err := tc.option.complete(cmd, tc.args) 61 | if tc.errExpected { 62 | g.Expect(err).Should(HaveOccurred()) 63 | if tc.errContent != "" { 64 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 65 | } 66 | } else { 67 | g.Expect(err).ShouldNot(HaveOccurred()) 68 | } 69 | }) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /cmd/account/verify-secrets_test.go: -------------------------------------------------------------------------------- 1 | package account 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | "go.uber.org/mock/gomock" 10 | 11 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 12 | "k8s.io/cli-runtime/pkg/genericclioptions" 13 | ) 14 | 15 | func TestCheckSecretsCmdComplete(t *testing.T) { 16 | g := NewGomegaWithT(t) 17 | mockCtrl := gomock.NewController(t) 18 | streams := genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr} 19 | testCases := []struct { 20 | title string 21 | option *verifySecretsOptions 22 | args []string 23 | errExpected bool 24 | errContent string 25 | }{ 26 | { 27 | title: "two args provided", 28 | args: []string{"foo", "bar"}, 29 | errExpected: true, 30 | errContent: verifySecretsUsage, 31 | }, 32 | { 33 | title: "succeed with one arg", 34 | option: &verifySecretsOptions{ 35 | accountName: "foo", 36 | }, 37 | args: []string{"foo"}, 38 | errExpected: false, 39 | }, 40 | { 41 | title: "succeed with one arg", 42 | option: &verifySecretsOptions{}, 43 | args: []string{}, 44 | errExpected: false, 45 | }, 46 | } 47 | 48 | for _, tc := range testCases { 49 | t.Run(tc.title, func(t *testing.T) { 50 | cmd := newCmdVerifySecrets(streams, mockk8s.NewMockClient(mockCtrl)) 51 | err := tc.option.complete(cmd, tc.args) 52 | if tc.errExpected { 53 | g.Expect(err).Should(HaveOccurred()) 54 | if tc.errContent != "" { 55 | g.Expect(true).Should(Equal(strings.Contains(err.Error(), tc.errContent))) 56 | } 57 | } else { 58 | g.Expect(err).ShouldNot(HaveOccurred()) 59 | } 60 | }) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /cmd/alerts/cmd.go: -------------------------------------------------------------------------------- 1 | package alerts 2 | 3 | import ( 4 | "github.com/openshift/osdctl/cmd/alerts/silence" 5 | "github.com/spf13/cobra" 6 | ) 7 | 8 | // NewCmdAlerts implements base alert command. 9 | func NewCmdAlerts() *cobra.Command { 10 | alrtCmd := &cobra.Command{ 11 | Use: "alert", 12 | Short: "List alerts", 13 | Args: cobra.NoArgs, 14 | DisableAutoGenTag: true, 15 | } 16 | 17 | alrtCmd.AddCommand(NewCmdListAlerts()) 18 | alrtCmd.AddCommand(silence.NewCmdSilence()) 19 | 20 | return alrtCmd 21 | } 22 | -------------------------------------------------------------------------------- /cmd/alerts/silence/cmd.go: -------------------------------------------------------------------------------- 1 | package silence 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | ) 6 | 7 | // NewCmdSilence implements base silence command. 8 | func NewCmdSilence() *cobra.Command { 9 | silenceCmd := &cobra.Command{ 10 | Use: "silence", 11 | Short: "add, expire and list silence associated with alerts", 12 | Args: cobra.NoArgs, 13 | DisableAutoGenTag: true, 14 | } 15 | 16 | silenceCmd.AddCommand(NewCmdAddSilence()) 17 | silenceCmd.AddCommand(NewCmdClearSilence()) 18 | silenceCmd.AddCommand(NewCmdListSilence()) 19 | silenceCmd.AddCommand(NewCmdAddOrgSilence()) 20 | 21 | return silenceCmd 22 | } 23 | -------------------------------------------------------------------------------- /cmd/alerts/utils/alert.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | // Labels represents a set of labels associated with an alert. 4 | type AlertLabels struct { 5 | Alertname string `json:"alertname"` 6 | Severity string `json:"severity"` 7 | } 8 | 9 | // Status represents a set of state associated with an alert. 10 | type AlertStatus struct { 11 | State string `json:"state"` 12 | } 13 | 14 | // Annotations represents a set of summary/description associated with an alert. 15 | type AlertAnnotations struct { 16 | Summary string `json:"summary"` 17 | } 18 | 19 | // Alert represents a set of above declared struct Labels,Status and annoataions 20 | type Alert struct { 21 | Labels AlertLabels `json:"labels"` 22 | Status AlertStatus `json:"status"` 23 | Annotations AlertAnnotations `json:"annotations"` 24 | } 25 | -------------------------------------------------------------------------------- /cmd/alerts/utils/silence.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | type SilenceID struct { 4 | ID string `json:"id"` 5 | } 6 | 7 | type SilenceMatchers struct { 8 | Name string `json:"name"` 9 | Value string `json:"value"` 10 | } 11 | 12 | type SilenceStatus struct { 13 | State string `json:"state"` 14 | } 15 | 16 | type Silence struct { 17 | ID string `json:"id"` 18 | Matchers []SilenceMatchers `json:"matchers"` 19 | Status SilenceStatus `json:"status"` 20 | Comment string `json:"comment"` 21 | CreatedBy string `json:"createdBy"` 22 | EndsAt string `json:"endsAt"` 23 | StartsAt string `json:"startsAt"` 24 | } 25 | -------------------------------------------------------------------------------- /cmd/cloudtrail/cmd.go: -------------------------------------------------------------------------------- 1 | package cloudtrail 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | ) 6 | 7 | // NewCloudtrailCmd represents the newCmdWriteEvents command 8 | func NewCloudtrailCmd() *cobra.Command { 9 | cloudtrailCmd := &cobra.Command{ 10 | Use: "cloudtrail", 11 | Short: "AWS CloudTrail related utilities", 12 | RunE: func(cmd *cobra.Command, args []string) error { 13 | return cmd.Help() 14 | }, 15 | } 16 | 17 | cloudtrailCmd.AddCommand(newCmdWriteEvents()) 18 | cloudtrailCmd.AddCommand(newCmdPermissionDenied()) 19 | 20 | return cloudtrailCmd 21 | } 22 | -------------------------------------------------------------------------------- /cmd/cloudtrail/pkg/aws/testdata/valid_event.json: -------------------------------------------------------------------------------- 1 | { 2 | "eventVersion": "1.8", 3 | "userIdentity": { 4 | "accountId": "123456789012", 5 | "sessionContext": { 6 | "sessionIssuer": { 7 | "type": "Role", 8 | "userName": "testUser", 9 | "arn": "arn:aws:iam::123456789012:role/testRole" 10 | } 11 | } 12 | }, 13 | "awsRegion": "us-east-1", 14 | "eventID": "abcd-1234", 15 | "errorCode": "AccessDenied" 16 | } 17 | -------------------------------------------------------------------------------- /cmd/cluster/access/common.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/openshift/osdctl/pkg/k8s" 8 | corev1 "k8s.io/api/core/v1" 9 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 10 | kclient "sigs.k8s.io/controller-runtime/pkg/client" 11 | ) 12 | 13 | const ( 14 | hiveNSLabelKey = "api.openshift.com/id" 15 | ) 16 | 17 | // accessOptions defines the struct for running accessOwner command 18 | type access struct { 19 | reason string 20 | kubeCli *k8s.LazyClient 21 | } 22 | 23 | // isAffirmative returns true if the provided input indicates user agreement ("y" or "Y") 24 | func isAffirmative(input string) bool { 25 | return input == "y" || input == "Y" 26 | } 27 | 28 | // getClusterNamespace returns the hive namespace for a cluster given it's internal ID 29 | func getClusterNamespace(client kclient.Client, clusterid string) (corev1.Namespace, error) { 30 | nsList := corev1.NamespaceList{} 31 | labelSelector := metav1.LabelSelector{MatchLabels: map[string]string{hiveNSLabelKey: clusterid}} 32 | selector, err := metav1.LabelSelectorAsSelector(&labelSelector) 33 | if err != nil { 34 | return corev1.Namespace{}, err 35 | } 36 | 37 | err = client.List(context.TODO(), &nsList, &kclient.ListOptions{LabelSelector: selector}) 38 | if err != nil { 39 | return corev1.Namespace{}, err 40 | } 41 | if len(nsList.Items) != 1 { 42 | return corev1.Namespace{}, fmt.Errorf("expected list operation to return exactly 1 namespace, got %d", len(nsList.Items)) 43 | } 44 | 45 | return nsList.Items[0], nil 46 | } 47 | -------------------------------------------------------------------------------- /cmd/cluster/from_infra_id_test.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import "testing" 4 | 5 | func TestGetClusterNameFromInfraID(t *testing.T) { 6 | testInfraIdsToName := map[string]string{ 7 | "dev-asdf": "dev", 8 | "as-df-ghjkl-qwerty": "as-df-ghjkl", 9 | "asdf-": "asdf", 10 | } 11 | for infraId, expectedName := range testInfraIdsToName { 12 | actualName, err := getClusterNameFromInfraId(infraId) 13 | if err != nil { 14 | t.Errorf("failed to extract cluster name from infrastructure ID %q", err) 15 | } 16 | if actualName != expectedName { 17 | t.Errorf("expected name, %s, does not match actual name, %s", expectedName, actualName) 18 | } 19 | } 20 | } 21 | 22 | func TestGetClusterNameFromInfraIdWithOneSegment(t *testing.T) { 23 | infraIdWithOneSegment := "asdf" // one segment, no hyphens 24 | actualName, err := getClusterNameFromInfraId(infraIdWithOneSegment) 25 | if actualName != "" { 26 | t.Errorf("no name should be returned from infrastructure id missing hyphens, got %s", actualName) 27 | } 28 | if err == nil { 29 | t.Errorf("error should not be nil when passed infrastructure id is missing hyphens") 30 | } 31 | } 32 | 33 | func TestGetClusterNameFromEmptyInfraId(t *testing.T) { 34 | emptyInfraId := "" // one segment, no hyphens 35 | actualName, err := getClusterNameFromInfraId(emptyInfraId) 36 | if actualName != "" { 37 | t.Errorf("no name should be returned from empty infrastructure id, got %s", actualName) 38 | } 39 | if err == nil { 40 | t.Errorf("error should not be nil when passed empty infrastructure id") 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /cmd/cluster/org_id.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | ctlutil "github.com/openshift/osdctl/pkg/utils" 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | type OrgId struct { 12 | clusterID string 13 | } 14 | 15 | type OrgIdOutput struct { 16 | ExternalId string `json:"external_id"` 17 | InternalId string `json:"internal_id"` 18 | } 19 | 20 | func newCmdOrgId() *cobra.Command { 21 | o := &OrgId{} 22 | orgIdCmd := &cobra.Command{ 23 | Use: "orgId --cluster-id ", 15 | Short: "Get the Dynatrace Tenant URL for a given MC or HCP cluster", 16 | DisableAutoGenTag: true, 17 | Run: func(cmd *cobra.Command, args []string) { 18 | 19 | hcpCluster, err := FetchClusterDetails(clusterID) 20 | if err != nil { 21 | cmdutil.CheckErr(err) 22 | } 23 | fmt.Println("Dynatrace Environment URL - ", hcpCluster.DynatraceURL) 24 | }, 25 | } 26 | 27 | urlCmd.Flags().StringVar(&clusterID, "cluster-id", "", "ID of the cluster") 28 | _ = urlCmd.MarkFlagRequired("cluster-id") 29 | 30 | return urlCmd 31 | } 32 | -------------------------------------------------------------------------------- /cmd/getoutput/getoutput.go: -------------------------------------------------------------------------------- 1 | package getoutput 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "gopkg.in/yaml.v2" 8 | ) 9 | 10 | type CmdResponse interface { 11 | String() string 12 | } 13 | 14 | func PrintResponse(output string, resp CmdResponse) error { 15 | if output == "json" { 16 | 17 | accountsToJson, err := json.MarshalIndent(resp, "", " ") 18 | if err != nil { 19 | return err 20 | } 21 | 22 | fmt.Println(string(accountsToJson)) 23 | 24 | } else if output == "yaml" { 25 | 26 | accountIdToYaml, err := yaml.Marshal(resp) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | fmt.Println(string(accountIdToYaml)) 32 | 33 | } else { 34 | fmt.Println(resp) 35 | } 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /cmd/hcp/cmd.go: -------------------------------------------------------------------------------- 1 | package hcp 2 | 3 | import ( 4 | "github.com/openshift/osdctl/cmd/hcp/mustgather" 5 | "github.com/spf13/cobra" 6 | ) 7 | 8 | func NewCmdHCP() *cobra.Command { 9 | hcp := &cobra.Command{ 10 | Use: "hcp", 11 | Args: cobra.NoArgs, 12 | } 13 | 14 | hcp.AddCommand(mustgather.NewCmdMustGather()) 15 | 16 | return hcp 17 | } 18 | -------------------------------------------------------------------------------- /cmd/hive/clusterdeployment/cmd.go: -------------------------------------------------------------------------------- 1 | package clusterdeployment 2 | 3 | import ( 4 | "fmt" 5 | "github.com/spf13/cobra" 6 | "k8s.io/cli-runtime/pkg/genericclioptions" 7 | "sigs.k8s.io/controller-runtime/pkg/client" 8 | ) 9 | 10 | // NewCmdClusterDeployment implements the base cluster deployment command 11 | func NewCmdClusterDeployment(streams genericclioptions.IOStreams, client client.Client) *cobra.Command { 12 | cdCmd := &cobra.Command{ 13 | Use: "clusterdeployment", 14 | Short: "cluster deployment related utilities", 15 | Aliases: []string{"cd"}, 16 | Args: cobra.NoArgs, 17 | DisableAutoGenTag: true, 18 | } 19 | 20 | cdCmd.AddCommand(newCmdList(streams, client)) 21 | cdCmd.AddCommand(newCmdListResources(streams, client)) 22 | return cdCmd 23 | } 24 | 25 | func help(cmd *cobra.Command, _ []string) { 26 | err := cmd.Help() 27 | if err != nil { 28 | fmt.Println("Error while calling cmd.Help()", err.Error()) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cmd/hive/clusterdeployment/list_test.go: -------------------------------------------------------------------------------- 1 | package clusterdeployment 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/gomega" 7 | "go.uber.org/mock/gomock" 8 | 9 | mockk8s "github.com/openshift/osdctl/cmd/hive/clusterdeployment/mock/k8s" 10 | ) 11 | 12 | func TestListCmdComplete(t *testing.T) { 13 | g := NewGomegaWithT(t) 14 | mockCtrl := gomock.NewController(t) 15 | testCases := []struct { 16 | title string 17 | option *listOptions 18 | errExpected bool 19 | }{ 20 | { 21 | title: "succeed", 22 | option: &listOptions{ 23 | kubeCli: mockk8s.NewMockClient(mockCtrl), 24 | }, 25 | errExpected: false, 26 | }, 27 | } 28 | 29 | for _, tc := range testCases { 30 | t.Run(tc.title, func(t *testing.T) { 31 | err := tc.option.complete(nil, nil) 32 | if tc.errExpected { 33 | g.Expect(err).Should(HaveOccurred()) 34 | } else { 35 | g.Expect(err).ShouldNot(HaveOccurred()) 36 | } 37 | }) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /cmd/hive/cmd.go: -------------------------------------------------------------------------------- 1 | package hive 2 | 3 | import ( 4 | "fmt" 5 | cd "github.com/openshift/osdctl/cmd/hive/clusterdeployment" 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | "sigs.k8s.io/controller-runtime/pkg/client" 9 | ) 10 | 11 | // NewCmdHive implements the base hive command 12 | func NewCmdHive(streams genericclioptions.IOStreams, client client.Client) *cobra.Command { 13 | hiveCmd := &cobra.Command{ 14 | Use: "hive", 15 | Short: "hive related utilities", 16 | Args: cobra.NoArgs, 17 | DisableAutoGenTag: true, 18 | } 19 | 20 | hiveCmd.AddCommand(NewCmdClusterSyncFailures(streams, client)) 21 | hiveCmd.AddCommand(cd.NewCmdClusterDeployment(streams, client)) 22 | return hiveCmd 23 | } 24 | 25 | func help(cmd *cobra.Command, _ []string) { 26 | err := cmd.Help() 27 | if err != nil { 28 | fmt.Println("Error while calling cmd.Help()", err.Error()) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cmd/iampermissions/cmd.go: -------------------------------------------------------------------------------- 1 | package iampermissions 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/openshift/osdctl/pkg/policies" 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | const ( 11 | // cloudFlagName is declared as const so we can keep naming of this flag 12 | // consistent between different subcommands 13 | cloudFlagName = "cloud" 14 | ) 15 | 16 | func NewCmdIamPermissions() *cobra.Command { 17 | var cloudValue policies.CloudSpec 18 | var iamPermissionsCommand = &cobra.Command{ 19 | Use: "iampermissions", 20 | Short: "STS/WIF utilities", 21 | Run: func(cmd *cobra.Command, args []string) { 22 | err := cmd.Help() 23 | if err != nil { 24 | fmt.Println("Error calling cmd.Help(): ", err.Error()) 25 | return 26 | } 27 | }, 28 | } 29 | iamPermissionsCommand.PersistentFlags().VarP(&cloudValue, "cloud", "c", "cloud for which the policies should be retrieved. supported values: [aws, sts, gcp, wif]") 30 | 31 | iamPermissionsCommand.AddCommand(newCmdGet()) 32 | iamPermissionsCommand.AddCommand(newCmdDiff()) 33 | iamPermissionsCommand.AddCommand(newCmdSave()) 34 | 35 | return iamPermissionsCommand 36 | } 37 | -------------------------------------------------------------------------------- /cmd/iampermissions/diff_test.go: -------------------------------------------------------------------------------- 1 | package iampermissions 2 | 3 | import ( 4 | "bytes" 5 | "os/exec" 6 | "testing" 7 | 8 | "github.com/openshift/osdctl/pkg/policies" 9 | "github.com/stretchr/testify/assert" 10 | ) 11 | 12 | func TestRunSuccess(t *testing.T) { 13 | mockDownload := func(version string, cloud policies.CloudSpec) (string, error) { 14 | return "/mock/path/" + version, nil 15 | } 16 | 17 | mockExec := func(command string, args ...string) *exec.Cmd { 18 | return exec.Command("echo", "mock diff output") 19 | } 20 | 21 | var outputBuffer bytes.Buffer 22 | 23 | o := &diffOptions{ 24 | BaseVersion: "v1", 25 | TargetVersion: "v2", 26 | Cloud: policies.AWS, 27 | downloadFunc: mockDownload, 28 | execFunc: mockExec, 29 | outputWriter: &outputBuffer, 30 | } 31 | err := o.run() 32 | assert.NoError(t, err) 33 | assert.Contains(t, outputBuffer.String(), "mock diff output") 34 | } 35 | -------------------------------------------------------------------------------- /cmd/iampermissions/get.go: -------------------------------------------------------------------------------- 1 | package iampermissions 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | 8 | "github.com/openshift/osdctl/pkg/policies" 9 | "github.com/spf13/cobra" 10 | cmdutil "k8s.io/kubectl/pkg/cmd/util" 11 | ) 12 | 13 | type getOptions struct { 14 | ReleaseVersion string 15 | Cloud policies.CloudSpec 16 | 17 | // Injected for testability 18 | downloadFunc func(string, policies.CloudSpec) (string, error) 19 | outputWriter io.Writer 20 | } 21 | 22 | func newCmdGet() *cobra.Command { 23 | ops := &getOptions{ 24 | downloadFunc: policies.DownloadCredentialRequests, 25 | outputWriter: os.Stdout, 26 | } 27 | 28 | policyCmd := &cobra.Command{ 29 | Use: "get", 30 | Short: "Get OCP CredentialsRequests", 31 | Args: cobra.ExactArgs(0), 32 | DisableAutoGenTag: true, 33 | Run: func(cmd *cobra.Command, args []string) { 34 | ops.Cloud = *cmd.Flag(cloudFlagName).Value.(*policies.CloudSpec) 35 | cmdutil.CheckErr(ops.run()) 36 | }, 37 | } 38 | 39 | policyCmd.Flags().StringVarP(&ops.ReleaseVersion, "release-version", "r", "", "") 40 | _ = policyCmd.MarkFlagRequired("release-version") 41 | 42 | return policyCmd 43 | } 44 | 45 | func (o *getOptions) run() error { 46 | directory, err := o.downloadFunc(o.ReleaseVersion, o.Cloud) 47 | if err != nil { 48 | return err 49 | } 50 | 51 | output := fmt.Sprintf("OCP CredentialsRequests for %s have been saved in %s directory", o.Cloud.String(), directory) 52 | fmt.Fprintln(o.outputWriter, output) 53 | 54 | return nil 55 | } 56 | -------------------------------------------------------------------------------- /cmd/iampermissions/get_test.go: -------------------------------------------------------------------------------- 1 | package iampermissions 2 | 3 | import ( 4 | "bytes" 5 | "errors" 6 | "testing" 7 | 8 | "github.com/openshift/osdctl/pkg/policies" 9 | "github.com/stretchr/testify/assert" 10 | ) 11 | 12 | func TestRun_Success(t *testing.T) { 13 | var outputBuffer bytes.Buffer 14 | 15 | opts := &getOptions{ 16 | ReleaseVersion: "4.15.0", 17 | Cloud: policies.AWS, 18 | downloadFunc: func(version string, cloud policies.CloudSpec) (string, error) { 19 | assert.Equal(t, "4.15.0", version) 20 | assert.Equal(t, policies.AWS, cloud) 21 | return "/mock/dir", nil 22 | }, 23 | outputWriter: &outputBuffer, 24 | } 25 | 26 | err := opts.run() 27 | assert.NoError(t, err) 28 | assert.Contains(t, outputBuffer.String(), "OCP CredentialsRequests for aws have been saved in /mock/dir") 29 | } 30 | 31 | func TestRun_Failure(t *testing.T) { 32 | opts := &getOptions{ 33 | ReleaseVersion: "invalid", 34 | Cloud: policies.AWS, 35 | downloadFunc: func(version string, cloud policies.CloudSpec) (string, error) { 36 | return "", errors.New("download failed") 37 | }, 38 | outputWriter: &bytes.Buffer{}, 39 | } 40 | 41 | err := opts.run() 42 | assert.Error(t, err) 43 | assert.Equal(t, "download failed", err.Error()) 44 | } 45 | -------------------------------------------------------------------------------- /cmd/jira/cmd.go: -------------------------------------------------------------------------------- 1 | package jira 2 | 3 | import "github.com/spf13/cobra" 4 | 5 | var Cmd = &cobra.Command{ 6 | Use: "jira", 7 | Short: "Provides a set of commands for interacting with Jira", 8 | Args: cobra.NoArgs, 9 | } 10 | 11 | func init() { 12 | Cmd.AddCommand(quickTaskCmd) 13 | } 14 | -------------------------------------------------------------------------------- /cmd/mc/cmd.go: -------------------------------------------------------------------------------- 1 | package mc 2 | 3 | import "github.com/spf13/cobra" 4 | 5 | func NewCmdMC() *cobra.Command { 6 | mc := &cobra.Command{ 7 | Use: "mc", 8 | Args: cobra.NoArgs, 9 | } 10 | 11 | mc.AddCommand(newCmdList()) 12 | 13 | return mc 14 | } 15 | -------------------------------------------------------------------------------- /cmd/network/cmd.go: -------------------------------------------------------------------------------- 1 | package network 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/openshift/osdctl/pkg/k8s" 7 | "github.com/spf13/cobra" 8 | "k8s.io/cli-runtime/pkg/genericclioptions" 9 | ) 10 | 11 | // NewCmdNetwork implements the base cluster deployment command 12 | func NewCmdNetwork(streams genericclioptions.IOStreams, client *k8s.LazyClient) *cobra.Command { 13 | netCmd := &cobra.Command{ 14 | Use: "network", 15 | Short: "network related utilities", 16 | Args: cobra.NoArgs, 17 | DisableAutoGenTag: true, 18 | } 19 | 20 | netCmd.AddCommand(newCmdPacketCapture(streams, client)) 21 | netCmd.AddCommand(NewCmdValidateEgress()) 22 | return netCmd 23 | } 24 | 25 | func help(cmd *cobra.Command, _ []string) { 26 | err := cmd.Help() 27 | if err != nil { 28 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 29 | return 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cmd/org/cmd.go: -------------------------------------------------------------------------------- 1 | package org 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/spf13/cobra" 7 | ) 8 | 9 | func NewCmdOrg() *cobra.Command { 10 | var orgCmd = &cobra.Command{ 11 | Use: "org", 12 | Short: "Provides information for a specified organization", 13 | Run: func(cmd *cobra.Command, args []string) { 14 | err := cmd.Help() 15 | if err != nil { 16 | fmt.Println("Error calling cmd.Help(): ", err.Error()) 17 | return 18 | } 19 | }, 20 | } 21 | 22 | // Add subcommands 23 | 24 | orgCmd.AddCommand(currentCmd) 25 | orgCmd.AddCommand(getCmd) 26 | orgCmd.AddCommand(usersCmd) 27 | orgCmd.AddCommand(labelsCmd) 28 | orgCmd.AddCommand(describeCmd) 29 | orgCmd.AddCommand(clustersCmd) 30 | orgCmd.AddCommand(customersCmd) 31 | orgCmd.AddCommand(awsAccountsCmd) 32 | orgCmd.AddCommand(contextCmd) 33 | 34 | return orgCmd 35 | } 36 | -------------------------------------------------------------------------------- /cmd/org/current.go: -------------------------------------------------------------------------------- 1 | package org 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/openshift-online/ocm-cli/pkg/arguments" 8 | sdk "github.com/openshift-online/ocm-sdk-go" 9 | "github.com/openshift/osdctl/pkg/utils" 10 | "github.com/spf13/cobra" 11 | cmdutil "k8s.io/kubectl/pkg/cmd/util" 12 | ) 13 | 14 | var ( 15 | currentCmd = &cobra.Command{ 16 | Use: "current", 17 | Short: "gets current organization", 18 | Args: cobra.ArbitraryArgs, 19 | SilenceErrors: true, 20 | Run: func(_ *cobra.Command, _ []string) { 21 | ocmClient, err := utils.CreateConnection() 22 | if err != nil { 23 | cmdutil.CheckErr(err) 24 | } 25 | defer func() { 26 | if err := ocmClient.Close(); err != nil { 27 | cmdutil.CheckErr(fmt.Errorf("cannot close the ocmClient (possible memory leak): %q", err)) 28 | } 29 | }() 30 | req, err := getOrgRequest(ocmClient) 31 | if err != nil { 32 | cmdutil.CheckErr(err) 33 | } 34 | resp, err := sendRequest(req) 35 | if err != nil { 36 | cmdutil.CheckErr(fmt.Errorf("invalid input: %q", err)) 37 | } 38 | orgs, err := getCurrentOrg(resp.Bytes()) 39 | if err != nil { 40 | cmdutil.CheckErr(err) 41 | } 42 | printOrg(*orgs) 43 | }, 44 | } 45 | ) 46 | 47 | type account struct { 48 | Organization Organization `json:"organization"` 49 | } 50 | 51 | func init() { 52 | flags := currentCmd.Flags() 53 | AddOutputFlag(flags) 54 | } 55 | 56 | func getCurrentOrg(data []byte) (*Organization, error) { 57 | acc := account{} 58 | err := json.Unmarshal(data, &acc) 59 | if err != nil { 60 | return nil, err 61 | } 62 | return &acc.Organization, nil 63 | } 64 | 65 | func getOrgRequest(ocmClient *sdk.Connection) (*sdk.Request, error) { 66 | req := ocmClient.Get() 67 | err := arguments.ApplyPathArg(req, currentAccountApiPath) 68 | if err != nil { 69 | return nil, fmt.Errorf("can't parse API path '%s': %v\n", currentAccountApiPath, err) 70 | } 71 | return req, nil 72 | } 73 | -------------------------------------------------------------------------------- /cmd/org/testdata/jsonClusters.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "cluster_id": "cid-1", 4 | "display_name": "cluster-1", 5 | "external_id": "ext-1", 6 | "status": "Active" 7 | }, 8 | { 9 | "cluster_id": "cid-2", 10 | "display_name": "cluster-2", 11 | "external_id": "ext-2", 12 | "status": "Inactive" 13 | } 14 | ] -------------------------------------------------------------------------------- /cmd/org/testdata/tableClusters.txt: -------------------------------------------------------------------------------- 1 | DISPLAY NAME INTERNAL CLUSTER ID EXTERNAL CLUSTER ID STATUS 2 | cluster-1 cid-1 ext-1 Active 3 | cluster-2 cid-2 ext-2 Inactive 4 | 5 | -------------------------------------------------------------------------------- /cmd/promote/cmd.go: -------------------------------------------------------------------------------- 1 | package promote 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/openshift/osdctl/cmd/promote/dynatrace" 7 | "github.com/openshift/osdctl/cmd/promote/pko" 8 | "github.com/openshift/osdctl/cmd/promote/saas" 9 | "github.com/spf13/cobra" 10 | ) 11 | 12 | // NewCmdPromote implements the promote command to promote services/operators 13 | func NewCmdPromote() *cobra.Command { 14 | promoteCmd := &cobra.Command{ 15 | Use: "promote", 16 | Short: "Utilities to promote services/operators", 17 | Args: cobra.NoArgs, 18 | DisableAutoGenTag: true, 19 | } 20 | 21 | promoteCmd.AddCommand(saas.NewCmdSaas()) 22 | promoteCmd.AddCommand(pko.NewCmdPKO()) 23 | promoteCmd.AddCommand(dynatrace.NewCmdDynatrace()) 24 | 25 | return promoteCmd 26 | } 27 | 28 | func help(cmd *cobra.Command, _ []string) { 29 | err := cmd.Help() 30 | if err != nil { 31 | fmt.Println("Error while calling cmd.Help(): ", err.Error()) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /cmd/promote/dynatrace/dt_git_cmd_test.go: -------------------------------------------------------------------------------- 1 | package dynatrace 2 | 3 | import ( 4 | "errors" 5 | "sync" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | // mockExec is a mock implementation of the iexec.IExec interface 12 | type mockExec struct { 13 | output string 14 | err error 15 | } 16 | 17 | func (m *mockExec) Run(dir string, name string, args ...string) error { 18 | return nil 19 | } 20 | 21 | func (m *mockExec) Output(dir, cmd string, args ...string) (string, error) { 22 | return m.output, m.err 23 | } 24 | 25 | func (m *mockExec) CombinedOutput(dir, cmd string, args ...string) (string, error) { 26 | return "", nil 27 | } 28 | 29 | func resetBaseDir() { 30 | // reset package-level variables to allow test re-execution 31 | baseDirOnce = *new(sync.Once) 32 | BaseDir = "" 33 | baseDirErr = nil 34 | } 35 | 36 | func TestGetBaseDir_Success(t *testing.T) { 37 | resetBaseDir() 38 | 39 | mock := &mockExec{ 40 | output: "/path/to/git/repo\n", 41 | err: nil, 42 | } 43 | 44 | dir, err := getBaseDir(mock) 45 | 46 | assert.NoError(t, err) 47 | assert.Equal(t, "/path/to/git/repo", dir) 48 | assert.Equal(t, "/path/to/git/repo", BaseDir) 49 | } 50 | 51 | func TestGetBaseDir_Error(t *testing.T) { 52 | resetBaseDir() 53 | 54 | mock := &mockExec{ 55 | output: "", 56 | err: errors.New("git error"), 57 | } 58 | 59 | dir, err := getBaseDir(mock) 60 | 61 | assert.Error(t, err) 62 | assert.Equal(t, "", dir) 63 | assert.Equal(t, "git error", err.Error()) 64 | } 65 | -------------------------------------------------------------------------------- /cmd/promote/dynatrace/dt_service_repo.go: -------------------------------------------------------------------------------- 1 | package dynatrace 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | func CheckoutAndCompareGitHash(appInterface AppInterface, gitURL, gitHash, currentGitHash, serviceFullPath string) (string, string, error) { 11 | tempDir, err := ioutil.TempDir("", "") 12 | exec := appInterface.GitExecutor 13 | if err != nil { 14 | return "", "", fmt.Errorf("failed to create temporary directory: %v", err) 15 | } 16 | defer os.RemoveAll(tempDir) 17 | 18 | err = os.Chdir(tempDir) 19 | if err != nil { 20 | return "", "", fmt.Errorf("failed to change directory to temporary directory: %v", err) 21 | } 22 | 23 | err = exec.Run("", "git", "clone", gitURL, "source-dir") 24 | if err != nil { 25 | return "", "", fmt.Errorf("failed to clone git repository: %v", err) 26 | } 27 | 28 | err = os.Chdir("source-dir") 29 | if err != nil { 30 | return "", "", fmt.Errorf("failed to change directory to source-dir: %v", err) 31 | } 32 | 33 | if gitHash == "" { 34 | fmt.Printf("No git hash provided. Using HEAD.\n") 35 | output, err := exec.Output("", "git", "rev-list", "-n", "1", "HEAD", "--", serviceFullPath) 36 | if err != nil { 37 | return "", "", fmt.Errorf("failed to get git hash: %v", err) 38 | } 39 | gitHash = strings.TrimSpace(string(output)) 40 | fmt.Printf("The head githash is %s\n", gitHash) 41 | } 42 | 43 | if currentGitHash == gitHash { 44 | return "", "", fmt.Errorf("git hash %s is already at HEAD", gitHash) 45 | } else { 46 | commitLog, err := exec.Output("", "git", "log", "--no-merges", fmt.Sprintf("%s..%s", currentGitHash, gitHash)) 47 | if err != nil { 48 | return "", "", err 49 | } 50 | return gitHash, string(commitLog), nil 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /cmd/promote/dynatrace/dynatrace_suite_test.go: -------------------------------------------------------------------------------- 1 | package dynatrace 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | ) 9 | 10 | func TestDynatraceSuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Test Dynatrace suite") 13 | } 14 | -------------------------------------------------------------------------------- /cmd/promote/dynatrace/tf_file_update.go: -------------------------------------------------------------------------------- 1 | package dynatrace 2 | 3 | import ( 4 | "errors" 5 | "io/ioutil" 6 | "os" 7 | 8 | "github.com/hashicorp/hcl/v2" 9 | "github.com/hashicorp/hcl/v2/hclwrite" 10 | "github.com/zclconf/go-cty/cty" 11 | ) 12 | 13 | func Open(filepath string) (*hclwrite.File, error) { 14 | content, err := ioutil.ReadFile(filepath) 15 | if err != nil { 16 | return nil, err 17 | } 18 | file, diags := hclwrite.ParseConfig(content, filepath, hcl.Pos{Line: 1, Column: 1}) 19 | if diags.HasErrors() { 20 | err := errors.New("an error occurred") 21 | if err != nil { 22 | return nil, err 23 | } 24 | } 25 | return file, nil 26 | } 27 | 28 | func UpdateDefaultValue(file *hclwrite.File, name string, value string) bool { 29 | for _, block := range file.Body().Blocks() { 30 | labels := block.Labels() 31 | if block.Type() == "module" && len(labels) > 0 && name == labels[0] { 32 | if block.Body().GetAttribute("source") != nil { 33 | block.Body().SetAttributeValue("source", cty.StringVal(value)) 34 | return true 35 | } 36 | } 37 | } 38 | return false 39 | } 40 | 41 | func Save(filename string, file *hclwrite.File) error { 42 | if err := os.WriteFile(filename, file.Bytes(), 0600); err != nil { 43 | return err 44 | } 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /cmd/promote/git/git_cmd.go: -------------------------------------------------------------------------------- 1 | package git 2 | 3 | import ( 4 | "strings" 5 | "sync" 6 | 7 | "github.com/openshift/osdctl/cmd/promote/iexec" 8 | ) 9 | 10 | var ( 11 | baseDirOnce sync.Once 12 | BaseDir string 13 | baseDirErr error 14 | ) 15 | 16 | // getBaseDir returns the base directory of the git repository, this can only be called once per process 17 | func getBaseDir(exec iexec.IExec) (string, error) { 18 | baseDirOnce.Do(func() { 19 | baseDirOutput, err := exec.Output("", "git", "rev-parse", "--show-toplevel") 20 | if err != nil { 21 | baseDirErr = err 22 | return 23 | } 24 | 25 | BaseDir = strings.TrimSpace(baseDirOutput) 26 | }) 27 | 28 | return BaseDir, baseDirErr 29 | } 30 | -------------------------------------------------------------------------------- /cmd/promote/git/service_repo.go: -------------------------------------------------------------------------------- 1 | package git 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "os" 7 | "strings" 8 | 9 | "github.com/openshift/osdctl/cmd/promote/iexec" 10 | ) 11 | 12 | func CheckoutAndCompareGitHash(gitExecutor iexec.IExec, gitURL, gitHash, currentGitHash string) (string, string, error) { 13 | tempDir, err := ioutil.TempDir("", "") 14 | if err != nil { 15 | return "", "", fmt.Errorf("failed to create temporary directory: %v", err) 16 | } 17 | defer os.RemoveAll(tempDir) 18 | 19 | err = os.Chdir(tempDir) 20 | if err != nil { 21 | return "", "", fmt.Errorf("failed to change directory to temporary directory: %v", err) 22 | } 23 | 24 | err = gitExecutor.Run(tempDir, "git", "clone", gitURL, "source-dir") 25 | if err != nil { 26 | return "", "", fmt.Errorf("failed to clone git repository: %v", err) 27 | } 28 | err = os.Chdir("source-dir") 29 | if err != nil { 30 | return "", "", fmt.Errorf("failed to change directory to source-dir: %v", err) 31 | } 32 | 33 | if gitHash == "" { 34 | fmt.Printf("No git hash provided. Using HEAD.\n") 35 | output, err := gitExecutor.Output("", "git", "rev-parse", "HEAD") 36 | if err != nil { 37 | return "", "", fmt.Errorf("failed to get git hash: %v", err) 38 | } 39 | gitHash = strings.TrimSpace(output) 40 | fmt.Printf("The head githash is %s\n", gitHash) 41 | } 42 | 43 | if currentGitHash == gitHash { 44 | return "", "", fmt.Errorf("git hash %s is already at HEAD", gitHash) 45 | } else { 46 | commitLog, err := gitExecutor.Output("", "git", "log", "--no-merges", fmt.Sprintf("%s..%s", currentGitHash, gitHash)) 47 | if err != nil { 48 | return "", "", err 49 | } 50 | return gitHash, commitLog, nil 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /cmd/promote/iexec/iexec.go: -------------------------------------------------------------------------------- 1 | package iexec 2 | 3 | import ( 4 | "fmt" 5 | "os/exec" 6 | ) 7 | 8 | // This interface is used to abstract the execution of commands 9 | // It defines a single method `execute` that takes a command and its arguments, 10 | // and returns the output as a string and an error if any occurred. 11 | type IExec interface { 12 | Run(dir string, name string, args ...string) error 13 | Output(dir, cmd string, args ...string) (string, error) 14 | CombinedOutput(dir, cmd string, args ...string) (string, error) 15 | } 16 | 17 | type Exec struct { 18 | } 19 | 20 | func (e Exec) Run(dir string, name string, args ...string) error { 21 | cmd := exec.Command(name, args...) 22 | cmd.Dir = dir 23 | 24 | if err := cmd.Run(); err != nil { 25 | return fmt.Errorf("command failed: %v", err) 26 | } 27 | return nil 28 | } 29 | 30 | func (e Exec) Output(dir, cmd string, args ...string) (string, error) { 31 | command := exec.Command(cmd, args...) 32 | // if dir is "" then use the current directory as per https://pkg.go.dev/os/exec#Cmd.Dir 33 | command.Dir = dir 34 | out, err := command.Output() 35 | return string(out), err 36 | } 37 | 38 | func (e Exec) CombinedOutput(dir, cmd string, args ...string) (string, error) { 39 | command := exec.Command(cmd, args...) 40 | command.Dir = dir 41 | out, err := command.CombinedOutput() 42 | return string(out), err 43 | } 44 | -------------------------------------------------------------------------------- /cmd/servicelog/cmd.go: -------------------------------------------------------------------------------- 1 | package servicelog 2 | 3 | import ( 4 | "fmt" 5 | "github.com/spf13/cobra" 6 | ) 7 | 8 | func NewCmdServiceLog() *cobra.Command { 9 | var servicelogCmd = &cobra.Command{ 10 | Use: "servicelog", 11 | Short: "OCM/Hive Service log", 12 | Run: func(cmd *cobra.Command, args []string) { 13 | err := cmd.Help() 14 | if err != nil { 15 | fmt.Println("Error calling cmd.Help(): ", err.Error()) 16 | return 17 | } 18 | }, 19 | } 20 | 21 | servicelogCmd.AddCommand(newListCmd()) 22 | servicelogCmd.AddCommand(newPostCmd()) 23 | 24 | return servicelogCmd 25 | } 26 | -------------------------------------------------------------------------------- /cmd/swarm/cmd.go: -------------------------------------------------------------------------------- 1 | package swarm 2 | 3 | import "github.com/spf13/cobra" 4 | 5 | var Cmd = &cobra.Command{ 6 | Use: "swarm", 7 | Short: "Provides a set of commands for swarming activity", 8 | Args: cobra.NoArgs, 9 | } 10 | 11 | func init() { 12 | Cmd.AddCommand(secondaryCmd) 13 | } 14 | -------------------------------------------------------------------------------- /cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "runtime/debug" 7 | "strings" 8 | 9 | "github.com/openshift/osdctl/pkg/utils" 10 | "github.com/spf13/cobra" 11 | ) 12 | 13 | // versionResponse is necessary for the JSON version response. It uses the three 14 | // variables that get set during the build. 15 | type versionResponse struct { 16 | Commit string `json:"commit"` 17 | Version string `json:"version"` 18 | Latest string `json:"latest"` 19 | } 20 | 21 | // versionCmd is the subcommand "osdctl version" for cobra. 22 | var versionCmd = &cobra.Command{ 23 | Use: "version", 24 | Short: "Display the version", 25 | Long: "Display version of osdctl", 26 | RunE: version, 27 | } 28 | 29 | // version returns the osdctl version marshalled in JSON 30 | func version(cmd *cobra.Command, args []string) error { 31 | gitCommit := "unknown" 32 | 33 | if info, ok := debug.ReadBuildInfo(); ok { 34 | for _, setting := range info.Settings { 35 | if setting.Key == "vcs.revision" { 36 | gitCommit = setting.Value 37 | break 38 | } 39 | } 40 | } 41 | 42 | latest, _ := utils.GetLatestVersion() // let's ignore this error, just in case we have no internet access 43 | ver, err := json.MarshalIndent(&versionResponse{ 44 | Commit: gitCommit, 45 | Version: utils.Version, 46 | Latest: strings.TrimPrefix(latest, "v"), 47 | }, "", " ") 48 | if err != nil { 49 | return err 50 | } 51 | fmt.Println(string(ver)) 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /docs/osdctl_aao.md: -------------------------------------------------------------------------------- 1 | ## osdctl aao 2 | 3 | AWS Account Operator Debugging Utilities 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for aao 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl aao pool](osdctl_aao_pool.md) - Get the status of the AWS Account Operator AccountPool 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_aao_pool.md: -------------------------------------------------------------------------------- 1 | ## osdctl aao pool 2 | 3 | Get the status of the AWS Account Operator AccountPool 4 | 5 | ``` 6 | osdctl aao pool [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for pool 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl aao](osdctl_aao.md) - AWS Account Operator Debugging Utilities 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_account_cli.md: -------------------------------------------------------------------------------- 1 | ## osdctl account cli 2 | 3 | Generate temporary AWS CLI credentials on demand 4 | 5 | ``` 6 | osdctl account cli [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -i, --accountId string AWS Account ID 13 | -h, --help help for cli 14 | -o, --output string Output type 15 | -p, --profile string AWS Profile 16 | -r, --region string Region 17 | --verbose Verbose output 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 24 | --cluster string The name of the kubeconfig cluster to use 25 | --context string The name of the kubeconfig context to use 26 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 27 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 28 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 29 | -s, --server string The address and port of the Kubernetes API server 30 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 31 | -S, --skip-version-check skip checking to see if this is the most recent release 32 | ``` 33 | 34 | ### SEE ALSO 35 | 36 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 37 | 38 | -------------------------------------------------------------------------------- /docs/osdctl_account_console.md: -------------------------------------------------------------------------------- 1 | ## osdctl account console 2 | 3 | Generate an AWS console URL on the fly 4 | 5 | ``` 6 | osdctl account console [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -i, --accountId string AWS Account ID 13 | -d, --duration int32 The duration of the console session. Default value is 3600 seconds(1 hour) (default 3600) 14 | -h, --help help for console 15 | --launch Launch web browser directly 16 | -p, --profile string AWS Profile 17 | -r, --region string Region 18 | --verbose Verbose output 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 25 | --cluster string The name of the kubeconfig cluster to use 26 | --context string The name of the kubeconfig context to use 27 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 28 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 29 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 30 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 31 | -s, --server string The address and port of the Kubernetes API server 32 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 33 | -S, --skip-version-check skip checking to see if this is the most recent release 34 | ``` 35 | 36 | ### SEE ALSO 37 | 38 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 39 | 40 | -------------------------------------------------------------------------------- /docs/osdctl_account_get_aws-account.md: -------------------------------------------------------------------------------- 1 | ## osdctl account get aws-account 2 | 3 | Get AWS Account ID 4 | 5 | ``` 6 | osdctl account get aws-account [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -a, --account string Account CR Name 13 | -c, --account-claim string Account Claim CR Name 14 | -n, --account-claim-ns string Account Claim CR Namespace 15 | --account-namespace string The namespace to keep AWS accounts. The default value is aws-account-operator. (default "aws-account-operator") 16 | -h, --help help for aws-account 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 23 | --cluster string The name of the kubeconfig cluster to use 24 | --context string The name of the kubeconfig context to use 25 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 26 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 27 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 28 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 29 | -s, --server string The address and port of the Kubernetes API server 30 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 31 | -S, --skip-version-check skip checking to see if this is the most recent release 32 | ``` 33 | 34 | ### SEE ALSO 35 | 36 | * [osdctl account get](osdctl_account_get.md) - Get resources 37 | 38 | -------------------------------------------------------------------------------- /docs/osdctl_account_get_legal-entity.md: -------------------------------------------------------------------------------- 1 | ## osdctl account get legal-entity 2 | 3 | Get AWS Account Legal Entity 4 | 5 | ``` 6 | osdctl account get legal-entity [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -i, --account-id string AWS account ID 13 | --account-namespace string The namespace to keep AWS accounts. The default value is aws-account-operator. (default "aws-account-operator") 14 | -h, --help help for legal-entity 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl account get](osdctl_account_get.md) - Get resources 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_account_get_secrets.md: -------------------------------------------------------------------------------- 1 | ## osdctl account get secrets 2 | 3 | Get AWS Account CR related secrets 4 | 5 | ``` 6 | osdctl account get secrets [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -i, --account-id string AWS account ID 13 | --account-namespace string The namespace to keep AWS accounts. The default value is aws-account-operator. (default "aws-account-operator") 14 | -h, --help help for secrets 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl account get](osdctl_account_get.md) - Get resources 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_account_list.md: -------------------------------------------------------------------------------- 1 | ## osdctl account list 2 | 3 | List resources 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for list 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 29 | * [osdctl account list account](osdctl_account_list_account.md) - List AWS Account CR 30 | * [osdctl account list account-claim](osdctl_account_list_account-claim.md) - List AWS Account Claim CR 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_account_list_account-claim.md: -------------------------------------------------------------------------------- 1 | ## osdctl account list account-claim 2 | 3 | List AWS Account Claim CR 4 | 5 | ``` 6 | osdctl account list account-claim [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for account-claim 13 | --state string Account cr state. If not specified, it will list all crs by default. 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 25 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 26 | -s, --server string The address and port of the Kubernetes API server 27 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 28 | -S, --skip-version-check skip checking to see if this is the most recent release 29 | ``` 30 | 31 | ### SEE ALSO 32 | 33 | * [osdctl account list](osdctl_account_list.md) - List resources 34 | 35 | -------------------------------------------------------------------------------- /docs/osdctl_account_mgmt.md: -------------------------------------------------------------------------------- 1 | ## osdctl account mgmt 2 | 3 | AWS Account Management 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for mgmt 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 29 | * [osdctl account mgmt assign](osdctl_account_mgmt_assign.md) - Assign account to user 30 | * [osdctl account mgmt iam](osdctl_account_mgmt_iam.md) - Creates an IAM user in a given AWS account and prints out the credentials 31 | * [osdctl account mgmt list](osdctl_account_mgmt_list.md) - List out accounts for username 32 | * [osdctl account mgmt unassign](osdctl_account_mgmt_unassign.md) - Unassign account to user 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_account_mgmt_iam.md: -------------------------------------------------------------------------------- 1 | ## osdctl account mgmt iam 2 | 3 | Creates an IAM user in a given AWS account and prints out the credentials 4 | 5 | ``` 6 | osdctl account mgmt iam [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -i, --accountId string AWS account ID to run this against 13 | -h, --help help for iam 14 | -p, --profile string AWS Profile 15 | -r, --region string AWS Region 16 | -R, --rotate Rotate an IAM user's credentials and print the output 17 | -u, --user string Kerberos username to run this for 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 24 | --cluster string The name of the kubeconfig cluster to use 25 | --context string The name of the kubeconfig context to use 26 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 27 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 28 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 29 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 30 | -s, --server string The address and port of the Kubernetes API server 31 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 32 | -S, --skip-version-check skip checking to see if this is the most recent release 33 | ``` 34 | 35 | ### SEE ALSO 36 | 37 | * [osdctl account mgmt](osdctl_account_mgmt.md) - AWS Account Management 38 | 39 | -------------------------------------------------------------------------------- /docs/osdctl_account_reset.md: -------------------------------------------------------------------------------- 1 | ## osdctl account reset 2 | 3 | Reset AWS Account CR 4 | 5 | ``` 6 | osdctl account reset [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --account-namespace string The namespace to keep AWS accounts. The default value is aws-account-operator. (default "aws-account-operator") 13 | -h, --help help for reset 14 | --reset-legalentity This will wipe the legalEntity, claimLink and reused fields, allowing accounts to be used for different Legal Entities. 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_account_servicequotas.md: -------------------------------------------------------------------------------- 1 | ## osdctl account servicequotas 2 | 3 | Interact with AWS service-quotas 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for servicequotas 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 29 | * [osdctl account servicequotas describe](osdctl_account_servicequotas_describe.md) - Describe AWS service-quotas 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_account_servicequotas_describe.md: -------------------------------------------------------------------------------- 1 | ## osdctl account servicequotas describe 2 | 3 | Describe AWS service-quotas 4 | 5 | ``` 6 | osdctl account servicequotas describe [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -C, --clusterID string Cluster ID 13 | -h, --help help for describe 14 | -p, --profile string AWS Profile 15 | -q, --quota-code string Query for QuotaCode (default "L-1216C47A") 16 | --service-code string Query for ServiceCode (default "ec2") 17 | --verbose Verbose output 18 | ``` 19 | 20 | ### Options inherited from parent commands 21 | 22 | ``` 23 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 24 | --cluster string The name of the kubeconfig cluster to use 25 | --context string The name of the kubeconfig context to use 26 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 27 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 28 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 29 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 30 | -s, --server string The address and port of the Kubernetes API server 31 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 32 | -S, --skip-version-check skip checking to see if this is the most recent release 33 | ``` 34 | 35 | ### SEE ALSO 36 | 37 | * [osdctl account servicequotas](osdctl_account_servicequotas.md) - Interact with AWS service-quotas 38 | 39 | -------------------------------------------------------------------------------- /docs/osdctl_account_verify-secrets.md: -------------------------------------------------------------------------------- 1 | ## osdctl account verify-secrets 2 | 3 | Verify AWS Account CR IAM User credentials 4 | 5 | ``` 6 | osdctl account verify-secrets [] [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --account-namespace string The namespace to keep AWS accounts. The default value is aws-account-operator. (default "aws-account-operator") 13 | -A, --all Verify all Account CRs 14 | -h, --help help for verify-secrets 15 | --verbose Verbose output 16 | ``` 17 | 18 | ### Options inherited from parent commands 19 | 20 | ``` 21 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 22 | --cluster string The name of the kubeconfig cluster to use 23 | --context string The name of the kubeconfig context to use 24 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 25 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 26 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 27 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 28 | -s, --server string The address and port of the Kubernetes API server 29 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 30 | -S, --skip-version-check skip checking to see if this is the most recent release 31 | ``` 32 | 33 | ### SEE ALSO 34 | 35 | * [osdctl account](osdctl_account.md) - AWS Account related utilities 36 | 37 | -------------------------------------------------------------------------------- /docs/osdctl_alert.md: -------------------------------------------------------------------------------- 1 | ## osdctl alert 2 | 3 | List alerts 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for alert 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl alert list](osdctl_alert_list.md) - List all alerts or based on severity 30 | * [osdctl alert silence](osdctl_alert_silence.md) - add, expire and list silence associated with alerts 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_alert_silence.md: -------------------------------------------------------------------------------- 1 | ## osdctl alert silence 2 | 3 | add, expire and list silence associated with alerts 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for silence 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl alert](osdctl_alert.md) - List alerts 29 | * [osdctl alert silence add](osdctl_alert_silence_add.md) - Add new silence for alert 30 | * [osdctl alert silence expire](osdctl_alert_silence_expire.md) - Expire Silence for alert 31 | * [osdctl alert silence list](osdctl_alert_silence_list.md) - List all silences 32 | * [osdctl alert silence org](osdctl_alert_silence_org.md) - Add new silence for alert for org 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_alert_silence_list.md: -------------------------------------------------------------------------------- 1 | ## osdctl alert silence list 2 | 3 | List all silences 4 | 5 | ### Synopsis 6 | 7 | print the list of silences 8 | 9 | ``` 10 | osdctl alert silence list --cluster-id [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --cluster-id string Provide the internal ID of the cluster 17 | -h, --help help for list 18 | --reason string The reason for this command, which requires elevation, to be run (usualy an OHSS or PD ticket) 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 25 | --cluster string The name of the kubeconfig cluster to use 26 | --context string The name of the kubeconfig context to use 27 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 28 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 29 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 30 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 31 | -s, --server string The address and port of the Kubernetes API server 32 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 33 | -S, --skip-version-check skip checking to see if this is the most recent release 34 | ``` 35 | 36 | ### SEE ALSO 37 | 38 | * [osdctl alert silence](osdctl_alert_silence.md) - add, expire and list silence associated with alerts 39 | 40 | -------------------------------------------------------------------------------- /docs/osdctl_cloudtrail.md: -------------------------------------------------------------------------------- 1 | ## osdctl cloudtrail 2 | 3 | AWS CloudTrail related utilities 4 | 5 | ``` 6 | osdctl cloudtrail [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for cloudtrail 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl](osdctl.md) - OSD CLI 33 | * [osdctl cloudtrail permission-denied-events](osdctl_cloudtrail_permission-denied-events.md) - Prints cloudtrail permission-denied events to console. 34 | * [osdctl cloudtrail write-events](osdctl_cloudtrail_write-events.md) - Prints cloudtrail write events to console with optional filtering 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_check-banned-user.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster check-banned-user 2 | 3 | Checks if the cluster owner is a banned user. 4 | 5 | ``` 6 | osdctl cluster check-banned-user --cluster-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -c, --cluster-id string Provide internal ID of the cluster 13 | -h, --help help for check-banned-user 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 25 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 26 | -s, --server string The address and port of the Kubernetes API server 27 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 28 | -S, --skip-version-check skip checking to see if this is the most recent release 29 | ``` 30 | 31 | ### SEE ALSO 32 | 33 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 34 | 35 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_detach-stuck-volume.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster detach-stuck-volume 2 | 3 | Detach openshift-monitoring namespace's volume from a cluster forcefully 4 | 5 | ``` 6 | osdctl cluster detach-stuck-volume --cluster-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --cluster-id string Provide internal ID of the cluster 13 | -h, --help help for detach-stuck-volume 14 | --reason string The reason for this command, which requires elevation, to be run (usually an OHSS or PD ticket) 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_etcd-health-check.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster etcd-health-check 2 | 3 | Checks the etcd components and member health 4 | 5 | ### Synopsis 6 | 7 | Checks etcd component health status for member replacement 8 | 9 | ``` 10 | osdctl cluster etcd-health-check --cluster-id --reason [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --cluster-id string Provide the internal Cluster ID or name to perform health check on 17 | -h, --help help for etcd-health-check 18 | --reason string Specify a reason for privilege escalation 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 25 | --cluster string The name of the kubeconfig cluster to use 26 | --context string The name of the kubeconfig context to use 27 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 28 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 29 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 30 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 31 | -s, --server string The address and port of the Kubernetes API server 32 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 33 | -S, --skip-version-check skip checking to see if this is the most recent release 34 | ``` 35 | 36 | ### SEE ALSO 37 | 38 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 39 | 40 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_from-infra-id.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster from-infra-id 2 | 3 | Get cluster ID and external ID from a given infrastructure ID commonly used by Splunk 4 | 5 | ``` 6 | osdctl cluster from-infra-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for from-infra-id 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_health.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster health 2 | 3 | Describes health of cluster nodes and provides other cluster vitals. 4 | 5 | ``` 6 | osdctl cluster health [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -C, --cluster-id string Internal Cluster ID 13 | -h, --help help for health 14 | -p, --profile string AWS Profile 15 | --verbose Verbose output 16 | ``` 17 | 18 | ### Options inherited from parent commands 19 | 20 | ``` 21 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 22 | --cluster string The name of the kubeconfig cluster to use 23 | --context string The name of the kubeconfig context to use 24 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 25 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 26 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 27 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 28 | -s, --server string The address and port of the Kubernetes API server 29 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 30 | -S, --skip-version-check skip checking to see if this is the most recent release 31 | ``` 32 | 33 | ### SEE ALSO 34 | 35 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 36 | 37 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_logging-check.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster logging-check 2 | 3 | Shows the logging support status of a specified cluster 4 | 5 | ``` 6 | osdctl cluster logging-check --cluster-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -c, --cluster-id string The internal ID of the cluster to check (required) 13 | -h, --help help for logging-check 14 | --verbose Verbose output 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl cluster](osdctl_cluster.md) - Provides information for a specified cluster 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_cluster_orgId.md: -------------------------------------------------------------------------------- 1 | ## osdctl cluster orgId 2 | 3 | Get the OCM org ID for a given cluster 4 | 5 | ``` 6 | osdctl cluster orgId --cluster-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -c, --cluster-id string Cluster ID for which to get support status 13 | -h, --help help for status 14 | --verbose Verbose output 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl cluster support](osdctl_cluster_support.md) - Cluster Support 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_cost_create.md: -------------------------------------------------------------------------------- 1 | ## osdctl cost create 2 | 3 | Create a cost category for the given OU 4 | 5 | ``` 6 | osdctl cost create [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for create 13 | --ou string get OU ID 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | -a, --aws-access-key-id string AWS Access Key ID 21 | -c, --aws-config string specify AWS config file path 22 | -p, --aws-profile string specify AWS profile 23 | -g, --aws-region string specify AWS region (default "us-east-1") 24 | -x, --aws-secret-access-key string AWS Secret Access Key 25 | --cluster string The name of the kubeconfig cluster to use 26 | --context string The name of the kubeconfig context to use 27 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 28 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 29 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 30 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 31 | -s, --server string The address and port of the Kubernetes API server 32 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 33 | -S, --skip-version-check skip checking to see if this is the most recent release 34 | ``` 35 | 36 | ### SEE ALSO 37 | 38 | * [osdctl cost](osdctl_cost.md) - Cost Management related utilities 39 | 40 | -------------------------------------------------------------------------------- /docs/osdctl_dynatrace.md: -------------------------------------------------------------------------------- 1 | ## osdctl dynatrace 2 | 3 | Dynatrace related utilities 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for dynatrace 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl dynatrace dashboard](osdctl_dynatrace_dashboard.md) - Get the Dyntrace Cluster Overview Dashboard for a given MC or HCP cluster 30 | * [osdctl dynatrace gather-logs](osdctl_dynatrace_gather-logs.md) - Gather all Pod logs and Application event from HCP 31 | * [osdctl dynatrace logs](osdctl_dynatrace_logs.md) - Fetch logs from Dynatrace 32 | * [osdctl dynatrace url](osdctl_dynatrace_url.md) - Get the Dynatrace Tenant URL for a given MC or HCP cluster 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_dynatrace_dashboard.md: -------------------------------------------------------------------------------- 1 | ## osdctl dynatrace dashboard 2 | 3 | Get the Dyntrace Cluster Overview Dashboard for a given MC or HCP cluster 4 | 5 | ``` 6 | osdctl dynatrace dashboard --cluster-id CLUSTER_ID [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --cluster-id string Provide the id of the cluster 13 | --dash string Name of the dashboard you wish to find (default "Central ROSA HCP Dashboard") 14 | -h, --help help for dashboard 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl dynatrace](osdctl_dynatrace.md) - Dynatrace related utilities 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_dynatrace_url.md: -------------------------------------------------------------------------------- 1 | ## osdctl dynatrace url 2 | 3 | Get the Dynatrace Tenant URL for a given MC or HCP cluster 4 | 5 | ``` 6 | osdctl dynatrace url --cluster-id [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --cluster-id string ID of the cluster 13 | -h, --help help for url 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 25 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 26 | -s, --server string The address and port of the Kubernetes API server 27 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 28 | -S, --skip-version-check skip checking to see if this is the most recent release 29 | ``` 30 | 31 | ### SEE ALSO 32 | 33 | * [osdctl dynatrace](osdctl_dynatrace.md) - Dynatrace related utilities 34 | 35 | -------------------------------------------------------------------------------- /docs/osdctl_hcp.md: -------------------------------------------------------------------------------- 1 | ## osdctl hcp 2 | 3 | 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for hcp 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl hcp must-gather](osdctl_hcp_must-gather.md) - Create a must-gather for HCP cluster 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_hive.md: -------------------------------------------------------------------------------- 1 | ## osdctl hive 2 | 3 | hive related utilities 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for hive 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl hive clusterdeployment](osdctl_hive_clusterdeployment.md) - cluster deployment related utilities 30 | * [osdctl hive clustersync-failures](osdctl_hive_clustersync-failures.md) - List clustersync failures 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_hive_clusterdeployment.md: -------------------------------------------------------------------------------- 1 | ## osdctl hive clusterdeployment 2 | 3 | cluster deployment related utilities 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for clusterdeployment 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl hive](osdctl_hive.md) - hive related utilities 29 | * [osdctl hive clusterdeployment list](osdctl_hive_clusterdeployment_list.md) - List cluster deployment crs 30 | * [osdctl hive clusterdeployment listresources](osdctl_hive_clusterdeployment_listresources.md) - List all resources on a hive cluster related to a given cluster 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_hive_clusterdeployment_list.md: -------------------------------------------------------------------------------- 1 | ## osdctl hive clusterdeployment list 2 | 3 | List cluster deployment crs 4 | 5 | ``` 6 | osdctl hive clusterdeployment list [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for list 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl hive clusterdeployment](osdctl_hive_clusterdeployment.md) - cluster deployment related utilities 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_hive_clusterdeployment_listresources.md: -------------------------------------------------------------------------------- 1 | ## osdctl hive clusterdeployment listresources 2 | 3 | List all resources on a hive cluster related to a given cluster 4 | 5 | ``` 6 | osdctl hive clusterdeployment listresources [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -C, --cluster-id string Cluster ID 13 | -e, --external only list external resources (i.e. exclude resources in cluster namespace) 14 | -h, --help help for listresources 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl hive clusterdeployment](osdctl_hive_clusterdeployment.md) - cluster deployment related utilities 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_iampermissions_diff.md: -------------------------------------------------------------------------------- 1 | ## osdctl iampermissions diff 2 | 3 | Diff IAM permissions for cluster operators between two versions 4 | 5 | ``` 6 | osdctl iampermissions diff [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -b, --base-version string 13 | -h, --help help for diff 14 | -t, --target-version string 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | -c, --cloud CloudSpec cloud for which the policies should be retrieved. supported values: [aws, sts, gcp, wif] (default aws) 22 | --cluster string The name of the kubeconfig cluster to use 23 | --context string The name of the kubeconfig context to use 24 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 25 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 26 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 27 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 28 | -s, --server string The address and port of the Kubernetes API server 29 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 30 | -S, --skip-version-check skip checking to see if this is the most recent release 31 | ``` 32 | 33 | ### SEE ALSO 34 | 35 | * [osdctl iampermissions](osdctl_iampermissions.md) - STS/WIF utilities 36 | 37 | -------------------------------------------------------------------------------- /docs/osdctl_iampermissions_get.md: -------------------------------------------------------------------------------- 1 | ## osdctl iampermissions get 2 | 3 | Get OCP CredentialsRequests 4 | 5 | ``` 6 | osdctl iampermissions get [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for get 13 | -r, --release-version string 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | -c, --cloud CloudSpec cloud for which the policies should be retrieved. supported values: [aws, sts, gcp, wif] (default aws) 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl iampermissions](osdctl_iampermissions.md) - STS/WIF utilities 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_jira.md: -------------------------------------------------------------------------------- 1 | ## osdctl jira 2 | 3 | Provides a set of commands for interacting with Jira 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for jira 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl jira quick-task](osdctl_jira_quick-task.md) - creates a new ticket with the given name 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_jumphost.md: -------------------------------------------------------------------------------- 1 | ## osdctl jumphost 2 | 3 | 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for jumphost 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl jumphost create](osdctl_jumphost_create.md) - Create a jumphost for emergency SSH access to a cluster's VMs 30 | * [osdctl jumphost delete](osdctl_jumphost_delete.md) - Delete a jumphost created by `osdctl jumphost create` 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_mc.md: -------------------------------------------------------------------------------- 1 | ## osdctl mc 2 | 3 | 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for mc 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl mc list](osdctl_mc_list.md) - List ROSA HCP Management Clusters 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_mc_list.md: -------------------------------------------------------------------------------- 1 | ## osdctl mc list 2 | 3 | List ROSA HCP Management Clusters 4 | 5 | ### Synopsis 6 | 7 | List ROSA HCP Management Clusters. 8 | 9 | ``` 10 | osdctl mc list [flags] 11 | ``` 12 | 13 | ### Examples 14 | 15 | ``` 16 | osdctl mc list 17 | ``` 18 | 19 | ### Options 20 | 21 | ``` 22 | -h, --help help for list 23 | --output string Output format. Supported output formats include: table, text, json, yaml (default "table") 24 | ``` 25 | 26 | ### Options inherited from parent commands 27 | 28 | ``` 29 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 30 | --cluster string The name of the kubeconfig cluster to use 31 | --context string The name of the kubeconfig context to use 32 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 33 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 34 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 35 | -s, --server string The address and port of the Kubernetes API server 36 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 37 | -S, --skip-version-check skip checking to see if this is the most recent release 38 | ``` 39 | 40 | ### SEE ALSO 41 | 42 | * [osdctl mc](osdctl_mc.md) - 43 | 44 | -------------------------------------------------------------------------------- /docs/osdctl_network.md: -------------------------------------------------------------------------------- 1 | ## osdctl network 2 | 3 | network related utilities 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for network 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl network packet-capture](osdctl_network_packet-capture.md) - Start packet capture 30 | * [osdctl network verify-egress](osdctl_network_verify-egress.md) - Verify an AWS OSD/ROSA cluster can reach all required external URLs necessary for full support. 31 | 32 | -------------------------------------------------------------------------------- /docs/osdctl_org_aws-accounts.md: -------------------------------------------------------------------------------- 1 | ## osdctl org aws-accounts 2 | 3 | get organization AWS Accounts 4 | 5 | ``` 6 | osdctl org aws-accounts [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -p, --aws-profile string specify AWS profile 13 | -h, --help help for aws-accounts 14 | --ou-id string specify organization unit id 15 | -o, --output string valid output formats are ['', 'json'] 16 | ``` 17 | 18 | ### Options inherited from parent commands 19 | 20 | ``` 21 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 22 | --cluster string The name of the kubeconfig cluster to use 23 | --context string The name of the kubeconfig context to use 24 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 25 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 26 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 27 | -s, --server string The address and port of the Kubernetes API server 28 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 29 | -S, --skip-version-check skip checking to see if this is the most recent release 30 | ``` 31 | 32 | ### SEE ALSO 33 | 34 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_org_current.md: -------------------------------------------------------------------------------- 1 | ## osdctl org current 2 | 3 | gets current organization 4 | 5 | ``` 6 | osdctl org current [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for current 13 | -o, --output string valid output formats are ['', 'json'] 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_org_customers.md: -------------------------------------------------------------------------------- 1 | ## osdctl org customers 2 | 3 | get paying/non-paying organizations 4 | 5 | ``` 6 | osdctl org customers [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for customers 13 | -o, --output string valid output formats are ['', 'json'] 14 | --paying get organization based on paying status (default true) 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 21 | --cluster string The name of the kubeconfig cluster to use 22 | --context string The name of the kubeconfig context to use 23 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 24 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 25 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 26 | -s, --server string The address and port of the Kubernetes API server 27 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 28 | -S, --skip-version-check skip checking to see if this is the most recent release 29 | ``` 30 | 31 | ### SEE ALSO 32 | 33 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 34 | 35 | -------------------------------------------------------------------------------- /docs/osdctl_org_describe.md: -------------------------------------------------------------------------------- 1 | ## osdctl org describe 2 | 3 | describe organization 4 | 5 | ``` 6 | osdctl org describe [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for describe 13 | -o, --output string valid output formats are ['', 'json'] 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_org_get.md: -------------------------------------------------------------------------------- 1 | ## osdctl org get 2 | 3 | get organization by users 4 | 5 | ``` 6 | osdctl org get [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | --ebs-id string search organization by ebs account id 13 | -h, --help help for get 14 | -o, --output string valid output formats are ['', 'json'] 15 | --part-match Part matching user name 16 | -u, --user string search organization by user name 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 23 | --cluster string The name of the kubeconfig cluster to use 24 | --context string The name of the kubeconfig context to use 25 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 26 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 27 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 28 | -s, --server string The address and port of the Kubernetes API server 29 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 30 | -S, --skip-version-check skip checking to see if this is the most recent release 31 | ``` 32 | 33 | ### SEE ALSO 34 | 35 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 36 | 37 | -------------------------------------------------------------------------------- /docs/osdctl_org_labels.md: -------------------------------------------------------------------------------- 1 | ## osdctl org labels 2 | 3 | get organization labels 4 | 5 | ``` 6 | osdctl org labels [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for labels 13 | -o, --output string valid output formats are ['', 'json'] 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_org_users.md: -------------------------------------------------------------------------------- 1 | ## osdctl org users 2 | 3 | get organization users 4 | 5 | ``` 6 | osdctl org users [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for users 13 | -o, --output string valid output formats are ['', 'json'] 14 | ``` 15 | 16 | ### Options inherited from parent commands 17 | 18 | ``` 19 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 20 | --cluster string The name of the kubeconfig cluster to use 21 | --context string The name of the kubeconfig context to use 22 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 23 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl org](osdctl_org.md) - Provides information for a specified organization 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_promote.md: -------------------------------------------------------------------------------- 1 | ## osdctl promote 2 | 3 | Utilities to promote services/operators 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for promote 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl promote dynatrace](osdctl_promote_dynatrace.md) - Utilities to promote dynatrace 30 | * [osdctl promote package](osdctl_promote_package.md) - Utilities to promote package-operator services 31 | * [osdctl promote saas](osdctl_promote_saas.md) - Utilities to promote SaaS services/operators 32 | 33 | -------------------------------------------------------------------------------- /docs/osdctl_servicelog.md: -------------------------------------------------------------------------------- 1 | ## osdctl servicelog 2 | 3 | OCM/Hive Service log 4 | 5 | ``` 6 | osdctl servicelog [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for servicelog 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl](osdctl.md) - OSD CLI 33 | * [osdctl servicelog list](osdctl_servicelog_list.md) - Get service logs for a given cluster identifier. 34 | * [osdctl servicelog post](osdctl_servicelog_post.md) - Post a service log to a cluster or list of clusters 35 | 36 | -------------------------------------------------------------------------------- /docs/osdctl_setup.md: -------------------------------------------------------------------------------- 1 | ## osdctl setup 2 | 3 | Setup the configuration 4 | 5 | ``` 6 | osdctl setup [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for setup 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 19 | --cluster string The name of the kubeconfig cluster to use 20 | --context string The name of the kubeconfig context to use 21 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 22 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 23 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 24 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 25 | -s, --server string The address and port of the Kubernetes API server 26 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 27 | -S, --skip-version-check skip checking to see if this is the most recent release 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [osdctl](osdctl.md) - OSD CLI 33 | 34 | -------------------------------------------------------------------------------- /docs/osdctl_swarm.md: -------------------------------------------------------------------------------- 1 | ## osdctl swarm 2 | 3 | Provides a set of commands for swarming activity 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for swarm 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 15 | --cluster string The name of the kubeconfig cluster to use 16 | --context string The name of the kubeconfig context to use 17 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 18 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 19 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 20 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 21 | -s, --server string The address and port of the Kubernetes API server 22 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 23 | -S, --skip-version-check skip checking to see if this is the most recent release 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [osdctl](osdctl.md) - OSD CLI 29 | * [osdctl swarm secondary](osdctl_swarm_secondary.md) - List unassigned JIRA issues based on criteria 30 | 31 | -------------------------------------------------------------------------------- /docs/osdctl_upgrade.md: -------------------------------------------------------------------------------- 1 | ## osdctl upgrade 2 | 3 | Upgrade osdctl 4 | 5 | ### Synopsis 6 | 7 | Fetch latest osdctl from GitHub and replace the running binary 8 | 9 | ``` 10 | osdctl upgrade [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for upgrade 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 23 | --cluster string The name of the kubeconfig cluster to use 24 | --context string The name of the kubeconfig context to use 25 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 26 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 27 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 28 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 29 | -s, --server string The address and port of the Kubernetes API server 30 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 31 | -S, --skip-version-check skip checking to see if this is the most recent release 32 | ``` 33 | 34 | ### SEE ALSO 35 | 36 | * [osdctl](osdctl.md) - OSD CLI 37 | 38 | -------------------------------------------------------------------------------- /docs/osdctl_version.md: -------------------------------------------------------------------------------- 1 | ## osdctl version 2 | 3 | Display the version 4 | 5 | ### Synopsis 6 | 7 | Display version of osdctl 8 | 9 | ``` 10 | osdctl version [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for version 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 23 | --cluster string The name of the kubeconfig cluster to use 24 | --context string The name of the kubeconfig context to use 25 | --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 26 | --kubeconfig string Path to the kubeconfig file to use for CLI requests. 27 | -o, --output string Valid formats are ['', 'json', 'yaml', 'env'] 28 | --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 29 | -s, --server string The address and port of the Kubernetes API server 30 | --skip-aws-proxy-check aws_proxy Don't use the configured aws_proxy value 31 | -S, --skip-version-check skip checking to see if this is the most recent release 32 | ``` 33 | 34 | ### SEE ALSO 35 | 36 | * [osdctl](osdctl.md) - OSD CLI 37 | 38 | -------------------------------------------------------------------------------- /hack/example_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "severity": "Info", 3 | "service_name": "Manual", 4 | "cluster_uuid": "${CLUSTER_UUID}", 5 | "summary": "Test cluster notification basic event notification type", 6 | "description": "This is an example of a cluster log entry for test purposes. This entry should have sent an email notification to the cluster owner. A support case has been opened: https://access.redhat.com/support/cases/#/case/${CASE_ID}", 7 | "internal_only": false 8 | } -------------------------------------------------------------------------------- /internal/servicelog/clustersFile.go: -------------------------------------------------------------------------------- 1 | package servicelog 2 | 3 | type ClustersFile struct { 4 | Clusters []string `json:"clusters"` 5 | } 6 | -------------------------------------------------------------------------------- /internal/servicelog/reply.go: -------------------------------------------------------------------------------- 1 | package servicelog 2 | 3 | import "time" 4 | 5 | type GoodReply struct { 6 | ID string `json:"id"` 7 | Kind string `json:"kind"` 8 | Href string `json:"href"` 9 | Timestamp time.Time `json:"timestamp"` 10 | Severity string `json:"severity"` 11 | ServiceName string `json:"service_name"` 12 | ClusterUUID string `json:"cluster_uuid"` 13 | Summary string `json:"summary"` 14 | Description string `json:"description"` 15 | EventStreamID string `json:"event_stream_id"` 16 | CreatedAt time.Time `json:"created_at"` 17 | } 18 | 19 | type ClusterListGoodReply struct { 20 | Kind string `json:"kind"` 21 | Page int `json:"page"` 22 | Size int `json:"size"` 23 | Total int `json:"total"` 24 | Items []GoodReply `json:"items"` 25 | } 26 | 27 | type BadReply struct { 28 | ID string `json:"id"` 29 | Kind string `json:"kind"` 30 | Href string `json:"href"` 31 | Code string `json:"code"` 32 | Reason string `json:"reason"` 33 | OperationID string `json:"operation_id"` 34 | } 35 | -------------------------------------------------------------------------------- /internal/support/template.go: -------------------------------------------------------------------------------- 1 | package support 2 | 3 | // BadReply is the template for bad reply 4 | type BadReply struct { 5 | ID string `json:"id"` 6 | Kind string `json:"kind"` 7 | Href string `json:"href"` 8 | Code string `json:"code"` 9 | Reason string `json:"reason"` 10 | Details []struct { 11 | Description string `json:"description"` 12 | } `json:"details"` 13 | } 14 | -------------------------------------------------------------------------------- /internal/utils/errors.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import "fmt" 4 | 5 | // argError denotes that a function's argument was passed incorrectly. 6 | type argError struct { 7 | message string 8 | } 9 | 10 | func (e argError) Error() string { 11 | return fmt.Sprintf("Argument error: %s", e.message) 12 | } 13 | 14 | type missingFileError struct { 15 | FilePath string 16 | } 17 | 18 | func (e missingFileError) Error() string { 19 | return fmt.Sprintf("file %s not found", e.FilePath) 20 | } 21 | -------------------------------------------------------------------------------- /internal/utils/file.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | osFile "path/filepath" 8 | 9 | log "github.com/sirupsen/logrus" 10 | ) 11 | 12 | // Exists reports whether the named file or directory exists. 13 | func exists(path string, isDir bool) bool { 14 | if path == "" { 15 | log.Debug("Path is empty") 16 | return false 17 | } 18 | 19 | info, err := os.Stat(path) 20 | if err != nil { 21 | if os.IsNotExist(err) || os.IsPermission(err) { 22 | return false 23 | } 24 | } 25 | 26 | return isDir == info.IsDir() 27 | } 28 | 29 | // FolderExists reports whether the provided directory exists. 30 | func FolderExists(path string) bool { 31 | return exists(path, true) 32 | } 33 | 34 | // FileExists reports whether the provided file exists. 35 | func FileExists(path string) bool { 36 | return exists(path, false) 37 | } 38 | 39 | // CreateFile creates a file on the given filepath 40 | // along with any necessary parents, and returns nil, 41 | // or else returns an error. 42 | func CreateFile(filepath string) error { 43 | filepath = osFile.Clean(filepath) 44 | // Avoid file truncate and return error instead 45 | if FileExists(filepath) { 46 | return fmt.Errorf("file %s already exists", filepath) 47 | } 48 | 49 | // Create the parent directory if doesn't exist 50 | if directory := osFile.Dir(filepath); !FolderExists(directory) { 51 | if err := os.MkdirAll(directory, 0750); err != nil { 52 | return fmt.Errorf("failed to create directory %v", directory) 53 | } 54 | } 55 | file, err := os.Create(filepath) //#nosec G304 -- ignore potential file inclusion via variable 56 | if err != nil { 57 | return fmt.Errorf("failed to create file %v: %w", filepath, err) 58 | } 59 | defer func() { 60 | if err := file.Close(); err != nil { 61 | fmt.Println("Error closing file", filepath) 62 | } 63 | }() 64 | 65 | return nil 66 | } 67 | -------------------------------------------------------------------------------- /internal/utils/globalflags/globalflags.go: -------------------------------------------------------------------------------- 1 | package globalflags 2 | 3 | import ( 4 | awsSdk "github.com/aws/aws-sdk-go-v2/aws" 5 | "github.com/openshift/osdctl/pkg/provider/aws" 6 | "github.com/spf13/cobra" 7 | "k8s.io/cli-runtime/pkg/genericclioptions" 8 | ) 9 | 10 | // GlobalOptions defines all available commands 11 | type GlobalOptions struct { 12 | Output string 13 | SkipVersionCheck bool 14 | NoAwsProxy bool 15 | } 16 | 17 | // AddGlobalFlags adds the Global Flags to the root command 18 | func AddGlobalFlags(cmd *cobra.Command, opts *GlobalOptions) { 19 | cmd.PersistentFlags().StringVarP(&opts.Output, "output", "o", "", "Valid formats are ['', 'json', 'yaml', 'env']") 20 | cmd.PersistentFlags().BoolVarP(&opts.SkipVersionCheck, "skip-version-check", "S", false, "skip checking to see if this is the most recent release") 21 | cmd.PersistentFlags().BoolVar(&opts.NoAwsProxy, aws.NoProxyFlag, false, "Don't use the configured `aws_proxy` value") 22 | } 23 | 24 | // GetFlags adds the kubeFlags we care about and adds the flags from the provided command 25 | func GetFlags(cmd *cobra.Command) *genericclioptions.ConfigFlags { 26 | // Reuse kubectl global flags to provide namespace, context and credential options. 27 | // We are not using NewConfigFlags here to avoid adding too many flags 28 | flags := &genericclioptions.ConfigFlags{ 29 | KubeConfig: awsSdk.String(""), 30 | ClusterName: awsSdk.String(""), 31 | Context: awsSdk.String(""), 32 | APIServer: awsSdk.String(""), 33 | Timeout: awsSdk.String("0"), 34 | Insecure: awsSdk.Bool(false), 35 | Impersonate: awsSdk.String(""), 36 | } 37 | flags.AddFlags(cmd.PersistentFlags()) 38 | return flags 39 | } 40 | -------------------------------------------------------------------------------- /internal/utils/network.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "net/http" 7 | "net/url" 8 | "time" 9 | ) 10 | 11 | // IsOnline checks the provided URL for connectivity 12 | func IsOnline(url url.URL) error { 13 | timeout := 2 * time.Second 14 | client := http.Client{ 15 | Timeout: timeout, 16 | } 17 | resp, err := client.Get(url.String()) 18 | 19 | if err != nil { 20 | return fmt.Errorf("%w", err) 21 | } 22 | defer resp.Body.Close() 23 | 24 | if resp.StatusCode >= 200 && resp.StatusCode < 300 { 25 | return nil 26 | } 27 | 28 | // Non-200 http statuses are considered error 29 | return fmt.Errorf("timeout or unknown HTTP error, while trying to access %q", url.String()) 30 | } 31 | 32 | // IsValidUrl tests a string to determine if it is a well-structured url or not. 33 | func IsValidUrl(toTest string) bool { 34 | _, err := url.ParseRequestURI(toTest) 35 | if err != nil { 36 | return false 37 | } 38 | 39 | u, err := url.Parse(toTest) 40 | if err != nil || u.Scheme == "" || u.Host == "" { 41 | return false 42 | } 43 | 44 | return true 45 | } 46 | 47 | func CurlThis(webpage string) (body []byte, err error) { 48 | // For the following line we have to disable the gosec linter, otherwise G107 will get thrown 49 | // G107 is about handling non const URLs. We are reading a URL from a file. This can be malicious. 50 | resp, err := http.Get(webpage) //#nosec G107 -- url cannot be constant 51 | defer func() { 52 | err = resp.Body.Close() 53 | }() 54 | if resp.StatusCode == http.StatusOK { 55 | bodyBytes, err := io.ReadAll(resp.Body) 56 | if err != nil { 57 | return body, err 58 | } 59 | body = bodyBytes 60 | } 61 | return body, err 62 | } 63 | -------------------------------------------------------------------------------- /internal/utils/testdata/a-folder-that-exists/file.txt: -------------------------------------------------------------------------------- 1 | package a_folder_that_exists 2 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/openshift/osdctl/cmd" 8 | "github.com/openshift/osdctl/pkg/osdctlConfig" 9 | 10 | "k8s.io/cli-runtime/pkg/genericclioptions" 11 | ) 12 | 13 | func main() { 14 | 15 | err := osdctlConfig.EnsureConfigFile() 16 | if err != nil { 17 | fmt.Println(err) 18 | return 19 | } 20 | 21 | command := cmd.NewCmdRoot(genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) 22 | 23 | if err := command.Execute(); err != nil { 24 | _, err := fmt.Fprintf(os.Stderr, "%v\n", err) 25 | if err != nil { 26 | fmt.Println("Error while printing to stderr: ", err.Error()) 27 | } 28 | os.Exit(1) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pkg/graphviz/graphviz.go: -------------------------------------------------------------------------------- 1 | package graphviz 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | type Node struct { 9 | Id string 10 | AdditionalInformation string 11 | Subgraph string 12 | } 13 | 14 | func (n *Node) Render() string { 15 | return fmt.Sprintf("%s\\n%s", n.AdditionalInformation, n.Id) 16 | } 17 | 18 | func RenderGraphViz(connections map[Node][]Node) { 19 | subgraphs := make(map[string]bool) 20 | sb := strings.Builder{} 21 | sb.WriteString("strict graph {\n") 22 | sb.WriteString("node [shape=box]\n") 23 | for node := range connections { 24 | subgraphs[node.Subgraph] = true 25 | } 26 | for subgraph := range subgraphs { 27 | sb.WriteString(fmt.Sprintf("subgraph cluster_%s {\n", subgraph)) 28 | for node, nodes := range connections { 29 | if node.Subgraph == subgraph { 30 | sb.WriteString(fmt.Sprintf("\"%s\"\n", node.Render())) 31 | for _, v := range nodes { 32 | sb.WriteString(fmt.Sprintf(" \"%s\" -- \"%s\"\n", node.Render(), v.Render())) 33 | } 34 | } 35 | } 36 | sb.WriteString("}\n") 37 | } 38 | for node, nodes := range connections { 39 | if node.Subgraph == "" { 40 | sb.WriteString(fmt.Sprintf("\"%s\"\n", node.Render())) 41 | for _, v := range nodes { 42 | sb.WriteString(fmt.Sprintf(" \"%s\" -- \"%s\"\n", node.Render(), v.Render())) 43 | } 44 | } 45 | } 46 | sb.WriteString("}") 47 | fmt.Println(sb.String()) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/k8s/fakeClient.go: -------------------------------------------------------------------------------- 1 | package k8s 2 | 3 | import ( 4 | "sigs.k8s.io/controller-runtime/pkg/client/fake" 5 | ) 6 | 7 | type fakeLazyClientInitializer struct { 8 | lazyClientInitializerInterface 9 | fakeClientBuilder *fake.ClientBuilder 10 | } 11 | 12 | func (b *fakeLazyClientInitializer) initialize(s *LazyClient) { 13 | s.client = b.fakeClientBuilder.Build() 14 | } 15 | 16 | func NewFakeClient(clientBuilder *fake.ClientBuilder) *LazyClient { 17 | return &LazyClient{&fakeLazyClientInitializer{fakeClientBuilder: clientBuilder}, nil, nil, "", nil} 18 | } 19 | -------------------------------------------------------------------------------- /pkg/osdCloud/interfaces.go: -------------------------------------------------------------------------------- 1 | package osdCloud 2 | 3 | import ( 4 | sdk "github.com/openshift-online/ocm-sdk-go" 5 | ocmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1" 6 | ) 7 | 8 | // ClusterHealthClient This client is used to interface with AWS & GCP and provide common 9 | // abstractions that are generated from the cloud-specific resources. 10 | // Right now the client is only used by the `osdctl cluster health` command and only 11 | // provides functions used in that command. 12 | // It can and should be extended as seen fit if it seems useful. 13 | type ClusterHealthClient interface { 14 | Login() error 15 | GetCluster() *ocmv1.Cluster 16 | GetAZs() []string 17 | GetAllVirtualMachines(region string) ([]VirtualMachine, error) 18 | Close() 19 | } 20 | 21 | // BaseClient A common struct used to not repeat fields used in the sub'classes' for AWS and GCP. 22 | type BaseClient struct { 23 | ClusterId string 24 | OcmClient *sdk.Connection 25 | Cluster *ocmv1.Cluster 26 | } 27 | 28 | func (b *BaseClient) GetCluster() *ocmv1.Cluster { 29 | return b.Cluster 30 | } 31 | 32 | // VirtualMachine Abstract the AWS instances and GCP instances into a common type. 33 | // The Original field should store the data returned by the cloud directly, so it can be accessed via casting if needed. 34 | type VirtualMachine struct { 35 | Original interface{} 36 | Name string 37 | Size string 38 | State string 39 | Labels map[string]string 40 | } 41 | -------------------------------------------------------------------------------- /pkg/osdctlCommand/command.go: -------------------------------------------------------------------------------- 1 | package command 2 | 3 | type Command interface { 4 | Init() error 5 | Validate() error 6 | Run() (Output, error) 7 | } 8 | 9 | type Output interface { 10 | Print() 11 | } 12 | -------------------------------------------------------------------------------- /pkg/osdctlConfig/osdctlConfig.go: -------------------------------------------------------------------------------- 1 | package osdctlConfig 2 | 3 | import ( 4 | "errors" 5 | "os" 6 | 7 | "github.com/spf13/viper" 8 | ) 9 | 10 | const ( 11 | ConfigFileName = "osdctl" 12 | ) 13 | 14 | func EnsureConfigFile() error { 15 | configHomePath, err := os.UserHomeDir() 16 | if err != nil { 17 | return err 18 | } 19 | configFileDir := configHomePath + "/.config/" 20 | configFilePath := configFileDir + ConfigFileName 21 | if _, err := os.Stat(configFilePath); errors.Is(err, os.ErrNotExist) { 22 | err = os.MkdirAll(configFileDir, 0750) 23 | if err != nil { 24 | return err 25 | } 26 | _, err = os.Create(configFilePath) 27 | if err != nil { 28 | return err 29 | } 30 | } 31 | 32 | viper.SetConfigFile(configFilePath) 33 | viper.SetConfigType("yaml") 34 | 35 | if err := viper.ReadInConfig(); err != nil { 36 | return err 37 | } 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /pkg/policies/aws.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import ( 4 | cco "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1" 5 | ) 6 | 7 | type PolicyDocument struct { 8 | Version string 9 | Statement []cco.StatementEntry 10 | } 11 | 12 | func GetAWSProviderSpec(credReq *cco.CredentialsRequest) (*cco.AWSProviderSpec, error) { 13 | provSpecObject := cco.AWSProviderSpec{} 14 | err := cco.Codec.DecodeProviderSpec(credReq.Spec.ProviderSpec, &provSpecObject) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | return &provSpecObject, nil 20 | } 21 | 22 | func AWSCredentialsRequestToPolicyDocument(credReq *cco.CredentialsRequest) (*PolicyDocument, error) { 23 | awsSpec, err := GetAWSProviderSpec(credReq) 24 | if err != nil { 25 | return nil, err 26 | } 27 | 28 | out := &PolicyDocument{ 29 | Version: "2012-10-17", 30 | Statement: awsSpec.StatementEntries, 31 | } 32 | 33 | return out, nil 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pkg/policies/cloudspec.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | type CloudSpec int 9 | 10 | const ( 11 | AWS CloudSpec = iota 12 | GCP CloudSpec = iota 13 | ) 14 | 15 | // String is used both by fmt.Print and by Cobra in help text 16 | func (e *CloudSpec) String() string { 17 | switch *e { 18 | case AWS: 19 | return "aws" 20 | case GCP: 21 | return "gcp" 22 | default: 23 | return "unknown" 24 | } 25 | } 26 | 27 | // Set must have pointer receiver so it doesn't change the value of a copy 28 | func (e *CloudSpec) Set(v string) error { 29 | switch strings.ToLower(v) { 30 | case "aws", "sts": 31 | *e = AWS 32 | return nil 33 | case "gcp", "wif": 34 | *e = GCP 35 | return nil 36 | default: 37 | return fmt.Errorf(`must be one of "aws", "sts", "gcp", or "wif"`) 38 | } 39 | } 40 | 41 | // Type is only used in help text 42 | func (*CloudSpec) Type() string { 43 | return "CloudSpec" 44 | } 45 | -------------------------------------------------------------------------------- /pkg/policies/gcp.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | import ( 4 | "slices" 5 | "strings" 6 | 7 | cco "github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1" 8 | ) 9 | 10 | const GCPRoleIDPrefix = "roles/" 11 | 12 | func GetGcpProviderSpec(credReq *cco.CredentialsRequest) (*cco.GCPProviderSpec, error) { 13 | provSpecObject := cco.GCPProviderSpec{} 14 | err := cco.Codec.DecodeProviderSpec(credReq.Spec.ProviderSpec, &provSpecObject) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | return &provSpecObject, nil 20 | } 21 | 22 | func CredentialsRequestToWifServiceAccount(credReq *cco.CredentialsRequest) (*ServiceAccount, error) { 23 | 24 | gcpSpec, err := GetGcpProviderSpec(credReq) 25 | 26 | if err != nil { 27 | return nil, err 28 | } 29 | 30 | sa := &ServiceAccount{} 31 | sa.AccessMethod = "wif" 32 | sa.CredentialRequest = CredentialRequest{ 33 | SecretRef: SecretRef{ 34 | Name: credReq.Spec.SecretRef.Name, 35 | Namespace: credReq.Spec.SecretRef.Namespace, 36 | }, 37 | ServiceAccountNames: credReq.Spec.ServiceAccountNames, 38 | } 39 | 40 | sa.Id = credReq.Name 41 | sa.Kind = "ServiceAccount" 42 | sa.OsdRole = strings.Replace(credReq.Name, "openshift", "operator", 1) 43 | 44 | sa.Roles = []Role{} 45 | 46 | for _, predefinedRole := range gcpSpec.PredefinedRoles { 47 | sa.Roles = append(sa.Roles, Role{ 48 | Id: strings.TrimPrefix(predefinedRole, GCPRoleIDPrefix), 49 | Kind: "Role", 50 | Predefined: true, 51 | }) 52 | } 53 | 54 | if len(gcpSpec.Permissions) > 0 { 55 | roleId := strings.ReplaceAll(credReq.Name, "-", "_") 56 | roleId = roleId[:min(64, len(roleId))] 57 | slices.Sort(gcpSpec.Permissions) 58 | sa.Roles = append(sa.Roles, Role{ 59 | Id: roleId, 60 | Kind: "Role", 61 | Permissions: gcpSpec.Permissions, 62 | Predefined: false, 63 | }) 64 | } 65 | return sa, nil 66 | } 67 | -------------------------------------------------------------------------------- /pkg/policies/gcp_models.go: -------------------------------------------------------------------------------- 1 | package policies 2 | 3 | type Role struct { 4 | Id string `json:"id,omitempty"` 5 | Kind string `json:"kind,omitempty"` 6 | Permissions []string `json:"permissions,omitempty"` 7 | Predefined bool `json:"predefined,omitempty"` 8 | } 9 | 10 | type WifTemplate struct { 11 | Id string `json:"id,omitempty"` 12 | Kind string `json:"kind,omitempty"` 13 | ServiceAccounts []ServiceAccount `json:"service_accounts,omitempty"` 14 | } 15 | 16 | type ServiceAccount struct { 17 | AccessMethod string `json:"access_method,omitempty"` 18 | CredentialRequest CredentialRequest `json:"credential_request,omitempty"` 19 | Id string `json:"id,omitempty"` 20 | Kind string `json:"kind,omitempty"` 21 | OsdRole string `json:"osd_role,omitempty"` 22 | Roles []Role `json:"roles,omitempty"` 23 | } 24 | 25 | type CredentialRequest struct { 26 | SecretRef SecretRef `json:"secret_ref,omitempty"` 27 | ServiceAccountNames []string `json:"service_account_names,omitempty"` 28 | } 29 | 30 | type SecretRef struct { 31 | Name string `json:"name,omitempty"` 32 | Namespace string `json:"namespace,omitempty"` 33 | } 34 | 35 | func (s ServiceAccount) GetId() string { 36 | return s.Id 37 | } 38 | 39 | func (s ServiceAccount) GetSecretName() string { 40 | return s.CredentialRequest.SecretRef.Name 41 | } 42 | 43 | func (s ServiceAccount) GetSecretNamespace() string { 44 | return s.CredentialRequest.SecretRef.Namespace 45 | } 46 | 47 | func (s ServiceAccount) GetServiceAccountNames() []string { 48 | return s.CredentialRequest.ServiceAccountNames 49 | } 50 | -------------------------------------------------------------------------------- /pkg/printer/print_flags.go: -------------------------------------------------------------------------------- 1 | package printer 2 | 3 | import ( 4 | "github.com/spf13/cobra" 5 | 6 | "k8s.io/cli-runtime/pkg/genericclioptions" 7 | "k8s.io/cli-runtime/pkg/printers" 8 | ) 9 | 10 | type PrintFlags struct { 11 | JSONYamlFlags *genericclioptions.JSONYamlPrintFlags 12 | JSONPathFlags *genericclioptions.JSONPathPrintFlags 13 | } 14 | 15 | func NewPrintFlags() *PrintFlags { 16 | template := "" 17 | return &PrintFlags{ 18 | JSONYamlFlags: genericclioptions.NewJSONYamlPrintFlags(), 19 | JSONPathFlags: &genericclioptions.JSONPathPrintFlags{TemplateArgument: &template}, 20 | } 21 | } 22 | 23 | func (p *PrintFlags) AddFlags(c *cobra.Command) { 24 | p.JSONYamlFlags.AddFlags(c) 25 | p.JSONPathFlags.AddFlags(c) 26 | } 27 | 28 | func (p *PrintFlags) ToPrinter(output string) (printers.ResourcePrinter, error) { 29 | if p, err := p.JSONYamlFlags.ToPrinter(output); !genericclioptions.IsNoCompatiblePrinterError(err) { 30 | return p, err 31 | } 32 | 33 | if p, err := p.JSONPathFlags.ToPrinter(output); !genericclioptions.IsNoCompatiblePrinterError(err) { 34 | return p, err 35 | } 36 | 37 | return nil, genericclioptions.NoCompatiblePrinterError{OutputFormat: &output, AllowedFormats: p.AllowedFormats()} 38 | } 39 | 40 | // AllowedFormats is the list of formats in which data can be displayed 41 | func (p *PrintFlags) AllowedFormats() []string { 42 | formats := p.JSONYamlFlags.AllowedFormats() 43 | formats = append(formats, p.JSONPathFlags.AllowedFormats()...) 44 | return formats 45 | } 46 | -------------------------------------------------------------------------------- /pkg/printer/printer.go: -------------------------------------------------------------------------------- 1 | package printer 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | "strings" 8 | "text/tabwriter" 9 | 10 | "github.com/fatih/color" 11 | ) 12 | 13 | // printer use to output something on screen with table format. 14 | type printer struct { 15 | w *tabwriter.Writer 16 | } 17 | 18 | // NewTablePrinter creates a printer instance, and uses to format output with table. 19 | func NewTablePrinter(o io.Writer, minWidth, tabWidth, padding int, padChar byte) *printer { 20 | w := tabwriter.NewWriter(o, minWidth, tabWidth, padding, padChar, 0) 21 | return &printer{w} 22 | } 23 | 24 | // AddRow adds a row of data. 25 | func (p *printer) AddRow(row []string) { 26 | fmt.Fprintln(p.w, strings.Join(row, "\t")) 27 | } 28 | 29 | // Flush outputs all rows on screen. 30 | func (p *printer) Flush() error { 31 | return p.w.Flush() 32 | } 33 | 34 | // ClearScreen clears all output on screen. 35 | func (p *printer) ClearScreen() { 36 | fmt.Fprint(os.Stdout, "\033[2J") 37 | fmt.Fprint(os.Stdout, "\033[H") 38 | } 39 | 40 | var PrintfGreen func(format string, a ...interface{}) = color.New(color.FgGreen).PrintfFunc() 41 | 42 | var PrintlnGreen func(a ...interface{}) = color.New(color.FgGreen).PrintlnFunc() 43 | -------------------------------------------------------------------------------- /pkg/printer/printer_test.go: -------------------------------------------------------------------------------- 1 | package printer 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "testing" 7 | 8 | . "github.com/onsi/gomega" 9 | ) 10 | 11 | func TestAddRow(t *testing.T) { 12 | g := NewGomegaWithT(t) 13 | 14 | testCases := []struct { 15 | title string 16 | rows [][]string 17 | output string 18 | }{ 19 | { 20 | title: "one row and one column", 21 | rows: [][]string{{"foo"}}, 22 | output: "foo\n", 23 | }, 24 | { 25 | title: "one row and three columns", 26 | rows: [][]string{{"foo", "bar", "buz"}}, 27 | output: "foo bar buz\n", 28 | }, 29 | { 30 | title: "two rows and three columns", 31 | rows: [][]string{{"foo", "bar", "buz"}, {"foo1", "foo2", "foo3"}}, 32 | output: `foo bar buz 33 | foo1 foo2 foo3 34 | `, 35 | }, 36 | } 37 | 38 | for _, tc := range testCases { 39 | t.Run(tc.title, func(t *testing.T) { 40 | buf := &bytes.Buffer{} 41 | p := NewTablePrinter(buf, 20, 1, 3, ' ') 42 | for _, row := range tc.rows { 43 | p.AddRow(row) 44 | } 45 | err := p.Flush() 46 | g.Expect(err).ShouldNot(HaveOccurred()) 47 | 48 | data, err := io.ReadAll(buf) 49 | g.Expect(err).ShouldNot(HaveOccurred()) 50 | g.Expect(string(data)).Should(Equal(tc.output)) 51 | }) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/provider/aws/iam.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | 7 | "github.com/aws/aws-sdk-go-v2/service/iam" 8 | "github.com/aws/aws-sdk-go-v2/service/iam/types" 9 | ) 10 | 11 | func CreateIAMUserAndAttachPolicy(awsClient Client, username, policyArn *string) error { 12 | output, err := awsClient.CreateUser(&iam.CreateUserInput{UserName: username}) 13 | if err != nil { 14 | return err 15 | } 16 | 17 | if _, err := awsClient.AttachUserPolicy(&iam.AttachUserPolicyInput{ 18 | UserName: output.User.UserName, 19 | PolicyArn: policyArn, 20 | }); err != nil { 21 | return err 22 | } 23 | 24 | return nil 25 | } 26 | 27 | func CheckIAMUserExists(awsClient Client, username *string) (bool, error) { 28 | if _, err := awsClient.GetUser(&iam.GetUserInput{UserName: username}); err != nil { 29 | var nse *types.NoSuchEntityException 30 | if errors.As(err, &nse) { 31 | return false, nil 32 | } 33 | return false, err 34 | } 35 | return true, nil 36 | } 37 | 38 | func DeleteUserAccessKeys(awsClient Client, username *string) error { 39 | accessKeys, err := awsClient.ListAccessKeys(&iam.ListAccessKeysInput{UserName: username}) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | if accessKeys.AccessKeyMetadata != nil { 45 | for _, key := range accessKeys.AccessKeyMetadata { 46 | if _, err := awsClient.DeleteAccessKey(&iam.DeleteAccessKeyInput{ 47 | UserName: username, 48 | AccessKeyId: key.AccessKeyId, 49 | }); err != nil { 50 | return fmt.Errorf("failed to delete access key %s for user %s", *key.AccessKeyId, *username) 51 | } 52 | } 53 | } 54 | 55 | return nil 56 | } 57 | 58 | func GenerateRoleARN(accountId, roleName string) string { 59 | return fmt.Sprintf("arn:aws:iam::%s:role/%s", accountId, roleName) 60 | } 61 | -------------------------------------------------------------------------------- /pkg/provider/aws/s3.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "strings" 7 | 8 | "github.com/aws/aws-sdk-go-v2/service/s3" 9 | "github.com/aws/aws-sdk-go-v2/service/s3/types" 10 | ) 11 | 12 | // DeleteS3BucketsWithPrefix Delete all S3 buckets with the specified prefix 13 | func DeleteS3BucketsWithPrefix(awsClient Client, prefix string) error { 14 | resp, err := awsClient.ListBuckets(&s3.ListBucketsInput{}) 15 | if err != nil { 16 | return err 17 | } 18 | 19 | for _, bucket := range resp.Buckets { 20 | if strings.HasPrefix(*bucket.Name, prefix) { 21 | log.Println("Deleting bucket", *bucket.Name) 22 | 23 | objects, err := awsClient.ListObjects(&s3.ListObjectsInput{ 24 | Bucket: bucket.Name, 25 | }) 26 | if err != nil { 27 | return err 28 | } 29 | 30 | // Clean up the objects in the bucket 31 | if len(objects.Contents) > 0 { 32 | deleteObjects := make([]types.ObjectIdentifier, 0, len(objects.Contents)) 33 | for _, obj := range objects.Contents { 34 | deleteObjects = append(deleteObjects, types.ObjectIdentifier{Key: obj.Key}) 35 | } 36 | 37 | if _, err = awsClient.DeleteObjects( 38 | &s3.DeleteObjectsInput{ 39 | Delete: &types.Delete{Objects: deleteObjects}, 40 | Bucket: bucket.Name, 41 | }, 42 | ); err != nil { 43 | return fmt.Errorf("failed to delete objects in bucket %s: %v", *bucket.Name, err) 44 | } 45 | } 46 | 47 | if _, err = awsClient.DeleteBucket(&s3.DeleteBucketInput{ 48 | Bucket: bucket.Name}); err != nil { 49 | return fmt.Errorf("failed to delete bucket %s: %v", *bucket.Name, err) 50 | } 51 | } 52 | } 53 | return nil 54 | } 55 | -------------------------------------------------------------------------------- /pkg/provider/pagerduty/pagerduty_suite_test.go: -------------------------------------------------------------------------------- 1 | package pagerduty_test 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | ) 9 | 10 | func TestPagerduty(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Pagerduty Suite") 13 | } 14 | -------------------------------------------------------------------------------- /pkg/utils/delay_tracker.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "time" 7 | ) 8 | 9 | type DelayTracker struct { 10 | verbose bool 11 | action string 12 | start time.Time 13 | } 14 | 15 | func StartDelayTracker(verbose bool, action string) *DelayTracker { 16 | dt := DelayTracker{ 17 | verbose: verbose, 18 | action: action, 19 | } 20 | if dt.verbose { 21 | dt.start = time.Now() 22 | fmt.Fprintf(os.Stderr, "Getting %s...\n", dt.action) 23 | } 24 | return &dt 25 | } 26 | 27 | func (dt *DelayTracker) End() { 28 | if dt.verbose { 29 | fmt.Fprintf(os.Stderr, "Got %s within %s\n", dt.action, time.Since(dt.start)) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pkg/utils/ocm_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | ) 7 | 8 | func resetEnvVars(t *testing.T) { 9 | errUrl := os.Unsetenv("OCM_URL") 10 | if errUrl != nil { 11 | t.Fatal("Error setting environment variables") 12 | } 13 | } 14 | 15 | func TestGenerateQuery(t *testing.T) { 16 | tests := []struct { 17 | name string 18 | clusterIdentifier string 19 | want string 20 | }{ 21 | { 22 | name: "valid internal ID", 23 | clusterIdentifier: "261kalm3uob0vegg1c7h9o7r5k9t64ji", 24 | want: "(id = '261kalm3uob0vegg1c7h9o7r5k9t64ji')", 25 | }, 26 | { 27 | name: "valid wrong internal ID with upper case", 28 | clusterIdentifier: "261kalm3uob0vegg1c7h9o7r5k9t64jI", 29 | want: "(display_name like '261kalm3uob0vegg1c7h9o7r5k9t64jI')", 30 | }, 31 | { 32 | name: "valid wrong internal ID too short", 33 | clusterIdentifier: "261kalm3uob0vegg1c7h9o7r5k9t64j", 34 | want: "(display_name like '261kalm3uob0vegg1c7h9o7r5k9t64j')", 35 | }, 36 | { 37 | name: "valid wrong internal ID too long", 38 | clusterIdentifier: "261kalm3uob0vegg1c7h9o7r5k9t64jix", 39 | want: "(display_name like '261kalm3uob0vegg1c7h9o7r5k9t64jix')", 40 | }, 41 | { 42 | name: "valid external ID", 43 | clusterIdentifier: "c1f562af-fb22-42c5-aa07-6848e1eeee9c", 44 | want: "(external_id = 'c1f562af-fb22-42c5-aa07-6848e1eeee9c')", 45 | }, 46 | { 47 | name: "valid display name", 48 | clusterIdentifier: "hs-mc-773jpgko0", 49 | want: "(display_name like 'hs-mc-773jpgko0')", 50 | }, 51 | } 52 | for _, tt := range tests { 53 | t.Run(tt.name, func(t *testing.T) { 54 | if got := GenerateQuery(tt.clusterIdentifier); got != tt.want { 55 | t.Errorf("GenerateQuery(%s) = %v, want %v", tt.clusterIdentifier, got, tt.want) 56 | } 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /pkg/utils/utils_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "runtime/debug" 5 | "testing" 6 | ) 7 | 8 | func mockReadBuildInfo(parseBuildInfoError bool) func() (info *debug.BuildInfo, ok bool) { 9 | return func() (*debug.BuildInfo, bool) { 10 | info := &debug.BuildInfo{ 11 | Deps: []*debug.Module{ 12 | { 13 | Path: "foo", 14 | Version: "v1.2.3", 15 | }, 16 | { 17 | Path: "bar", 18 | Version: "v4.5.6", 19 | }, 20 | }, 21 | } 22 | return info, !parseBuildInfoError 23 | } 24 | } 25 | 26 | func TestGetDependencyVersion(t *testing.T) { 27 | tests := []struct { 28 | name string 29 | dependencyPath string 30 | parseBuildInfoError bool 31 | want string 32 | wantErr bool 33 | }{ 34 | { 35 | name: "Error parsing build info", 36 | parseBuildInfoError: true, 37 | wantErr: true, 38 | }, 39 | { 40 | name: "Dependency not found", 41 | dependencyPath: "test", 42 | wantErr: true, 43 | }, 44 | { 45 | name: "Finds and returns version successfully (1)", 46 | dependencyPath: "foo", 47 | want: "v1.2.3", 48 | }, 49 | { 50 | name: "Finds and returns version successfully (2)", 51 | dependencyPath: "bar", 52 | want: "v4.5.6", 53 | }, 54 | } 55 | for _, tt := range tests { 56 | t.Run(tt.name, func(t *testing.T) { 57 | ReadBuildInfo = mockReadBuildInfo(tt.parseBuildInfoError) 58 | got, err := GetDependencyVersion(tt.dependencyPath) 59 | if (err != nil) != tt.wantErr { 60 | t.Errorf("GetDependencyVersion() error = %v, wantErr %v", err, tt.wantErr) 61 | return 62 | } 63 | if got != tt.want { 64 | t.Errorf("GetDependencyVersion() got = %v, want %v", got, tt.want) 65 | } 66 | }) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /pkg/utils/version.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "encoding/json" 5 | "io" 6 | "net/http" 7 | "time" 8 | ) 9 | 10 | const ( 11 | VersionAPIEndpoint = "https://api.github.com/repos/openshift/osdctl/releases/latest" 12 | VersionAddressTemplate = "https://github.com/openshift/osdctl/releases/download/v%s/osdctl_%s_%s_%s.tar.gz" // version, version, GOOS, GOARCH 13 | ) 14 | 15 | var ( 16 | // GitCommit is the short git commit hash from the environment 17 | // Will be set during build process via GoReleaser 18 | // See also: https://pkg.go.dev/cmd/link 19 | GitCommit string 20 | 21 | // Version is the tag version from the environment 22 | // Will be set during build process via GoReleaser 23 | // See also: https://pkg.go.dev/cmd/link 24 | Version string 25 | ) 26 | 27 | // githubResponse is a necessary struct for the JSON unmarshalling that is happening 28 | // in the getLatestVersion(). 29 | type gitHubResponse struct { 30 | TagName string `json:"tag_name"` 31 | } 32 | 33 | // getLatestVersion connects to the GitHub API and returns the latest osdctl tag name 34 | // Interesting Note: GitHub only shows the latest "stable" tag. This means, that 35 | // tags with a suffix like *-rc.1 are not returned. We will always show the latest stable on master branch. 36 | func GetLatestVersion() (latest string, err error) { 37 | client := http.Client{ 38 | Timeout: time.Second * 10, 39 | } 40 | 41 | req, err := http.NewRequest(http.MethodGet, VersionAPIEndpoint, nil) 42 | if err != nil { 43 | return latest, err 44 | } 45 | 46 | res, err := client.Do(req) 47 | if err != nil { 48 | return latest, err 49 | } 50 | 51 | body, err := io.ReadAll(res.Body) 52 | if err != nil { 53 | return latest, err 54 | } 55 | 56 | githubResp := gitHubResponse{} 57 | err = json.Unmarshal(body, &githubResp) 58 | if err != nil { 59 | return latest, err 60 | } 61 | 62 | return githubResp.TagName, nil 63 | } 64 | -------------------------------------------------------------------------------- /scripts/verify-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | echo "Verifying documentation..." 5 | 6 | make generate-docs 7 | 8 | # Check for changes only in the docs folder for .md files 9 | if git diff --name-only | grep -q "^docs/.*\.md$"; then 10 | echo "ERROR: Documentation in the 'docs' folder is out of date" 11 | echo "Run 'make generate-docs' locally and commit the changes" 12 | git diff -- 'docs/*.md' 13 | exit 1 14 | fi 15 | 16 | echo "Documentation in the 'docs' folder is up to date" 17 | exit 0 -------------------------------------------------------------------------------- /utils/docgen/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/openshift/osdctl/pkg/docgen" 5 | ) 6 | 7 | func main() { 8 | docgen.Main() 9 | } 10 | --------------------------------------------------------------------------------