wongnai / kube-slack

Kubernetes Slack Monitoring
MIT License
323 stars 59 forks source link

Release 3.2.0 (with feature: kube-slack/ignore-pod: "true") not working #21

Closed omerozery closed 6 years ago

omerozery commented 6 years ago

Release 3.2.0 (with feature: kube-slack/ignore-pod: "true") not working properly.

Slack notifications are not being sent for pods when trying to apply:

  1. Deployment in any namespace (that creates replicationSet that creates pod eventually)
  2. Pod in any namespace besides default

It only sends slack notifications when applying a pod directly (like in the example) and in the default namespace.

NOTE: i tried to deploy kube-slack on kube-system, default and custom namespace.

node-slack log:

(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot read property 'kube-slack/ignore-pod' of undefined ...

Release 3.1.1 is working fine

whs commented 6 years ago

@chribsen

whs commented 6 years ago

I'm not sure I understand the question right. Are you having problem with ignore-pod or the whole system never worked?

Could you post your kube-slack env options?

omerozery commented 6 years ago

i'm having problems with the whole system. i don't use the "ignore-pod" feature... but node-slack log is showing the above error anyway. Have you been able to deploy release 3.2.0 ?, is it working for you ?

chribsen commented 6 years ago

Can you please post your deployment manifest?

omerozery commented 6 years ago

Its a copy of the example in your README file (nothing spacial):


apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: kube-slack
  namespace: kube-system
spec:
  replicas: 1
  revisionHistoryLimit: 3
  template:
    metadata:
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ""
      name: kube-slack
      labels:
        app: kube-slack
    spec:
      serviceAccountName: kube-slack
      containers:
      - name: kube-slack
        image: willwill/kube-slack:v3.2.0
        env:
        - name: SLACK_URL
          value: [SOME_SLACK_URL_OF_MY_COMPANY]
        resources:
          requests:
            memory: 30M
            cpu: 5m
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
      - key: CriticalAddonsOnly
        operator: Exists
chribsen commented 6 years ago

@omerozery thanks for reporting this issue. It turned out to be that the Kubernetes API omits the annotations object if the Pod doesn't have any annotations (which makes sense). This raised a TypeError because the code was trying to access a undefined value as an object.

omerozery commented 6 years ago

Great :) glad i could help