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 11 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`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
48 changes: 42 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
surajyadav1108 marked this conversation as resolved.
Show resolved Hide resolved
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 synchronization 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,14 @@ 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
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
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
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 synchronization with a custom message
argocd proj windows enable-manual-sync my-app-project --message "Manual sync initiated by admin
```

### Options

```
Expand Down
8 changes: 5 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,14 @@ 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
Loading