Skip to content

slack-infra: add slack-moderator-words config#1696

Merged
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
nikhita:slack-infra-moderator-words
Mar 23, 2021
Merged

slack-infra: add slack-moderator-words config#1696
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
nikhita:slack-infra-moderator-words

Conversation

@nikhita
Copy link
Member

@nikhita nikhita commented Feb 23, 2021

ref:

This PR adds config for slack-moderator-words to slack-infra.

/hold
Need to do a few thing before we can merge this.

/cc @ameukam @jeefy @mrbobbytables @cpanato

/assign @ameukam
Arnaud -- since you've done most of the work for setting up slack-infra, can you help with this PR? 🙏

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 23, 2021
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. wg/k8s-infra approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 23, 2021
@spiffxp
Copy link
Contributor

spiffxp commented Feb 23, 2021

/retest
kubernetes/test-infra#20962 merged

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

we might want to publish a tag besides the latest one :)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, nikhita

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nikhita
Copy link
Member Author

nikhita commented Feb 23, 2021

we might want to publish a tag besides the latest one :)

Yup, will update the config once kubernetes-sigs/slack-infra#43 merges and the image is pushed :)

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2021
@ameukam
Copy link
Member

ameukam commented Feb 23, 2021

/lgtm
/hold
Feel free to unhold where you're ready. :-)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 23, 2021
@spiffxp
Copy link
Contributor

spiffxp commented Feb 23, 2021

We chatted about getting secrets provisioned for this in slack https://kubernetes.slack.com/archives/CCK68P2Q2/p1614088645006800

As I understand it, someone from slack admins needs to provision the actual tokens etc.

They then need to go into secret manager as kubernetes Secret manifests, preferably named the same as the secret (ref: https://github.com/kubernetes/k8s.io/tree/main/slack-infra#how-to-deploy)

# $ gcloud secrets versions access latest --secret=recaptcha --project=kubernetes-public
apiVersion: v1
data:
  REDACTED: REDACTED
kind: Secret
metadata:
  name: recaptcha
type: Opaque

Existing secrets are setup so k8s-infra-rbac-slack-infra@ can write to them

# $ for s in $(gcloud secrets list --filter=labels.app=slack-infra --format="value(name)" --project=kubernetes-public); do echo '#' $s; gcloud secrets get-iam-policy $s --project=kubernetes-public; done
# recaptcha
bindings:
- members:
  - group:k8s-infra-rbac-slack-infra@kubernetes.io
  role: roles/secretmanager.admin
etag: BwWmrSbOXUQ=
version: 1
# ... etc ...

@spiffxp
Copy link
Contributor

spiffxp commented Feb 24, 2021

So, let's get you a secret to write to:

$ gcloud secrets create slack-moderator-words-config --labels=app=slack-infra --project=kubernetes-public
Created secret [slack-moderator-words-config].
$ gcloud secrets add-iam-policy-binding slack-moderator-words-config --project=kubernetes-public --member=group:k8s-infra-rbac-slack-infra@kubernetes.io --role=roles/secretmanager.admin
Updated IAM policy for secret [slack-moderator-words-config].
bindings:
- members:
  - group:k8s-infra-rbac-slack-infra@kubernetes.io
  role: roles/secretmanager.admin
etag: BwW8CaRABBs=
version: 1

To write to it once you've got your file with whatever you need provisioned by slack admins

kubectl create secret --dry-run=client generic slack-moderator-words-config --from-file=path/to/your/file -o yaml |\
  gcloud secrets versions add --project=kubernetes-public slack-moderator-words-config --data-file=-

- triggers:
- guys
action: chat.postEphemeral
message: "May I suggest \"all\" instead when addessing a group of people? Thank you. :slightly_smiling_face:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message: "May I suggest \"all\" instead when addessing a group of people? Thank you. :slightly_smiling_face:"
message: "May I suggest \"all\" instead of \"guys\" when addessing a group of people? Thank you. :slightly_smiling_face:"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

Also, confirming that the bot won't be triggered if it's a message created by the bot itself: https://github.com/kubernetes-sigs/slack-infra/blob/8525eb3de12c51a07444398ed1ba06e416d3b9ba/slack-moderator-words/events.go#L76-L79

@nikhita nikhita force-pushed the slack-infra-moderator-words branch from 184de1e to 02ea005 Compare February 24, 2021 10:03
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 24, 2021
@ameukam
Copy link
Member

ameukam commented Feb 24, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 24, 2021
@nikhita
Copy link
Member Author

nikhita commented Feb 24, 2021

As I understand it, someone from slack admins needs to provision the actual tokens etc.

Created #1719 to grant access to @mrbobbytables (slack admin, contribex co-chair), @jeefy (slack admin, slack-infra owner) and myself (contribex TL)

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@spiffxp
Copy link
Contributor

spiffxp commented Mar 3, 2021

Checking back in here, AFAIK secrets and access groups are all in place and you're good to go.

For followup on my end, I've created #1731 to track documenting secret management

@nikhita
Copy link
Member Author

nikhita commented Mar 3, 2021

I haven't had cycles to revisit this but will try to get this to the finish line by EOW.

@cpanato
Copy link
Member

cpanato commented Mar 23, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 23, 2021
@k8s-ci-robot k8s-ci-robot merged commit 6797933 into kubernetes:main Mar 23, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 23, 2021
@nikhita nikhita deleted the slack-infra-moderator-words branch March 23, 2021 09:51
@spiffxp
Copy link
Contributor

spiffxp commented Mar 24, 2021

First noticed by @ameukam, the secret had the wrong name

# gcloud secrets versions access 2 --secret=slack-moderator-words-config --project=kubernetes-public | yq -y '.data |= with_entries(.value="REDACTED")'
apiVersion: v1
data:
  config.json: REDACTED
kind: Secret
metadata:
  name: slack-event-log-config
type: Opaque

So, updated

$ gcloud secrets versions access latest --secret=slack-moderator-words-config --project=kubernetes-public \
  | yq -y '.metadata.name = "slack-moderator-words-config"' \
  | gcloud secrets versions add slack-moderator-words-config --project=kubernetes-public --data-file=-
Created version [3] of the secret [slack-moderator-words-config].

Now looks like

# $ gcloud secrets versions access latest --secret=slack-moderator-words-config --project=kubernetes-public | yq -y '.data |= with_entries(.value="REDACTED")'
apiVersion: v1
data:
  config.json: REDACTED
kind: Secret
metadata:
  name: slack-moderator-words-config
type: Opaque

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants