Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Added example to admin-cluster.go and projectwindow.go files #16128

Merged
merged 24 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5fb4a3e
cluster.go, projectwindow.go
surajyadav1108 Oct 26, 2023
5156ae5
updateMerge branch 'master' of https://github.com/argoproj/argo-cd
surajyadav1108 Oct 29, 2023
c7d4386
updated-examples
surajyadav1108 Oct 29, 2023
cc3385d
Merge branch 'master' of https://github.com/argoproj/argo-cd
surajyadav1108 Nov 1, 2023
875c161
Merge branch 'master' into master
surajyadav1108 Nov 1, 2023
659ff0b
Merge branch 'master' into master
surajyadav1108 Nov 2, 2023
8504e14
Merge branch 'master' of https://github.com/argoproj/argo-cd
surajyadav1108 Nov 2, 2023
63f8e95
format-corrected
surajyadav1108 Nov 2, 2023
7a3241d
Merge branch 'master' of https://github.com/surajyadav1108/argo-cd
surajyadav1108 Nov 2, 2023
bb5e62f
Merge branch 'master' into master
surajyadav1108 Nov 2, 2023
4fe14f6
spell-mistake
surajyadav1108 Nov 2, 2023
12778a1
Merge branch 'master' into master
surajyadav1108 Nov 4, 2023
4d86d5d
format-correction
surajyadav1108 Nov 4, 2023
10299ad
retrigger
surajyadav1108 Nov 4, 2023
9197899
retrigger-2
surajyadav1108 Nov 4, 2023
dea5373
retirgger-3
surajyadav1108 Nov 4, 2023
df01be2
Merge branch 'master' into master
surajyadav1108 Nov 6, 2023
321bb81
Merge branch 'master' into master
surajyadav1108 Nov 8, 2023
7edffa9
Merge branch 'master' into master
ishitasequeira Nov 9, 2023
a8dc75e
update
surajyadav1108 Nov 9, 2023
d4cc3e7
Merge branch 'master' into master
surajyadav1108 Nov 10, 2023
e215937
Merge branch 'master' into master
surajyadav1108 Nov 17, 2023
48be1b2
Merge branch 'master' into master
surajyadav1108 Nov 18, 2023
8f4f67c
Merge branch 'master' into master
surajyadav1108 Nov 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 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 @@ -448,6 +457,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 say(target-cluster)
argocd admin cluster stats target-cluster`,
Run: func(cmd *cobra.Command, args []string) {
ctx := cmd.Context()

Expand Down Expand Up @@ -492,6 +510,19 @@ 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
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
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`,
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
39 changes: 37 additions & 2 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
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
argocd proj windows list <project-name>`,
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
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
agrocd proj windows disable-manual-sync default 0`,
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
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
agrocd proj windows enable-manual-sync default 2
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved

# Enabling manual synchronization with a custom message
argocd proj windows enable-manual-sync my-app-project --message "Manual sync initiated by admin."`,
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down Expand Up @@ -180,6 +207,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 @@ -276,10 +309,12 @@ func NewProjectWindowsListCommand(clientOpts *argocdclient.ClientOptions) *cobra
Short: "List project sync windows",
Example: `# List project windows
argocd proj windows list PROJECT

# 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
18 changes: 18 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,24 @@ 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 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
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
agrocd proj windows disable-manual-sync default 0
```

### Options

```
Expand Down
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
agrocd proj windows enable-manual-sync default 2

# Enabling manual synchronization with a custom message
argocd proj windows enable-manual-sync my-app-project --message "Manual sync initiated by admin."
```

### Options

```
Expand Down
4 changes: 3 additions & 1 deletion docs/user-guide/commands/argocd_proj_windows_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ argocd proj windows list PROJECT [flags]
```
# List project windows
argocd proj windows list PROJECT

# 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
Loading