Skip to content

Commit

Permalink
Merge pull request #122 from colinjlacy/issue51-smtp-docs
Browse files Browse the repository at this point in the history
adds smtp to readme and notifications examples
  • Loading branch information
gianlucam76 committed Sep 16, 2024
2 parents 0b47094 + 2e21c61 commit bac0e30
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ k8s-cleaner keeps you in the loop with handy notifications through:
2. <img src="assets/webex_logo.png" alt="Webex" width="30" /> [__Webex__](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/#webex-notifications-example)
3. <img src="assets/discord_logo.png" alt="Discord" width="30" /> [__Discord__](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/#discord-notifications-example)
3. <img src="assets/teams_logo.svg" alt="Teams" width="30" /> [__Teams__](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/#teams-notifications-example)
3. <img src="assets/smtp_logo.png" alt="SMTP" width="30" /> [__SMTP__](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/#smtp-notifications-example)
4. [__reports__](https://gianlucam76.github.io/k8s-cleaner/reports/k8s-cleaner_reports/)

Each notification contains list of all resources successfully deleted (or modified) by k8s-cleaner. Choose what works best for you!
Expand Down Expand Up @@ -48,7 +49,7 @@ There are also examples to identify unhealthy resources:

4️⃣ **Lua-based Selection Criteria**: Leverage the [Lua](https://lua.org/) scripting language to create complex and dynamic selection criteria, catering to specific resource management needs. Define custom logic to identify and handle stale resources. To validate the Cleaner configuration, have a look [here](#validate-the-cleaner-configuration).

5️⃣ [**Notifications**](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/): Stay informed! The k8s-cleaner keeps users in the loop about every cleaned-up resource, whether removed or optimized. Get detailed notification lists and pick your preferred channel: Slack, Webex, Discord, Teams or reports.
5️⃣ [**Notifications**](https://gianlucam76.github.io/k8s-cleaner/notifications/notifications/): Stay informed! The k8s-cleaner keeps users in the loop about every cleaned-up resource, whether removed or optimized. Get detailed notification lists and pick your preferred channel: Slack, Webex, Discord, Teams, SMTP or reports.

For a complete list of **features** with **examples**, have a look at the [link](https://gianlucam76.github.io/k8s-cleaner/getting_started/features/dryrun/dryrun/).

Expand Down
Binary file added assets/smtp_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions docs/notifications/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The below notifications are available.
- **Webex**
- **Discord**
- **Teams**
- **SMTP**

## Slack Notifications Example

Expand Down Expand Up @@ -175,3 +176,48 @@ $ kubectl create secret generic teams --from-literal=TEAMS_WEBHOOK_URL="<your UR
name: teams
namespace: default
```

## SMTP Notifications Example

### Kubernetes Secret

To allow the k8s-cleaner to send an SMTP email, we need to create a Kubernetes secret:

```bash
$ kubectl create secret generic smtp \
--from-literal=SMTP_RECIPIENTS=<COMMA-SEPARATED EMAIL ADDRESSES> \
--from-literal=SMTP_BCC=<OPTIONAL, COMMA-SEPARATED EMAIL ADDRESSES> \
--from-literal=SMTP_IDENTITY=<OPTIONAL, IDENTITY/USERNAME OF THE SENDER> \
--from-literal=SMTP_SENDER=<EMAIL ADDRESS> \
--from-literal=SMTP_PASSWORD=<OPTIONAL, SMTP PASSWORD FOR EMAIL ADDRESS IF APPLICABLE> \
--from-literal=SMTP_HOST=<SMTP SERVER HOSTNAME> \
--from-literal=SMTP_PORT=<OPTIONAL, SMTP SERVER PORT, DEFAULTS TO "587">
```


!!! example "SMTP Notifications Definition"

```yaml
---
apiVersion: apps.projectsveltos.io/v1alpha1
kind: Cleaner
metadata:
name: cleaner-with-smtp-notifications
spec:
schedule: "0 * * * *"
action: Delete # Delete matching resources
resourcePolicySet:
resourceSelectors:
- namespace: test
kind: Deployment
group: "apps"
version: v1
notifications:
- name: smtp
type: SMTP
notificationRef:
apiVersion: v1
kind: Secret
name: smtp
namespace: default
```

0 comments on commit bac0e30

Please sign in to comment.