Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: keptn-sandbox/keptn-service-template-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ee1c897696818dcb0113d0c126f2a98d62a649dc
Choose a base ref
..
head repository: keptn-sandbox/keptn-service-template-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7c57967e3339a512e0547cf55cc4e12017ea913a
Choose a head ref
2 changes: 1 addition & 1 deletion .github/actions/unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ runs:
- name: Check out code.
uses: actions/checkout@v3.0.2
- name: Install Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v3.2.1
with:
go-version-file: "go.mod"
- name: Install gotestsum
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ jobs:

- name: Docker Build
id: docker_build
uses: keptn/gh-automation/.github/actions/docker-build@v1.5.3
uses: keptn/gh-automation/.github/actions/docker-build@v1.6.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAGS: |
2 changes: 1 addition & 1 deletion .github/workflows/initrepo.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3.0.2
- name: Setup Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v3.2.1
with:
go-version-file: "go.mod"
- run: go version
9 changes: 7 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v3.0.2

- name: Install Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v3.2.1
with:
go-version-file: "go.mod"

@@ -117,7 +117,7 @@ jobs:
- name: Install Keptn
id: install_keptn
uses: keptn-sandbox/action-install-keptn@v2.0.0
uses: keptn-sandbox/action-install-keptn@v3.0.0
timeout-minutes: 5
with:
KEPTN_VERSION: ${{ matrix.keptn-version }}
@@ -169,7 +169,12 @@ jobs:
kubectl describe nodes > k8s_debug/k8s_describe_nodes.txt
kubectl cluster-info dump > k8s_debug/k8s_cluster_info_dump.txt
kubectl get all -n keptn -o json > k8s_debug/k8s_keptn_objects.json
kubectl get events -n keptn --sort-by='.metadata.creationTimestamp' -A > k8s_debug/keptn_events.txt
kubectl logs -n keptn -l app.kubernetes.io/instance=keptn --prefix=true --previous=false --all-containers > k8s_debug/k8s_keptn_logs.txt || true
kubectl logs -n keptn -l app.kubernetes.io/instance=keptn-service-template-go --prefix=true --previous=false --all-containers > k8s_debug/service_template_logs.txt || true
kubectl logs -n keptn -l app.kubernetes.io/instance=keptn-service-template-go --prefix=true --previous=true --all-containers > k8s_debug/service_template_logs_previous.txt || true
kubectl describe pod -n keptn -l app.kubernetes.io/instance=keptn-service-template-go > k8s_debug/keptn_service_template_describe.txt || true
kubectl logs deployment/keptn-service-template-go -n keptn > k8s_debug/keptn_service_template_deployment_logs.txt || true
kubectl logs deployment/keptn-gitea-provisioner-service --prefix=true --previous=false --all-containers > k8s_debug/k8s_gitea_provisioner_logs.txt || true
kubectl get statefulsets,configmaps,pods,networkpolicy,serviceaccounts,role,rolebindings,events,services -n ${GITEA_NAMESPACE} -o json > k8s_debug/k8s_objects_gitea.json
kubectl logs statefulsets/gitea --prefix=true --previous=false --all-containers -n ${GITEA_NAMESPACE} > k8s_debug/k8s_logs_gitea.txt || true
4 changes: 2 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
pre-release:
needs: test
name: Pre-Release
uses: keptn/gh-automation/.github/workflows/pre-release-integration.yml@v1.5.3
uses: keptn/gh-automation/.github/workflows/pre-release-integration.yml@v1.6.0

docker_build:
needs: [pre-release]
@@ -39,7 +39,7 @@ jobs:
script: return '${{ github.repository_owner }}'.toLowerCase()

- name: Docker Build
uses: keptn/gh-automation/.github/actions/docker-build@v1.5.3
uses: keptn/gh-automation/.github/actions/docker-build@v1.6.0
with:
TAGS: |
ghcr.io/${{ steps.repo_slug.outputs.result }}/${{ env.IMAGE }}:${{ env.VERSION }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
release:
needs: test
name: Release
uses: keptn/gh-automation/.github/workflows/release-integration.yml@v1.5.3
uses: keptn/gh-automation/.github/workflows/release-integration.yml@v1.6.0

docker_build:
needs: [release]
@@ -39,7 +39,7 @@ jobs:
script: return '${{ github.repository_owner }}'.toLowerCase()

- name: Docker Build
uses: keptn/gh-automation/.github/actions/docker-build@v1.5.3
uses: keptn/gh-automation/.github/actions/docker-build@v1.6.0
with:
TAGS: |
ghcr.io/${{ steps.repo_slug.outputs.result }}/${{ env.IMAGE }}:${{ env.VERSION }}
2 changes: 1 addition & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:
- name: Check out code.
uses: actions/checkout@v3.0.2
- name: Set up Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v3.2.1
with:
go-version-file: "go.mod"
id: go
2 changes: 1 addition & 1 deletion .github/workflows/validate-semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ on:
- synchronize
jobs:
validate:
uses: keptn/gh-automation/.github/workflows/validate-semantic-pr.yml@v1.5.3
uses: keptn/gh-automation/.github/workflows/validate-semantic-pr.yml@v1.6.0
with:
# Configure which scopes are allowed.
scopes: |
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# README

**BEFORE YOU START**, please be aware that there are more ways to integrate with your service that don't require creating a service from this template, see https://keptn.sh/docs/0.14.x/integrations/how_integrate/ for more details.
**PLEASE CONSIDER USING ALTERNATIVE WAYS OF CREATING YOUR KEPTN INTEGRATION**.

There are more ways to integrate with your service that don't require creating a service from this template, see https://keptn.sh/docs/0.17.x/integrations/how_integrate/ for more details.

Examples:

* Webhooks: https://keptn.sh/docs/0.14.x/integrations/webhooks/
* Webhooks: https://keptn.sh/docs/0.17.x/integrations/webhooks/
* Job-Executor-Service: https://github.com/keptn-sandbox/job-executor-service

In addition, creating your own integration based on the service-template has been reduced to just using [Keptn's go-utils]( https://github.com/keptn/go-utils/)
and is based on [**the example provided in go-utils**](https://github.com/keptn/go-utils/tree/master/examples/go-sdk).

---

This is a Keptn Service Template written in GoLang. Follow the instructions below for writing your own Keptn integration.
@@ -33,9 +38,9 @@ This implements a keptn-service-template-go for Keptn. If you want to learn more

| Keptn Version* | [Keptn-service-template-go version](https://github.com/keptn-sandbox/keptn-service-template-go/releases) |
|:--------------:|:--------------------------------------------------------------------------------------------------------:|
| 0.13.x | 0.13.0 |
| 0.14.x | 0.14.0 |
| 0.17.x | 0.17.0 |
| 0.13.x | 0.13.0 |
| 0.14.x | 0.14.0 |
| 0.17.x | 0.17.0 |


\* This is the Keptn version we aim to be compatible with. Other versions should work too, but there is no guarantee.
@@ -56,7 +61,7 @@ for example:
helm install -n keptn keptn-service-template-go chart/
```

This should install the `keptn-service-template-go` together with a Keptn `distributor` into the `keptn` namespace, which you can verify using
This should install the `keptn-service-template-go` into the `keptn` namespace, which you can verify using

```console
kubectl -n keptn get deployment keptn-service-template-go -o wide
@@ -94,15 +99,14 @@ When writing code, it is recommended to follow the coding style suggested by the

### Where to start

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

Please read the documentation provided by [Keptn/go-utils](https://github.com/keptn/go-utils/tree/master/examples/go-sdk), as it explains how to integrate with Keptn.

To better understand all variants of Keptn CloudEvents, please look at the [Keptn Spec](https://github.com/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](main.go) (specifically `processKeptnCloudEvent`), [chart/values.yaml](chart/values.yaml),
consult the [Keptn docs](https://keptn.sh/docs/) as well as existing [Keptn Core](https://github.com/keptn/keptn) and
[Keptn Contrib](https://github.com/keptn-contrib/) services.
If you want to look at handler implementations, you can take a look at the [go-utils based example](https://github.com/keptn/go-utils/blob/master/examples/go-sdk/handler.go),
as well as the concrete implementations within the [handler/](handler/) folder, e.g.:
* [action-triggered](handler/action_triggered_event_handler.go)
* [get-sli-triggered](handler/get_sli_triggered_event_handler.go)

### Common tasks

@@ -136,11 +140,7 @@ You can find the details in [.github/workflows/CI.yml](.github/workflows/CI.yml)

### GH Actions/Workflow: Build Docker Images

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](.ci_env) and the two [GitHub Secrets](https://github.com/keptn-sandbox/keptn-service-template-go/settings/secrets/actions)
* `REGISTRY_USER` - your DockerHub username
* `REGISTRY_PASSWORD` - a DockerHub [access token](https://hub.docker.com/settings/security) (alternatively, your DockerHub password)
This repo uses GH Actions and Workflows to test the code and automatically build containers and upload it to `ghcr.io`.

## How to release a new version of this service

56 changes: 22 additions & 34 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -9,37 +9,25 @@ Helm Chart for the keptn keptn-service-template-go

The following table lists the configurable parameters of the keptn-service-template-go chart and their default values.

| Parameter | Description | Default |
| ------------------------ | ----------------------- | -------------- |
| `image.repository` | Container image name | `"ghcr.io/keptn-sandbox/keptn-service-template-go"` |
| `image.pullPolicy` | Kubernetes image pull policy | `"IfNotPresent"` |
| `image.tag` | Container tag | `""` |
| `service.enabled` | Creates a kubernetes service for the keptn-service-template-go | `true` |
| `distributor.stageFilter` | Sets the stage this helm service belongs to | `""` |
| `distributor.serviceFilter` | Sets the service this helm service belongs to | `""` |
| `distributor.projectFilter` | Sets the project this helm service belongs to | `""` |
| `distributor.pubsubTopic` | Sets the events the service subscribes to. *NOTE: in case of remote control plane wildcards like "sh.keptn.>" don't work, please provide a comma-separated list of explicit events* | `"sh.keptn.>"` |
| `distributor.image.repository` | Container image name | `"docker.io/keptn/distributor"` |
| `distributor.image.pullPolicy` | Kubernetes image pull policy | `"IfNotPresent"` |
| `distributor.image.tag` | Container tag | `""` |
| `remoteControlPlane.enabled` | Enables remote execution plane mode | `false` |
| `remoteControlPlane.api.protocol` | Used protocol (http, https | `"https"` |
| `remoteControlPlane.api.hostname` | Hostname of the control plane cluster (and port) | `""` |
| `remoteControlPlane.api.apiValidateTls` | Defines if the control plane certificate should be validated | `true` |
| `remoteControlPlane.api.token` | Keptn api token | `""` |
| `imagePullSecrets` | Secrets to use for container registry credentials | `[]` |
| `serviceAccount.create` | Enables the service account creation | `true` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. | `""` |
| `podAnnotations` | Annotations to add to the created pods | `{}` |
| `podSecurityContext` | Set the pod security context (e.g. fsgroups) | `{}` |
| `securityContext` | Set the security context (e.g. runasuser) | `{}` |
| `resources` | Resource limits and requests | `{}` |
| `nodeSelector` | Node selector configuration | `{}` |
| `tolerations` | Tolerations for the pods | `[]` |
| `affinity` | Affinity rules | `{}` |





| Parameter | Description | Default |
|-----------------------------------------|----------------------------------------------------------------|-----------------------------------------------------|
| `image.repository` | Container image name | `"ghcr.io/keptn-sandbox/keptn-service-template-go"` |
| `image.pullPolicy` | Kubernetes image pull policy | `"IfNotPresent"` |
| `image.tag` | Container tag | `""` |
| `service.enabled` | Creates a kubernetes service for the keptn-service-template-go | `true` |
| `remoteControlPlane.enabled` | Enables remote execution plane mode | `false` |
| `remoteControlPlane.api.protocol` | Used protocol (http, https | `"https"` |
| `remoteControlPlane.api.hostname` | Hostname of the control plane cluster (and port) | `""` |
| `remoteControlPlane.api.token` | Keptn api token | `""` |
| `imagePullSecrets` | Secrets to use for container registry credentials | `[]` |
| `serviceAccount.create` | Enables the service account creation | `true` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. | `""` |
| `podAnnotations` | Annotations to add to the created pods | `{}` |
| `podSecurityContext` | Set the pod security context (e.g. fsgroups) | `{}` |
| `securityContext` | Set the security context (e.g. runasuser) | `{}` |
| `resources` | Resource limits and requests | `{}` |
| `nodeSelector` | Node selector configuration | `{}` |
| `tolerations` | Tolerations for the pods | `[]` |
| `affinity` | Affinity rules | `{}` |
| `subscription.pubsubTopic` | Sets the events the service subscribes to | `"sh.keptn.>"` |
Loading