fluxcd / notification-controller

The GitOps Toolkit event forwarded and notification dispatcher

Home Page:https://fluxcd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notifications username for slack is not really working

jprecuch opened this issue · comments

Describe the bug

I have provider with following

apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
  name: slack
  namespace: flux-system
spec:
  type: slack
  channel: fluxcd-poc-alerts
  username: GCP
  secretRef:
    name: fluxcd-slack-url

It is also properly configured on cluster

$ kubectl get provider -n flux-system -oyaml
apiVersion: v1
items:
- apiVersion: notification.toolkit.fluxcd.io/v1beta1
  kind: Provider
  metadata:
    creationTimestamp: "2022-03-17T10:04:05Z"
    generation: 4
    labels:
      kustomize.toolkit.fluxcd.io/name: infrastructure
      kustomize.toolkit.fluxcd.io/namespace: flux-system
    name: slack
    namespace: flux-system
    resourceVersion: "24665183"
    uid: 11e98065-45f2-4830-8c1a-d15947d608f4
  spec:
    channel: fluxcd-poc-alerts
    secretRef:
      name: fluxcd-slack-url
    type: slack
    username: GCP
  status:
    conditions:
    - lastTransitionTime: "2022-03-17T10:25:56Z"
      message: Initialized
      observedGeneration: 1
      reason: Succeeded
      status: "True"
      type: Ready
    observedGeneration: 4

However when I changed something the Slack notification does not have the username from this Provider configuration but uses default = Slack application name.

Steps to reproduce

  1. Deploy provider based on above where you use app with different name than what you specified to username
  2. Change something in code
  3. Check slack and see that the notification is using the default app name and not the username from Provider config

Expected behavior

Username should overwrite default app name

Screenshots and recordings

No response

OS / Distro

GKE

Flux version

0.27.3

Flux check

flux check
► checking prerequisites
✗ flux 0.27.3 <0.27.4 (new version is available, please upgrade)
Kubernetes 1.21.9-gke.1002 >=1.20.6-0
► checking controllers
helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.17.1
kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.21.1
notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.22.2
source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.21.2
all checks passed

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

This is a Slack limitation that we've documented here: https://fluxcd.io/docs/components/notification/provider/#slack-app

All messages are posted with the app username, and not the name of the controller (e.g. helm-controller, source-controller`)

The username only works when using the Slack webhook method.