This is a Keptn Service that provides a default Helm Chart template that can be used to deploy a service.
The default Helm chart is OneChart from the Gimlet project.
Keptn Version | OneChart-Service Docker Image |
---|---|
0.8.x | keptnsandbox/onechart-service:0.1.0 |
To deploy the current version of the onechart-service in your Keptn Kubernetes cluster, apply the deploy/service.yaml
file:
kubectl apply -f deploy/service.yaml
This should install the onechart-service
together with a Keptn distributor
into the keptn
namespace, which you can verify using
kubectl -n keptn get deployment onechart-service
kubectl -n keptn get pods -l run=onechart-service
To delete a deployed onechart-service, use the file deploy/*.yaml
files from this repository and delete the Kubernetes resources:
kubectl delete -f deploy/service.yaml
Development can be conducted using any GoLang compatible IDE/editor (e.g., Jetbrains GoLand, VSCode with Go plugins).
It is recommended to make use of branches as follows:
master
contains the latest potentially unstable versionrelease-*
contains a stable version of the service (e.g.,release-0.1.0
contains version 0.1.0)- create a new branch for any changes that you are working on, e.g.,
feature/my-cool-stuff
orbug/overflow
- once ready, create a pull request from that branch back to the
master
branch
When writing code, it is recommended to follow the coding style suggested by the Golang community.
- This service handles
sh.keptn.event.service.create.started
events. - This service creates a Helm chart based on OneChart. The input that is coming in is the name of the project. Other details such as the image name are not yet available at this point. You can find the spec of the cloud event that is coming in here.
- The event handle code is in https://github.com/keptn-sandbox/onechart-service/blob/master/eventhandlers.go#L27
- Build the docker image:
make docker-build
- Run the docker image locally:
make docker-run
- Push the docker image to DockerHub:
make docker-push
- Deploy the service:
make deploy
- Do a full dev iteration with:
make iterate
- Watch the deployment using
kubectl
:kubectl -n keptn get deployment keptn-service-template-go -o wide
- Get logs using
kubectl
:kubectl -n keptn logs deployment/onechart-service -f
This repo uses reviewdog for automated reviews of Pull Requests.
You can find the details in .github/workflows/reviewdog.yml.
This repo has automated unit tests for pull requests.
You can find the details in .github/workflows/tests.yml.
This repo uses GH Actions and Workflows to test the code and automatically build docker images.
Docker Images are automatically pushed based on the configuration done in .ci_env and the two GitHub Secrets
REGISTRY_USER
- your DockerHub usernameREGISTRY_PASSWORD
- a DockerHub access token (alternatively, your DockerHub password)
It is assumed that the current development takes place in the master branch (either via Pull Requests or directly).
To make use of the built-in automation using GH Actions for releasing a new version of this service, you should
- branch away from master to a branch called
release-x.y.z
(wherex.y.z
is your version), - write release notes in the releasenotes/ folder,
- check the output of GH Actions builds for the release branch,
- verify that your image was built and pushed to DockerHub with the right tags,
- update the image tags in [deploy/service.yaml], and
- test your service against a working Keptn installation.
If any problems occur, fix them in the release branch and test them again.
Once you have confirmed that everything works and your version is ready to go, you should
- create a new release on the release branch using the GitHub releases page, and
- merge any changes from the release branch back to the master branch.
Please find more information in the LICENSE file.