Skip to content

Commit d8b9362

Browse files
Merge pull request #848 from joshbranham/standardize-clusterid-flag-pullsecret
Update cluster validate-pull-secret-ext to use --cluster-id flag
2 parents 53524f9 + b3cbc4c commit d8b9362

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

cmd/cluster/validatepullsecretext.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ type validatePullSecretExtOptions struct {
5555

5656
const VPSExample string = `
5757
# Compare OCM Access-Token, OCM Registry-Credentials, and OCM Account Email against cluster's pull secret
58-
osdctl cluster validate-pull-secret-ext ${CLUSTER_ID} --reason "OSD-XYZ"
58+
osdctl cluster validate-pull-secret-ext --cluster-id ${CLUSTER_ID} --reason "OSD-XYZ"
5959
6060
# Exclude Access-Token, and Registry-Credential checks...
61-
osdctl cluster validate-pull-secret-ext ${CLUSTER_ID} --reason "OSD-XYZ" --skip-access-token --skip-registry-creds
61+
osdctl cluster validate-pull-secret-ext --cluster-id ${CLUSTER_ID} --reason "OSD-XYZ" --skip-access-token --skip-registry-creds
6262
`
6363

6464
func newCmdValidatePullSecretExt() *cobra.Command {
6565
ops := newValidatePullSecretExtOptions()
6666
validatePullSecretCmd := &cobra.Command{
67-
Use: "validate-pull-secret-ext [CLUSTER_ID]",
67+
Use: "validate-pull-secret-ext --cluster-id $CLUSTER_ID",
6868
Short: "Extended checks to confirm pull-secret data is synced with current OCM data",
6969
Long: `
7070
Attempts to validate if a cluster's pull-secret auth values are in sync with the account's email,
@@ -73,13 +73,13 @@ func newCmdValidatePullSecretExt() *cobra.Command {
7373
Region Lead permissions are required to view and validate the OCM AccessToken.
7474
`,
7575
Example: VPSExample,
76-
Args: cobra.ExactArgs(1),
7776
DisableAutoGenTag: true,
78-
PreRun: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(ops.preRun(cmd, args)) },
77+
PreRun: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(ops.preRun(cmd)) },
7978
Run: func(cmd *cobra.Command, args []string) {
8079
cmdutil.CheckErr(ops.run())
8180
},
8281
}
82+
validatePullSecretCmd.Flags().StringVarP(&ops.clusterID, "cluster-id", "C", "", "Provide internal ID of the cluster")
8383
validatePullSecretCmd.Flags().StringVar(&ops.reason, "reason", "", "Mandatory reason for this command to be run (usually includes an OHSS or PD ticket)")
8484
validatePullSecretCmd.Flags().StringVarP(&ops.verboseLevel, "log-level", "l", "info", "debug, info, warn, error. (default=info)")
8585
validatePullSecretCmd.Flags().Bool("skip-registry-creds", false, "Exclude OCM Registry Credentials checks against cluster secret")
@@ -93,11 +93,7 @@ func newValidatePullSecretExtOptions() *validatePullSecretExtOptions {
9393
return &validatePullSecretExtOptions{}
9494
}
9595

96-
func (o *validatePullSecretExtOptions) preRun(cmd *cobra.Command, args []string) error {
97-
if len(args) != 1 {
98-
return cmdutil.UsageErrorf(cmd, "Required 1 positional arg for 'Cluster ID'")
99-
}
100-
o.clusterID = args[0]
96+
func (o *validatePullSecretExtOptions) preRun(cmd *cobra.Command) error {
10197
o.useAccessToken = true
10298
o.useRegCreds = true
10399

docs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
- `status --cluster-id <cluster-identifier>` - Shows the support status of a specified cluster
7878
- `transfer-owner` - Transfer cluster ownership to a new user (to be done by Region Lead)
7979
- `validate-pull-secret --cluster-id <cluster-identifier>` - Checks if the pull secret email matches the owner email
80-
- `validate-pull-secret-ext [CLUSTER_ID]` - Extended checks to confirm pull-secret data is synced with current OCM data
80+
- `validate-pull-secret-ext --cluster-id $CLUSTER_ID` - Extended checks to confirm pull-secret data is synced with current OCM data
8181
- `verify-dns --cluster-id <cluster-id>` - Verify DNS resolution for HCP cluster public endpoints
8282
- `cost` - Cost Management related utilities
8383
- `carbon-report` - Generate carbon emissions report csv to stdout for a given AWS Account and Usage Period
@@ -2334,14 +2334,15 @@ osdctl cluster validate-pull-secret --cluster-id <cluster-identifier> [flags]
23342334

23352335

23362336
```
2337-
osdctl cluster validate-pull-secret-ext [CLUSTER_ID] [flags]
2337+
osdctl cluster validate-pull-secret-ext --cluster-id $CLUSTER_ID [flags]
23382338
```
23392339

23402340
#### Flags
23412341

23422342
```
23432343
--as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
23442344
--cluster string The name of the kubeconfig cluster to use
2345+
-C, --cluster-id string Provide internal ID of the cluster
23452346
--context string The name of the kubeconfig context to use
23462347
-h, --help help for validate-pull-secret-ext
23472348
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure

docs/osdctl_cluster_validate-pull-secret-ext.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,25 @@ Extended checks to confirm pull-secret data is synced with current OCM data
1212

1313

1414
```
15-
osdctl cluster validate-pull-secret-ext [CLUSTER_ID] [flags]
15+
osdctl cluster validate-pull-secret-ext --cluster-id $CLUSTER_ID [flags]
1616
```
1717

1818
### Examples
1919

2020
```
2121
2222
# Compare OCM Access-Token, OCM Registry-Credentials, and OCM Account Email against cluster's pull secret
23-
osdctl cluster validate-pull-secret-ext ${CLUSTER_ID} --reason "OSD-XYZ"
23+
osdctl cluster validate-pull-secret-ext --cluster-id ${CLUSTER_ID} --reason "OSD-XYZ"
2424
2525
# Exclude Access-Token, and Registry-Credential checks...
26-
osdctl cluster validate-pull-secret-ext ${CLUSTER_ID} --reason "OSD-XYZ" --skip-access-token --skip-registry-creds
26+
osdctl cluster validate-pull-secret-ext --cluster-id ${CLUSTER_ID} --reason "OSD-XYZ" --skip-access-token --skip-registry-creds
2727
2828
```
2929

3030
### Options
3131

3232
```
33+
-C, --cluster-id string Provide internal ID of the cluster
3334
-h, --help help for validate-pull-secret-ext
3435
-l, --log-level string debug, info, warn, error. (default=info) (default "info")
3536
--reason string Mandatory reason for this command to be run (usually includes an OHSS or PD ticket)

0 commit comments

Comments
 (0)