Skip to content

Commit

Permalink
docs: fix references to cli tools moved under argocd admin (argoproj#…
Browse files Browse the repository at this point in the history
…11181)

* docs: fix references to cli tools moved under argocd admin

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* attempt to fix the build by fiddling the generated docs

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* Update hack/gen-catalog/main.go

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* docs: fix doc generator for argocd admin notifications

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

* docs: fix doc generator diff

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>

Signed-off-by: Alex Eftimie <alex.eftimie@getyourguide.com>
  • Loading branch information
alexef authored and ashutosh16 committed Nov 23, 2022
1 parent 05f23ad commit d8b142a
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 47 deletions.
2 changes: 1 addition & 1 deletion cmd/argocd/commands/admin/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewNotificationsCommand() *cobra.Command {
var argocdService service.Service
toolsCommand := cmd.NewToolsCommand(
"notifications",
"notifications",
"argocd admin notifications",
applications,
settings.GetFactorySettings(argocdService, "argocd-notifications-secret", "argocd-notifications-cm"), func(clientConfig clientcmd.ClientConfig) {
k8sCfg, err := clientConfig.ClientConfig()
Expand Down
32 changes: 16 additions & 16 deletions docs/operator-manual/notifications/troubleshooting-commands.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
## notifications template get
## argocd admin notifications template get

Prints information about configured templates

```
notifications template get [flags]
argocd admin notifications template get [flags]
```

### Examples

```
# prints all templates
notifications template get
argocd admin notifications template get
# print YAML formatted app-sync-succeeded template definition
notifications template get app-sync-succeeded -o=yaml
argocd admin notifications template get app-sync-succeeded -o=yaml
```

Expand Down Expand Up @@ -53,23 +53,23 @@ notifications template get app-sync-succeeded -o=yaml
--username string Username for basic authentication to the API server
```

## notifications template notify
## argocd admin notifications template notify

Generates notification using the specified template and send it to specified recipients

```
notifications template notify NAME RESOURCE_NAME [flags]
argocd admin notifications template notify NAME RESOURCE_NAME [flags]
```

### Examples

```
# Trigger notification using in-cluster config map and secret
notifications template notify app-sync-succeeded guestbook --recipient slack:my-slack-channel
argocd admin notifications template notify app-sync-succeeded guestbook --recipient slack:my-slack-channel
# Render notification render generated notification in console
notifications template notify app-sync-succeeded guestbook
argocd admin notifications template notify app-sync-succeeded guestbook
```

Expand Down Expand Up @@ -109,22 +109,22 @@ notifications template notify app-sync-succeeded guestbook
--username string Username for basic authentication to the API server
```

## notifications trigger get
## argocd admin notifications trigger get

Prints information about configured triggers

```
notifications trigger get [flags]
argocd admin notifications trigger get [flags]
```

### Examples

```
# prints all triggers
notifications trigger get
argocd admin notifications trigger get
# print YAML formatted on-sync-failed trigger definition
notifications trigger get on-sync-failed -o=yaml
argocd admin notifications trigger get on-sync-failed -o=yaml
```

Expand Down Expand Up @@ -164,23 +164,23 @@ notifications trigger get on-sync-failed -o=yaml
--username string Username for basic authentication to the API server
```

## notifications trigger run
## argocd admin notifications trigger run

Evaluates specified trigger condition and prints the result

```
notifications trigger run NAME RESOURCE_NAME [flags]
argocd admin notifications trigger run NAME RESOURCE_NAME [flags]
```

### Examples

```
# Execute trigger configured in 'argocd-notification-cm' ConfigMap
notifications trigger run on-sync-status-unknown ./sample-app.yaml
argocd admin notifications trigger run on-sync-status-unknown ./sample-app.yaml
# Execute trigger using my-config-map.yaml instead of 'argocd-notifications-cm' ConfigMap
notifications trigger run on-sync-status-unknown ./sample-app.yaml \
argocd admin notifications trigger run on-sync-status-unknown ./sample-app.yaml \
--config-map ./my-config-map.yaml
```

Expand Down
20 changes: 10 additions & 10 deletions docs/operator-manual/notifications/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Troubleshooting

The `argocd-notifications` binary includes a set of CLI commands that helps to configure the controller
The `argocd admin notifications` is a CLI command group that helps to configure the controller
settings and troubleshoot issues.

## Global flags
Expand All @@ -17,15 +17,15 @@ Additionally, you can specify `:empty` value to use empty secret with no notific
* Get list of triggers configured in the local config map:

```bash
argocd-notifications trigger get \
--config-map ./argocd-notifications-cm.yaml --secret :empty
argocd admin notifications trigger get \
--config-map ./argocd admin notifications-cm.yaml --secret :empty
```

* Trigger notification using in-cluster config map and secret:

```bash
argocd-notifications template notify \
app-sync-succeeded guestbook --recipient slack:argocd-notifications
argocd admin notifications template notify \
app-sync-succeeded guestbook --recipient slack:argocd admin notifications
```

## Kustomize
Expand All @@ -44,18 +44,18 @@ kustomize build ./argocd-notifications | \

### On your laptop

You can download `argocd-notifications` from the github [release](https://github.com/argoproj-labs/argocd-notifications/releases)
You can download the `argocd` CLI from the github [release](https://github.com/argoproj/argo-cd/releases)
attachments.

The binary is available in `argoprojlabs/argocd-notifications` image. Use the `docker run` and volume mount
The binary is available in `argoproj/argo-cd` image. Use the `docker run` and volume mount
to execute binary on any platform.

**Example:**

```bash
docker run --rm -it -w /src -v $(pwd):/src \
argoprojlabs/argocd-notifications:<version> \
/app/argocd-notifications trigger get \
argoproj/argo-cd:<version> \
/app/argocd admin notifications trigger get \
--config-map ./argocd-notifications-cm.yaml --secret :empty
```

Expand All @@ -67,7 +67,7 @@ configuration.
**Example**
```bash
kubectl exec -it argocd-notifications-controller-<pod-hash> \
/app/argocd-notifications trigger get
/app/argocd admin notifications trigger get
```

## Commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ argocd admin notifications template get [flags]
```
# prints all templates
notifications template get
argocd admin notifications template get
# print YAML formatted app-sync-succeeded template definition
notifications template get app-sync-succeeded -o=yaml
argocd admin notifications template get app-sync-succeeded -o=yaml
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ argocd admin notifications template notify NAME RESOURCE_NAME [flags]
```
# Trigger notification using in-cluster config map and secret
notifications template notify app-sync-succeeded guestbook --recipient slack:my-slack-channel
argocd admin notifications template notify app-sync-succeeded guestbook --recipient slack:my-slack-channel
# Render notification render generated notification in console
notifications template notify app-sync-succeeded guestbook
argocd admin notifications template notify app-sync-succeeded guestbook
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ argocd admin notifications trigger get [flags]
```
# prints all triggers
notifications trigger get
argocd admin notifications trigger get
# print YAML formatted on-sync-failed trigger definition
notifications trigger get on-sync-failed -o=yaml
argocd admin notifications trigger get on-sync-failed -o=yaml
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ argocd admin notifications trigger run NAME RESOURCE_NAME [flags]
```
# Execute trigger configured in 'argocd-notification-cm' ConfigMap
notifications trigger run on-sync-status-unknown ./sample-app.yaml
argocd admin notifications trigger run on-sync-status-unknown ./sample-app.yaml
# Execute trigger using my-config-map.yaml instead of 'argocd-notifications-cm' ConfigMap
notifications trigger run on-sync-status-unknown ./sample-app.yaml \
argocd admin notifications trigger run on-sync-status-unknown ./sample-app.yaml \
--config-map ./my-config-map.yaml
```

Expand Down
31 changes: 20 additions & 11 deletions hack/gen-catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,27 @@ func generateBuiltInTriggersDocs(out io.Writer, triggers map[string][]triggers.C
}

func generateCommandsDocs(out io.Writer) error {
toolsCmd := admin.NewNotificationsCommand()
for _, subCommand := range toolsCmd.Commands() {
for _, c := range subCommand.Commands() {
var cmdDesc bytes.Buffer
if err := doc.GenMarkdown(c, &cmdDesc); err != nil {
return err
}
for _, line := range strings.Split(cmdDesc.String(), "\n") {
if strings.HasPrefix(line, "### SEE ALSO") {
break
// create parents so that CommandPath() is correctly resolved
mainCmd := &cobra.Command{Use: "argocd"}
adminCmd := &cobra.Command{Use: "admin"}
toolCmd := admin.NewNotificationsCommand()
adminCmd.AddCommand(toolCmd)
mainCmd.AddCommand(adminCmd)
for _, mainSubCommand := range mainCmd.Commands() {
for _, adminSubCommand := range mainSubCommand.Commands() {
for _, toolSubCommand := range adminSubCommand.Commands() {
for _, c := range toolSubCommand.Commands() {
var cmdDesc bytes.Buffer
if err := doc.GenMarkdown(c, &cmdDesc); err != nil {
return err
}
for _, line := range strings.Split(cmdDesc.String(), "\n") {
if strings.HasPrefix(line, "### SEE ALSO") {
break
}
_, _ = fmt.Fprintf(out, "%s\n", line)
}
}
_, _ = fmt.Fprintf(out, "%s\n", line)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ nav:
- operator-manual/notifications/catalog.md
- operator-manual/notifications/monitoring.md
- operator-manual/notifications/subscriptions.md
- operator-manual/notifications/troubleshooting.md
- operator-manual/notifications/troubleshooting-commands.md
- operator-manual/notifications/troubleshooting-errors.md
- operator-manual/notifications/troubleshooting.md
- Notification Services:
- operator-manual/notifications/services/alertmanager.md
- operator-manual/notifications/services/email.md
Expand Down

0 comments on commit d8b142a

Please sign in to comment.