Skip to content

Commit

Permalink
feat(cli): Added example to admin-cluster.go and projectwindow.go fil…
Browse files Browse the repository at this point in the history
…es (argoproj#16128)

* cluster.go, projectwindow.go

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* updated-examples

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* format-corrected

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* spell-mistake

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* format-correction

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* retrigger

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* retrigger-2

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* retirgger-3

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* update

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

---------

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
  • Loading branch information
2 people authored and Hariharasuthan99 committed Jun 16, 2024
1 parent f04e6bb commit de50592
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 11 deletions.
30 changes: 30 additions & 0 deletions cmd/argocd/commands/admin/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ func NewClusterCommand(clientOpts *argocdclient.ClientOptions, pathOpts *clientc
var command = &cobra.Command{
Use: "cluster",
Short: "Manage clusters configuration",
Example: `
#Generate declarative config for a cluster
argocd admin cluster generate-spec my-cluster -o yaml
#Generate a kubeconfig for a cluster named "my-cluster" and display it in the console
argocd admin cluster kubeconfig my-cluster
#Print information namespaces which Argo CD manages in each cluster
argocd admin cluster namespaces my-cluster `,
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
},
Expand Down Expand Up @@ -460,6 +469,15 @@ func NewClusterStatsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Comma
var command = cobra.Command{
Use: "stats",
Short: "Prints information cluster statistics and inferred shard number",
Example: `
#Display stats and shards for clusters
argocd admin cluster stats
#Display Cluster Statistics for a Specific Shard
argocd admin cluster stats --shard=1
#In a multi-cluster environment to print stats for a specific cluster say(target-cluster)
argocd admin cluster stats target-cluster`,
Run: func(cmd *cobra.Command, args []string) {
ctx := cmd.Context()

Expand Down Expand Up @@ -510,6 +528,18 @@ func NewClusterConfig() *cobra.Command {
Use: "kubeconfig CLUSTER_URL OUTPUT_PATH",
Short: "Generates kubeconfig for the specified cluster",
DisableAutoGenTag: true,
Example: `
#Generate a kubeconfig for a cluster named "my-cluster" on console
argocd admin cluster kubeconfig my-cluster
#Listing available kubeconfigs for clusters managed by argocd
argocd admin cluster kubeconfig
#Removing a specific kubeconfig file
argocd admin cluster kubeconfig my-cluster --delete
#Generate a Kubeconfig for a Cluster with TLS Verification Disabled
argocd admin cluster kubeconfig https://cluster-api-url:6443 /path/to/output/kubeconfig.yaml --insecure-skip-tls-verify`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
49 changes: 43 additions & 6 deletions cmd/argocd/commands/projectwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ func NewProjectWindowsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
roleCommand := &cobra.Command{
Use: "windows",
Short: "Manage a project's sync windows",
Example: `
#Add a sync window to a project
argocd proj windows add my-project \
--schedule "0 0 * * 1-5" \
--duration 3600 \
--prune
#Delete a sync window from a project
argocd proj windows delete <project-name> <window-id>
#List project sync windows
argocd proj windows list <project-name>`,
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
Expand All @@ -42,6 +54,12 @@ func NewProjectWindowsDisableManualSyncCommand(clientOpts *argocdclient.ClientOp
Use: "disable-manual-sync PROJECT ID",
Short: "Disable manual sync for a sync window",
Long: "Disable manual sync for a sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Example: `
#Disable manual sync for a sync window for the Project
argocd proj windows disable-manual-sync PROJECT ID
#Disbaling manual sync for a windows set on the default project with Id 0
argocd proj windows disable-manual-sync default 0`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down Expand Up @@ -79,6 +97,15 @@ func NewProjectWindowsEnableManualSyncCommand(clientOpts *argocdclient.ClientOpt
Use: "enable-manual-sync PROJECT ID",
Short: "Enable manual sync for a sync window",
Long: "Enable manual sync for a sync window. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Example: `
#Enabling manual sync for a general case
argocd proj windows enable-manual-sync PROJECT ID
#Enabling manual sync for a windows set on the default project with Id 2
argocd proj windows enable-manual-sync default 2
#Enabling manual sync with a custom message
argocd proj windows enable-manual-sync my-app-project --message "Manual sync initiated by admin`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down Expand Up @@ -125,14 +152,15 @@ func NewProjectWindowsAddWindowCommand(clientOpts *argocdclient.ClientOptions) *
var command = &cobra.Command{
Use: "add PROJECT",
Short: "Add a sync window to a project",
Example: `# Add a 1 hour allow sync window
Example: `
#Add a 1 hour allow sync window
argocd proj windows add PROJECT \
--kind allow \
--schedule "0 22 * * *" \
--duration 1h \
--applications "*"
# Add a deny sync window with the ability to manually sync.
#Add a deny sync window with the ability to manually sync.
argocd proj windows add PROJECT \
--kind deny \
--schedule "30 10 * * *" \
Expand Down Expand Up @@ -180,6 +208,12 @@ func NewProjectWindowsDeleteCommand(clientOpts *argocdclient.ClientOptions) *cob
var command = &cobra.Command{
Use: "delete PROJECT ID",
Short: "Delete a sync window from a project. Requires ID which can be found by running \"argocd proj windows list PROJECT\"",
Example: `
#Delete a sync window from a project (default) with ID 0
argocd proj windows delete default 0
#Delete a sync window from a project (new-project) with ID 1
argocd proj windows delete new-project 1`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down Expand Up @@ -274,12 +308,15 @@ func NewProjectWindowsListCommand(clientOpts *argocdclient.ClientOptions) *cobra
var command = &cobra.Command{
Use: "list PROJECT",
Short: "List project sync windows",
Example: `# List project windows
Example: `
#List project windows
argocd proj windows list PROJECT
# List project windows in yaml format
#List project windows in yaml format
argocd proj windows list PROJECT -o yaml
`,
#List project windows info for a project name (test-project)
argocd proj windows list test-project`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
14 changes: 14 additions & 0 deletions docs/user-guide/commands/argocd_admin_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ Manage clusters configuration
argocd admin cluster [flags]
```

### Examples

```
#Generate declarative config for a cluster
argocd admin cluster generate-spec my-cluster -o yaml
#Generate a kubeconfig for a cluster named "my-cluster" and display it in the console
argocd admin cluster kubeconfig my-cluster
#Print information namespaces which Argo CD manages in each cluster
argocd admin cluster namespaces my-cluster
```

### Options

```
Expand Down
17 changes: 17 additions & 0 deletions docs/user-guide/commands/argocd_admin_cluster_kubeconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ Generates kubeconfig for the specified cluster
argocd admin cluster kubeconfig CLUSTER_URL OUTPUT_PATH [flags]
```

### Examples

```
#Generate a kubeconfig for a cluster named "my-cluster" on console
argocd admin cluster kubeconfig my-cluster
#Listing available kubeconfigs for clusters managed by argocd
argocd admin cluster kubeconfig
#Removing a specific kubeconfig file
argocd admin cluster kubeconfig my-cluster --delete
#Generate a Kubeconfig for a Cluster with TLS Verification Disabled
argocd admin cluster kubeconfig https://cluster-api-url:6443 /path/to/output/kubeconfig.yaml --insecure-skip-tls-verify
```

### Options

```
Expand Down
14 changes: 14 additions & 0 deletions docs/user-guide/commands/argocd_admin_cluster_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ Prints information cluster statistics and inferred shard number
argocd admin cluster stats [flags]
```

### Examples

```
#Display stats and shards for clusters
argocd admin cluster stats
#Display Cluster Statistics for a Specific Shard
argocd admin cluster stats --shard=1
#In a multi-cluster environment to print stats for a specific cluster say(target-cluster)
argocd admin cluster stats target-cluster
```

### Options

```
Expand Down
17 changes: 17 additions & 0 deletions docs/user-guide/commands/argocd_proj_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ Manage a project's sync windows
argocd proj windows [flags]
```

### Examples

```
#Add a sync window to a project
argocd proj windows add my-project \
--schedule "0 0 * * 1-5" \
--duration 3600 \
--prune
#Delete a sync window from a project
argocd proj windows delete <project-name> <window-id>
#List project sync windows
argocd proj windows list <project-name>
```

### Options

```
Expand Down
5 changes: 3 additions & 2 deletions docs/user-guide/commands/argocd_proj_windows_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ argocd proj windows add PROJECT [flags]
### Examples

```
# Add a 1 hour allow sync window
#Add a 1 hour allow sync window
argocd proj windows add PROJECT \
--kind allow \
--schedule "0 22 * * *" \
--duration 1h \
--applications "*"
# Add a deny sync window with the ability to manually sync.
#Add a deny sync window with the ability to manually sync.
argocd proj windows add PROJECT \
--kind deny \
--schedule "30 10 * * *" \
Expand Down
11 changes: 11 additions & 0 deletions docs/user-guide/commands/argocd_proj_windows_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ Delete a sync window from a project. Requires ID which can be found by running "
argocd proj windows delete PROJECT ID [flags]
```

### Examples

```
#Delete a sync window from a project (default) with ID 0
argocd proj windows delete default 0
#Delete a sync window from a project (new-project) with ID 1
argocd proj windows delete new-project 1
```

### Options

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ Disable manual sync for a sync window. Requires ID which can be found by running
argocd proj windows disable-manual-sync PROJECT ID [flags]
```

### Examples

```
#Disable manual sync for a sync window for the Project
argocd proj windows disable-manual-sync PROJECT ID
#Disbaling manual sync for a windows set on the default project with Id 0
argocd proj windows disable-manual-sync default 0
```

### Options

```
Expand Down
14 changes: 14 additions & 0 deletions docs/user-guide/commands/argocd_proj_windows_enable-manual-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ Enable manual sync for a sync window. Requires ID which can be found by running
argocd proj windows enable-manual-sync PROJECT ID [flags]
```

### Examples

```
#Enabling manual sync for a general case
argocd proj windows enable-manual-sync PROJECT ID
#Enabling manual sync for a windows set on the default project with Id 2
argocd proj windows enable-manual-sync default 2
#Enabling manual sync with a custom message
argocd proj windows enable-manual-sync my-app-project --message "Manual sync initiated by admin
```

### Options

```
Expand Down
9 changes: 6 additions & 3 deletions docs/user-guide/commands/argocd_proj_windows_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ argocd proj windows list PROJECT [flags]
### Examples

```
# List project windows
#List project windows
argocd proj windows list PROJECT
# List project windows in yaml format
#List project windows in yaml format
argocd proj windows list PROJECT -o yaml
#List project windows info for a project name (test-project)
argocd proj windows list test-project
```

### Options
Expand Down

0 comments on commit de50592

Please sign in to comment.