Skip to content

kubeshop/testkube-executor-keptn

Repository files navigation

TestKube Executor Keptn

License PRs Welcome Go Report Card

Discord server: https://discord.gg/8RVUapTP

DockerHub repository: https://hub.docker.com/repository/docker/kubeshop/testkube-executor-keptn

This is a Keptn Service Template written in GoLang. Follow the instructions below for writing your own Keptn integration.

Where to start

If you don't care about the details, your first entrypoint is eventhandlers.go. Within this file you can add implementation for pre-defined Keptn Cloud events.

To better understand all variants of Keptn CloudEvents, please look at the Keptn Spec.

If you want to get more insights into processing those CloudEvents or even defining your own CloudEvents in code, please look into main.go (specifically processKeptnCloudEvent), deploy/service.yaml, consult the Keptn docs as well as existing Keptn Core and Keptn Contrib services.

Common tasks

  • Build the binary: go build -ldflags '-linkmode=external' -v -o testkube-executor-keptn
  • Run tests: go test -race -v ./...
  • Build the docker image: docker build . -t kubeshop/testkube-executor-keptn:0.12.0 (Note: Ensure that you use the correct DockerHub account/organization)
  • Run the docker image locally: docker run --rm -it -p 8080:8080 kubeshop/testkube-executor-keptn:0.12.0
  • Push the docker image to DockerHub: docker push kubeshop/testkube-executor-keptn:0.12.0 (Note: Ensure that you use the correct DockerHub account/organization)
  • Deploy the service using kubectl: kubectl apply -f deploy/
  • Delete/undeploy the service using kubectl: kubectl delete -f deploy/
  • Watch the deployment using kubectl: kubectl -n keptn get deployment testkube-executor-keptn -o wide
  • Get logs using kubectl: kubectl -n keptn logs deployment/testkube-executor-keptn -f
  • Watch the deployed pods using kubectl: kubectl -n keptn get pods -l run=testkube-executor-keptn
  • Deploy the service using Skaffold: skaffold run --default-repo=your-docker-registry --tail (Note: Replace your-docker-registry with your DockerHub username; also make sure to adapt the image name in skaffold.yaml)

Testing Cloud Events

We have dummy cloud-events in the form of RFC 2616 requests in the test-events/ directory. These can be easily executed using third party plugins such as the Huachao Mao REST Client in VS Code.