kube-event-bridge

module
v0.0.0-...-24a8654 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2023 License: Apache-2.0

README

Developing

Install tools

go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
go install github.com/google/ko@v0.11.2
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0
go install github.com/stern/stern@latest

Clone the repo

export GOPATH=${HOME}/workspaces/go # Override if desired
export PATH=$PATH:$GOPATH/bin
mkdir -p ${GOPATH}/src/github.com/ellistarn
cd ${GOPATH}/src/github.com/ellistarn
gh repo clone ellistarn/kube-event-bridge
cd kube-event-bridge

Setup AWS Resources

AWS_ACCOUNT_ID=${AWS_ACCOUNT_ID:=undefined} # Recommended to be included in your bashrc
aws ecr create-repository --repository-name kube-event-bridge/controller --image-scanning-configuration scanOnPush=true
aws iam create-policy --policy-name kube-event-bridge --policy-document '{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
          "events:*",
          "sqs:*"
      ],
      "Resource": "*"
    }
  ]
}'
eksctl create iamserviceaccount \
  --name kube-event-bridge \
  --role-name kube-event-bridge \
  --cluster $(kubectl config view --minify -o jsonpath='{.clusters[].name}' | rev | cut -d"/" -f1 | rev | cut -d"." -f1) \
  --attach-policy-arn arn:aws:iam::${AWS_ACCOUNT_ID}:policy/kube-event-bridge \
  --role-only \
  --approve

Install the controller and stream logs

make apply
stern -l app.kubernetes.io/name=kube-event-bridge

Cleanup

eksctl delete iamserviceaccount --name kube-event-bridge --cluster $(kubectl config view --minify -o jsonpath='{.clusters[].name}' | rev | cut -d"/" -f1 | rev | cut -d"." -f1)
aws iam delete-policy --policy-arn arn:aws:iam::${AWS_ACCOUNT_ID}:policy/kube-event-bridge

Demo

Remove this once we have the SQS controller

aws sqs receive-message --queue-url $(aws sqs get-queue-url --queue-name demo | jq -r ".QueueUrl")

aws sqs send-message --queue-url $(aws sqs get-queue-url --queue-name demo | jq -r ".QueueUrl") --message-body "$(echo $(k get events -ojson | jq ".items[0]"))"

aws sqs delete-message --queue-url demo --receipt-handle $(aws sqs receive-message --queue-url $(aws sqs get-queue-url --queue-name demo | jq -r ".QueueUrl") | jq -r ".Messages[].ReceiptHandle")

Directories

Path Synopsis
cmd
pkg
apis/v1alpha1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=events.amazonaws.com
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=events.amazonaws.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL