Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit 0d8cd4f

Browse files
author
Dominik Augustin
authoredMay 21, 2021
Rename all service occurences from keptn-generic-job-service to job-executor-service (#16)
* Rename all service occurences from keptn-generic-job-service to job-executor-service * Rename service config directory from generic-job to job
1 parent 1521616 commit 0d8cd4f

31 files changed

+529
-157
lines changed
 

‎.ci_env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
DOCKER_ORGANIZATION="didiladi"
2-
IMAGE="keptn-generic-job-service"
2+
IMAGE="job-executor-service"

‎.github/workflows/CI.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
- name: Set up Go 1.x
106106
uses: actions/setup-go@v2
107107
with:
108-
go-version: ^1.13
108+
go-version: ^1.16.4
109109
- name: Checkout Code
110110
uses: actions/checkout@v2
111111

‎.github/workflows/reviewdog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Set up Go
99
uses: actions/setup-go@v2
1010
with:
11-
go-version: 1.16
11+
go-version: 1.16.4
1212
id: go
1313
- name: Check out code.
1414
uses: actions/checkout@v1

‎.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vendor/*
1616

1717
# binaries (created by go build on Linux/OSX)
1818
main
19-
./keptn-generic-job-service
19+
./job-executor-service
2020

2121
# IDE specific folders
2222
.vscode

‎Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Use the offical Golang image to create a build artifact.
22
# This is based on Debian and sets the GOPATH to /go.
33
# https://hub.docker.com/_/golang
4-
FROM golang:1.13.7-alpine as builder
4+
FROM golang:1.16.4-alpine as builder
55

66
RUN apk add --no-cache gcc libc-dev git
77

8-
WORKDIR /src/keptn-generic-job-service
8+
WORKDIR /src/job-executor-service
99

1010
ARG version=develop
1111
ENV VERSION="${version}"
@@ -32,7 +32,7 @@ COPY . .
3232

3333
# Build the command inside the container.
3434
# (You may fetch or manage dependencies here, either manually or with a tool like "godep".)
35-
RUN GOOS=linux go build -ldflags '-linkmode=external' $BUILDFLAGS -v -o keptn-generic-job-service cmd/keptn-generic-job-service/main.go
35+
RUN GOOS=linux go build -ldflags '-linkmode=external' $BUILDFLAGS -v -o job-executor-service cmd/job-executor-service/main.go
3636

3737
# Use a Docker multi-stage build to create a lean production image.
3838
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
@@ -51,7 +51,7 @@ ARG version=develop
5151
ENV VERSION="${version}"
5252

5353
# Copy the binary to the production image from the builder stage.
54-
COPY --from=builder /src/keptn-generic-job-service/keptn-generic-job-service /keptn-generic-job-service
54+
COPY --from=builder /src/job-executor-service/job-executor-service /job-executor-service
5555

5656
EXPOSE 8080
5757

@@ -64,4 +64,4 @@ ENV GOTRACEBACK=all
6464
#build-uncomment ENTRYPOINT ["/entrypoint.sh"]
6565

6666
# Run the web service on container startup.
67-
CMD ["/keptn-generic-job-service"]
67+
CMD ["/job-executor-service"]

‎README.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Keptn Generic Job Service
2-
![GitHub release (latest by date)](https://img.shields.io/github/v/release/keptn-sandbox/keptn-generic-job-service)
3-
[![Go Report Card](https://goreportcard.com/badge/github.com/keptn-sandbox/keptn-generic-job-service)](https://goreportcard.com/report/github.com/keptn-sandbox/keptn-generic-job-service)
1+
# Job Executor Service
2+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/keptn-sandbox/job-executor-service)
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/keptn-sandbox/job-executor-service)](https://goreportcard.com/report/github.com/keptn-sandbox/job-executor-service)
44

55
(naming not final)
66

@@ -9,19 +9,19 @@ to run any container as a Kubernetes Job orchestrated by keptn.
99

1010
## Why?
1111

12-
The generic job service aims to tackle several current pain points with the current approach of services running in the keptn ecosystem:
12+
The job-executor-service aims to tackle several current pain points with the current approach of services running in the keptn ecosystem:
1313

1414
| Problem | Solution |
1515
|----------------|----------------|
1616
| Keptn services are constantly running while listening for cloud events coming in over NATS. This consumes unnecessary resources on the Kubernetes cluster. | By running the defined keptn tasks as short-lived workloads (Kubernetes Jobs), they just consume resources while the task is executed. |
1717
| Whenever some new functionality should be triggered by keptn, a new keptn service needs to be written. It usually wraps the functionality of the wanted framework and executes it under the hood. The downside: The code of the new keptn service needs to be written and maintained. This effort scales linearly with the amount of services. | This service can execute any framework with just a few lines of yaml configuration. No need to write or maintain any new code. |
18-
| Keptn services usually filter for a static list of events the trigger the included functionality. This is not configurable. Whenever the service should listen to a new event, the code of the service needs to be changed. | The Generic Job Service provides the means to trigger a task execution for any keptn event. This is done by matching a jsonpath to the received event payload. |
18+
| Keptn services usually filter for a static list of events the trigger the included functionality. This is not configurable. Whenever the service should listen to a new event, the code of the service needs to be changed. | The Job Executor Service provides the means to trigger a task execution for any keptn event. This is done by matching a jsonpath to the received event payload. |
1919
| Keptn services are usually opinionized on how your framework execution looks like. E.g. the locust service just executes three different (statically named) files depending on the test strategy in the shipyard. It is not possible to write tests consisting of multiply files. | This service provides the possibility to write any specified file from the keptn git repository into a mounted folder (`/keptn`) of the Kubernetes job. This is done by a initcontainer running before the specified image. |
20-
| Support for new functionality in keptn needs to be added to each keptn service individually. E.g. the new secret functionality needs to be included into all of the services running in the keptn execution plane. This slows down the availability of this new feature. | The Generic Job Service is a single service which provides the means to run any workload orchestrated by keptn. So, it is possible to support new functionality of keptn just once in this service - and all workloads profit from it. E.g. in the case of the secret functionality, one just needs to support it in this service and suddenly all the triggered Kubernetes Jobs have the correct secrets attached to it as environment variables. |
20+
| Support for new functionality in keptn needs to be added to each keptn service individually. E.g. the new secret functionality needs to be included into all of the services running in the keptn execution plane. This slows down the availability of this new feature. | The Job Executor Service is a single service which provides the means to run any workload orchestrated by keptn. So, it is possible to support new functionality of keptn just once in this service - and all workloads profit from it. E.g. in the case of the secret functionality, one just needs to support it in this service and suddenly all the triggered Kubernetes Jobs have the correct secrets attached to it as environment variables. |
2121

2222
## How?
2323

24-
Just put a file into the keptn git repository (in folder `<service>/generic-job/config.yaml`) to specify
24+
Just put a file into the keptn git repository (in folder `<service>/job/config.yaml`) to specify
2525
* the containers which should be run as Kubernetes Jobs and
2626
* the events for which they should be triggered.
2727

@@ -43,7 +43,7 @@ actions:
4343
4444
### Event Matching
4545
46-
The configuration located in `<service>/generic-job/config.yaml` contains the following section:
46+
The configuration located in `<service>/job/config.yaml` contains the following section:
4747

4848
```
4949
jsonpath:
@@ -136,40 +136,40 @@ The credits of this service heavily go to @thschue and @augustin-dt who original
136136
137137
*Please fill in your versions accordingly*
138138
139-
| Keptn Version | [Keptn-Generic-Job-Service Docker Image](https://hub.docker.com/r/didiladi/keptn-generic-job-service/tags) |
139+
| Keptn Version | [Job-Executor-Service Docker Image](https://hub.docker.com/r/didiladi/job-executor-service/tags) |
140140
|:----------------:|:----------------------------------------:|
141-
| 0.8.2 | didiladi/keptn-generic-job-service:latest |
141+
| 0.8.2 | didiladi/job-executor-service:latest |
142142
143143
## Installation
144144
145-
The *keptn-generic-job-service* can be installed as a part of [Keptn's uniform](https://keptn.sh).
145+
The *job-executor-service* can be installed as a part of [Keptn's uniform](https://keptn.sh).
146146
147147
### Deploy in your Kubernetes cluster
148148
149-
To deploy the current version of the *keptn-generic-job-service* in your Keptn Kubernetes cluster, apply the [`deploy/service.yaml`](deploy/service.yaml) file:
149+
To deploy the current version of the *job-executor-service* in your Keptn Kubernetes cluster, apply the [`deploy/service.yaml`](deploy/service.yaml) file:
150150
151151
```console
152152
kubectl apply -f deploy/service.yaml
153153
```
154154

155-
This should install the `keptn-generic-job-service` together with a Keptn `distributor` into the `keptn` namespace, which you can verify using
155+
This should install the `job-executor-service` together with a Keptn `distributor` into the `keptn` namespace, which you can verify using
156156

157157
```console
158-
kubectl -n keptn get deployment keptn-generic-job-service -o wide
159-
kubectl -n keptn get pods -l run=keptn-generic-job-service
158+
kubectl -n keptn get deployment job-executor-service -o wide
159+
kubectl -n keptn get pods -l run=job-executor-service
160160
```
161161

162162
### Up- or Downgrading
163163

164164
Adapt and use the following command in case you want to up- or downgrade your installed version (specified by the `$VERSION` placeholder):
165165

166166
```console
167-
kubectl -n keptn set image deployment/keptn-generic-job-service keptn-generic-job-service=didiladi/keptn-generic-job-service:$VERSION --record
167+
kubectl -n keptn set image deployment/job-executor-service job-executor-service=didiladi/job-executor-service:$VERSION --record
168168
```
169169

170170
### Uninstall
171171

172-
To delete a deployed *keptn-generic-job-service*, use the file `deploy/*.yaml` files from this repository and delete the Kubernetes resources:
172+
To delete a deployed *job-executor-service*, use the file `deploy/*.yaml` files from this repository and delete the Kubernetes resources:
173173

174174
```console
175175
kubectl delete -f deploy/service.yaml
@@ -190,16 +190,16 @@ When writing code, it is recommended to follow the coding style suggested by the
190190

191191
### Common tasks
192192

193-
* Build the binary: `go build -ldflags '-linkmode=external' -v -o keptn-generic-job-service`
193+
* Build the binary: `go build -ldflags '-linkmode=external' -v -o job-executor-service`
194194
* Run tests: `go test -race -v ./...`
195-
* Build the docker image: `docker build . -t didiladi/keptn-generic-job-service:dev` (Note: Ensure that you use the correct DockerHub account/organization)
196-
* Run the docker image locally: `docker run --rm -it -p 8080:8080 didiladi/keptn-generic-job-service:dev`
197-
* Push the docker image to DockerHub: `docker push didiladi/keptn-generic-job-service:dev` (Note: Ensure that you use the correct DockerHub account/organization)
195+
* Build the docker image: `docker build . -t didiladi/job-executor-service:dev` (Note: Ensure that you use the correct DockerHub account/organization)
196+
* Run the docker image locally: `docker run --rm -it -p 8080:8080 didiladi/job-executor-service:dev`
197+
* Push the docker image to DockerHub: `docker push didiladi/job-executor-service:dev` (Note: Ensure that you use the correct DockerHub account/organization)
198198
* Deploy the service using `kubectl`: `kubectl apply -f deploy/`
199199
* Delete/undeploy the service using `kubectl`: `kubectl delete -f deploy/`
200-
* Watch the deployment using `kubectl`: `kubectl -n keptn get deployment keptn-generic-job-service -o wide`
201-
* Get logs using `kubectl`: `kubectl -n keptn logs deployment/keptn-generic-job-service -f`
202-
* Watch the deployed pods using `kubectl`: `kubectl -n keptn get pods -l run=keptn-generic-job-service`
200+
* Watch the deployment using `kubectl`: `kubectl -n keptn get deployment job-executor-service -o wide`
201+
* Get logs using `kubectl`: `kubectl -n keptn logs deployment/job-executor-service -f`
202+
* Watch the deployed pods using `kubectl`: `kubectl -n keptn get pods -l run=job-executor-service`
203203
* Deploy the service using [Skaffold](https://skaffold.dev/): `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](skaffold.yaml))
204204

205205

@@ -225,7 +225,7 @@ You can find the details in [.github/workflows/tests.yml](.github/workflows/test
225225

226226
This repo uses GH Actions and Workflows to test the code and automatically build docker images.
227227

228-
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-generic-job-service/settings/secrets/actions)
228+
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/job-executor-service/settings/secrets/actions)
229229
* `REGISTRY_USER` - your DockerHub username
230230
* `REGISTRY_PASSWORD` - a DockerHub [access token](https://hub.docker.com/settings/security) (alternatively, your DockerHub password)
231231

@@ -246,7 +246,7 @@ If any problems occur, fix them in the release branch and test them again.
246246

247247
Once you have confirmed that everything works and your version is ready to go, you should
248248

249-
* create a new release on the release branch using the [GitHub releases page](https://github.com/keptn-sandbox/keptn-generic-job-service/releases), and
249+
* create a new release on the release branch using the [GitHub releases page](https://github.com/keptn-sandbox/job-executor-service/releases), and
250250
* merge any changes from the release branch back to the master branch.
251251

252252
## License

‎cmd/keptn-generic-job-service-initcontainer/main.go renamed to ‎cmd/job-executor-service-initcontainer/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"didiladi/keptn-generic-job-service/pkg/file"
5-
"didiladi/keptn-generic-job-service/pkg/keptn"
4+
"didiladi/job-executor-service/pkg/file"
5+
"didiladi/job-executor-service/pkg/keptn"
66
"log"
77
"net/url"
88
"os"
@@ -41,7 +41,7 @@ func main() {
4141
fs := afero.NewOsFs()
4242

4343
var resourceHandler *api.ResourceHandler
44-
if env.KeptnAPIToken != "" { // gets set as empty string from the generic-job-service if the env variable is not set
44+
if env.KeptnAPIToken != "" { // gets set as empty string from the job-executor-service if the env variable is not set
4545
configurationServiceURL, _ := url.Parse(env.ConfigurationServiceURL)
4646
resourceHandler = api.NewAuthenticatedResourceHandler(configurationServiceURL.String(), env.KeptnAPIToken, "x-token", nil, configurationServiceURL.Scheme)
4747
} else {

‎cmd/keptn-generic-job-service/main.go renamed to ‎cmd/job-executor-service/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"context"
5-
"didiladi/keptn-generic-job-service/pkg/eventhandler"
5+
"didiladi/job-executor-service/pkg/eventhandler"
66
"errors"
77
"log"
88
"os"
@@ -35,7 +35,7 @@ type envConfig struct {
3535
}
3636

3737
// ServiceName specifies the current services name (e.g., used as source when sending CloudEvents)
38-
const ServiceName = "keptn-generic-job-service"
38+
const ServiceName = "job-executor-service"
3939

4040
/**
4141
* Parses a Keptn Cloud Event payload (data attribute)
@@ -118,7 +118,7 @@ func _main(args []string, env envConfig) int {
118118

119119
keptnOptions.ConfigurationServiceURL = env.ConfigurationServiceURL
120120

121-
log.Println("Starting keptn-generic-job-service...")
121+
log.Println("Starting job-executor-service...")
122122
log.Printf(" on Port = %d; Path=%s", env.Port, env.Path)
123123

124124
ctx := context.Background()

‎deploy/service.yaml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
# Deployment of our keptn-generic-job-service
2+
# Deployment of our job-executor-service
33
apiVersion: apps/v1
44
kind: Deployment
55
metadata:
6-
name: keptn-generic-job-service
6+
name: job-executor-service
77
namespace: keptn
88
spec:
99
selector:
1010
matchLabels:
11-
run: keptn-generic-job-service
11+
run: job-executor-service
1212
replicas: 1
1313
template:
1414
metadata:
1515
labels:
16-
run: keptn-generic-job-service
16+
run: job-executor-service
1717
spec:
1818
containers:
19-
- name: keptn-generic-job-service
20-
image: didiladi/keptn-generic-job-service:latest
19+
- name: job-executor-service
20+
image: didiladi/job-executor-service:latest
2121
ports:
2222
- containerPort: 8080
2323
env:
@@ -52,34 +52,34 @@ spec:
5252
value: 'sh.keptn.>'
5353
- name: PUBSUB_RECIPIENT
5454
value: '127.0.0.1'
55-
serviceAccountName: keptn-generic-job-service
55+
serviceAccountName: job-executor-service
5656
---
57-
# Expose keptn-generic-job-service via Port 8080 within the cluster
57+
# Expose job-executor-service via Port 8080 within the cluster
5858
apiVersion: v1
5959
kind: Service
6060
metadata:
61-
name: keptn-generic-job-service
61+
name: job-executor-service
6262
namespace: keptn
6363
labels:
64-
run: keptn-generic-job-service
64+
run: job-executor-service
6565
spec:
6666
ports:
6767
- port: 8080
6868
protocol: TCP
6969
selector:
70-
run: keptn-generic-job-service
70+
run: job-executor-service
7171
---
7272
apiVersion: v1
7373
kind: ServiceAccount
7474
metadata:
75-
name: keptn-generic-job-service
75+
name: job-executor-service
7676
namespace: keptn
7777
---
7878
# Role for accessing secrets in the namespace
7979
apiVersion: rbac.authorization.k8s.io/v1
8080
kind: Role
8181
metadata:
82-
name: keptn-generic-job-service
82+
name: job-executor-service
8383
namespace: keptn
8484
rules:
8585
- apiGroups:
@@ -107,18 +107,18 @@ rules:
107107
verbs:
108108
- "*"
109109
---
110-
# Bind role for accessing secrets onto the generic-job-service service account
110+
# Bind role for accessing secrets onto the job-executor-service service account
111111
apiVersion: rbac.authorization.k8s.io/v1
112112
kind: RoleBinding
113113
metadata:
114-
name: keptn-generic-job-service
114+
name: job-executor-service
115115
namespace: keptn
116116
roleRef:
117117
apiGroup: rbac.authorization.k8s.io
118118
kind: Role
119-
name: keptn-generic-job-service
119+
name: job-executor-service
120120
subjects:
121121
- kind: ServiceAccount
122-
name: keptn-generic-job-service
122+
name: job-executor-service
123123
namespace: keptn
124124

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module didiladi/keptn-generic-job-service
1+
module didiladi/job-executor-service
22

33
go 1.16
44

0 commit comments

Comments
 (0)
This repository has been archived.