Awesomo bekijkt alle berichten in de kanalen waar hij is uitgenodigd. Mochten er in een bericht een of meerdere topdesk iris calls voorkomen. Dan reageert hij met een bericht met deeplinks naar die calls.
Awesomo is een hubot. Dat is een inmiddels niet meer onderhoude chatbot van github. De integratie met slack is ook legacy (en wordt niet meer geupdate) Maar het werkt allemaal nog wel. Ook zijn er nog veel meer addons te krijgen. tot een spelletje galgje aan toe.
Zie https://hubot.github.com/ en voor de slack integratie: https://slack.dev/hubot-slack/
Met onderstaand commando kun je hubot locaal in docker draaien.
docker run -d --name "hubot" -e HUBOT_SLACK_TOKEN=<slack-token> jordan/hubot-slack:latest -v <scripts_dir>:/home/hubot/scripts hubot
De daadwerkelijke code staat in topdesk.coffee.
Dit moet in de container in /home/hubot/scripts
terecht komen.
topdesk.coffee
module.exports = (robot) ->
robot.hear /I[0-9]{4}-[0-9]{5}/g, (res) ->
rv = ""
for call_nr in res.match
rv += " <https://iris.service.rug.nl/tas/secure/incident?action=lookup&lookup=naam&lookupValue=#{call_nr}|#{call_nr}>"
res.send rv
Ikzelf gerbuik dus de kubernetes van webhosting op https://k8s.rug.nl
Misschien is het het makkelijkst om zelf je deployment bij elkaar te klikken nadat je het docker run
commando hebt getest. Maar hieronder volgt toch mijn deployment.
De secrets invullen en dan zou hij het moeten doen met kubectl apply -f deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "6"
field.cattle.io/creatorId: u-yumvc4ss2r
creationTimestamp: "2022-03-25T09:14:22Z"
generation: 15
labels:
cattle.io/creator: norman
workload.user.cattle.io/workloadselector: deployment-prometheus-awesomo
managedFields:
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:field.cattle.io/creatorId: {}
f:labels:
.: {}
f:cattle.io/creator: {}
f:workload.user.cattle.io/workloadselector: {}
f:spec:
f:progressDeadlineSeconds: {}
f:revisionHistoryLimit: {}
f:selector: {}
f:strategy:
f:rollingUpdate:
.: {}
f:maxSurge: {}
f:maxUnavailable: {}
f:type: {}
f:template:
f:metadata:
f:annotations:
.: {}
f:cattle.io/timestamp: {}
f:field.cattle.io/ports: {}
f:labels:
.: {}
f:workload.user.cattle.io/workloadselector: {}
f:spec:
f:containers:
k:{"name":"awesomo"}:
.: {}
f:env:
.: {}
k:{"name":"EXTERNAL_SCRIPTS"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"HUBOT_GITHUB_TOKEN"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"HUBOT_MEMEGEN_PASSWORD"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"HUBOT_MEMEGEN_USERNAME"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"HUBOT_SLACK_TOKEN"}:
.: {}
f:name: {}
f:value: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:securityContext:
.: {}
f:allowPrivilegeEscalation: {}
f:capabilities: {}
f:privileged: {}
f:readOnlyRootFilesystem: {}
f:runAsNonRoot: {}
f:stdin: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:tty: {}
f:volumeMounts:
.: {}
k:{"mountPath":"/home/hubot/scripts"}:
.: {}
f:mountPath: {}
f:name: {}
f:subPath: {}
f:dnsPolicy: {}
f:imagePullSecrets:
.: {}
k:{"name":"registry"}:
.: {}
f:name: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:terminationGracePeriodSeconds: {}
f:volumes:
.: {}
k:{"name":"vol1"}:
.: {}
f:name: {}
f:persistentVolumeClaim:
.: {}
f:claimName: {}
k:{"name":"vol2"}:
.: {}
f:name: {}
f:persistentVolumeClaim:
.: {}
f:claimName: {}
manager: rancher
operation: Update
time: "2022-03-25T09:31:26Z"
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:spec:
f:replicas: {}
f:template:
f:spec:
f:affinity: {}
manager: agent
operation: Update
time: "2022-06-23T12:30:44Z"
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:deployment.kubernetes.io/revision: {}
f:status:
f:availableReplicas: {}
f:conditions:
.: {}
k:{"type":"Available"}:
.: {}
f:lastTransitionTime: {}
f:lastUpdateTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
k:{"type":"Progressing"}:
.: {}
f:lastTransitionTime: {}
f:lastUpdateTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
f:observedGeneration: {}
f:readyReplicas: {}
f:replicas: {}
f:updatedReplicas: {}
manager: kube-controller-manager
operation: Update
time: "2022-11-04T12:28:50Z"
name: awesomo
namespace: prometheus
resourceVersion: "621909603"
uid: 6edd831a-7036-4a6d-96aa-e77b61e3bc03
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
workload.user.cattle.io/workloadselector: deployment-prometheus-awesomo
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
annotations:
cattle.io/timestamp: "2022-03-25T09:31:26Z"
field.cattle.io/ports: '[[]]'
creationTimestamp: null
labels:
workload.user.cattle.io/workloadselector: deployment-prometheus-awesomo
spec:
affinity: {}
containers:
- env:
- name: EXTERNAL_SCRIPTS
value: hubot-help,hubot-github-reminder,hubot-games,hubot-google-translate
- name: HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING
value: "42"
- name: HUBOT_GITHUB_TOKEN
value: 9a0abdaed5266051271b27d00b1fdd387507bcd4
- name: HUBOT_MEMEGEN_PASSWORD
value: <secret>
- name: HUBOT_MEMEGEN_USERNAME
value: egonflip
- name: HUBOT_SLACK_TOKEN
value: <secret>
image: jordan/hubot-slack:latest
imagePullPolicy: Always
name: awesomo
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
runAsNonRoot: false
stdin: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
tty: true
volumeMounts:
- mountPath: /home/hubot/scripts
name: vol1
subPath: hubot/scripts
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: registry
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: vol1
persistentVolumeClaim:
claimName: hubot
status:
availableReplicas: 1
conditions:
- lastTransitionTime: "2022-03-25T09:24:07Z"
lastUpdateTime: "2022-06-23T12:30:44Z"
message: ReplicaSet "awesomo-67685c8c5" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
- lastTransitionTime: "2022-11-04T12:28:50Z"
lastUpdateTime: "2022-11-04T12:28:50Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
observedGeneration: 15
readyReplicas: 1
replicas: 1
updatedReplicas: 1