Skip to content

Commit

Permalink
feat: add python runtime to operator (#1498)
Browse files Browse the repository at this point in the history
Signed-off-by: realanna <anna.reale@dynatrace.com>
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
Co-authored-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
RealAnna and odubajDT committed Jun 7, 2023
1 parent d55a7ef commit b79f7c4
Show file tree
Hide file tree
Showing 46 changed files with 1,811 additions and 746 deletions.
1 change: 1 addition & 0 deletions .github/scripts/create-reports-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ for namespace in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}
createResourceReport "$logsDir/$namespace" "$namespace" "Daemonsets" false
createResourceReport "$logsDir/$namespace" "$namespace" "Statefulsets" false
createResourceReport "$logsDir/$namespace" "$namespace" "Jobs" false
createResourceReport "$logsDir/$namespace" "$namespace" "ConfigMaps" false
createResourceReport "$logsDir/$namespace" "$namespace" "KeptnApp" false
createResourceReport "$logsDir/$namespace" "$namespace" "KeptnAppVersion" false
createResourceReport "$logsDir/$namespace" "$namespace" "KeptnEvaluationDefinition" false
Expand Down
55 changes: 29 additions & 26 deletions docs/content/en/docs/crd-ref/lifecycle/v1alpha3/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Package v1alpha3 contains API Schema definitions for the lifecycle v1alpha3 API


_Appears in:_
- [FunctionSpec](#functionspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
Expand Down Expand Up @@ -107,32 +107,13 @@ _Appears in:_


_Appears in:_
- [FunctionSpec](#functionspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
| `name` _string_ | Name is the name of the referenced KeptnTaksDefinition. |


#### FunctionSpec





_Appears in:_
- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec)

| Field | Description |
| --- | --- |
| `functionRef` _[FunctionReference](#functionreference)_ | FunctionReference allows to reference another KeptnTaskDefinition which contains the source code of the function to be executes for KeptnTasks based on this KeptnTaskDefinition. This can be useful when you have multiple KeptnTaskDefinitions that should execute the same logic, but each with different parameters. |
| `inline` _[Inline](#inline)_ | Inline allows to specify the code that should be executed directly in the KeptnTaskDefinition, as a multi-line string. |
| `httpRef` _[HttpReference](#httpreference)_ | HttpReference allows to point to an HTTP URL containing the code of the function. |
| `configMapRef` _[ConfigMapReference](#configmapreference)_ | ConfigMapReference allows to reference a ConfigMap containing the code of the function. When referencing a ConfigMap, the code of the function must be available as a value of the 'code' key of the referenced ConfigMap. |
| `parameters` _[TaskParameters](#taskparameters)_ | Parameters contains parameters that will be passed to the job that executes the task. |
| `secureParameters` _[SecureParameters](#secureparameters)_ | SecureParameters contains secure parameters that will be passed to the job that executes the task. These will be stored and accessed as secrets in the cluster. |


#### FunctionStatus


Expand All @@ -154,7 +135,7 @@ _Appears in:_


_Appears in:_
- [FunctionSpec](#functionspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
Expand All @@ -168,7 +149,7 @@ _Appears in:_


_Appears in:_
- [FunctionSpec](#functionspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
Expand Down Expand Up @@ -588,7 +569,9 @@ _Appears in:_

| Field | Description |
| --- | --- |
| `function` _[FunctionSpec](#functionspec)_ | Function contains the definition for the function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. |
| `function` _[RuntimeSpec](#runtimespec)_ | Deprecated Function contains the definition for the function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. |
| `python` _[RuntimeSpec](#runtimespec)_ | Python contains the definition for the python function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. |
| `deno` _[RuntimeSpec](#runtimespec)_ | Deno contains the definition for the Deno function that is to be executed in KeptnTasks based on the KeptnTaskDefinitions. |
| `container` _[ContainerSpec](#containerspec)_ | Container contains the definition for the container that is to be used in Job based on the KeptnTaskDefinitions. |
| `retries` _integer_ | Retries specifies how many times a job executing the KeptnTaskDefinition should be restarted in the case of an unsuccessful attempt. |
| `timeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#duration-v1-meta)_ | Timeout specifies the maximum time to wait for the task to be completed successfully. If the task does not complete successfully within this time frame, it will be considered to be failed. |
Expand Down Expand Up @@ -801,15 +784,35 @@ _Appears in:_
| `name` _string_ | |


#### RuntimeSpec





_Appears in:_
- [KeptnTaskDefinitionSpec](#keptntaskdefinitionspec)

| Field | Description |
| --- | --- |
| `functionRef` _[FunctionReference](#functionreference)_ | FunctionReference allows to reference another KeptnTaskDefinition which contains the source code of the function to be executes for KeptnTasks based on this KeptnTaskDefinition. This can be useful when you have multiple KeptnTaskDefinitions that should execute the same logic, but each with different parameters. |
| `inline` _[Inline](#inline)_ | Inline allows to specify the code that should be executed directly in the KeptnTaskDefinition, as a multi-line string. |
| `httpRef` _[HttpReference](#httpreference)_ | HttpReference allows to point to an HTTP URL containing the code of the function. |
| `configMapRef` _[ConfigMapReference](#configmapreference)_ | ConfigMapReference allows to reference a ConfigMap containing the code of the function. When referencing a ConfigMap, the code of the function must be available as a value of the 'code' key of the referenced ConfigMap. |
| `parameters` _[TaskParameters](#taskparameters)_ | Parameters contains parameters that will be passed to the job that executes the task as env variables. |
| `secureParameters` _[SecureParameters](#secureparameters)_ | SecureParameters contains secure parameters that will be passed to the job that executes the task. These will be stored and accessed as secrets in the cluster. |
| `cmdParameters` _string_ | CmdParameters contains parameters that will be passed to the command |


#### SecureParameters





_Appears in:_
- [FunctionSpec](#functionspec)
- [KeptnTaskSpec](#keptntaskspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
Expand Down Expand Up @@ -842,8 +845,8 @@ _Appears in:_


_Appears in:_
- [FunctionSpec](#functionspec)
- [KeptnTaskSpec](#keptntaskspec)
- [RuntimeSpec](#runtimespec)

| Field | Description |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/yaml-crd-ref/taskdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ API Reference:
* [KeptnTaskDefinitionList](../crd-ref/lifecycle/v1alpha3/_index.md#keptntaskdefinitionlist)
* [KeptnTaskDefinitionSpec](../crd-ref/lifecycle/v1alpha3/_index.md#keptntaskdefinitionspec)
* [FunctionReference](../crd-ref/lifecycle/v1alpha3/_index.md#functionreference)
* [FunctionSpec](../crd-ref/lifecycle/v1alpha3/_index.md#functionspec)
* [FunctionSpec](../crd-ref/lifecycle/v1alpha3/_index.md#runtimespec)
* [FunctionStatus](../crd-ref/lifecycle/v1alpha3/_index.md#functionstatus)
* [HttpReference](../crd-ref/lifecycle/v1alpha3/_index.md#httpreference)
* [Inline](../crd-ref/lifecycle/v1alpha3/_index.md#inline)
Expand Down
21 changes: 21 additions & 0 deletions examples/sample-app/base/python-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnTaskDefinition
metadata:
name: python-secret
spec:
python:
httpRef:
url: https://raw.githubusercontent.com/keptn/lifecycle-controller/main/python-runtime/samples/secrets.py
parameters:
map:
user: "myuser"
secureParameters:
secret: mypysecret
---
apiVersion: v1
kind: Secret
metadata:
name: mypysecret
type: Opaque
data:
SECURE_DATA: dG9rZW46IG15dG9rZW4=
1 change: 1 addition & 0 deletions examples/sample-app/version-1/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ spec:
- app-pre-deploy-eval-1
preDeploymentTasks:
- container-sleep
- python-secret
1 change: 1 addition & 0 deletions examples/sample-app/version-2/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ spec:
- app-pre-deploy-eval-2
preDeploymentTasks:
- container-sleep
- python-secret
1 change: 1 addition & 0 deletions examples/sample-app/version-3/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ spec:
version: 0.1.2
preDeploymentTasks:
- container-sleep
- python-secret
56 changes: 28 additions & 28 deletions helm/chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,34 @@ checks

### Keptn Lifecycle Operator controller

| Name | Description | Value |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------- |
| `lifecycleOperator.manager.containerSecurityContext` | Sets security context privileges | |
| `lifecycleOperator.manager.containerSecurityContext.allowPrivilegeEscalation` | | `false` |
| `lifecycleOperator.manager.containerSecurityContext.capabilities.drop` | | `["ALL"]` |
| `lifecycleOperator.manager.containerSecurityContext.privileged` | | `false` |
| `lifecycleOperator.manager.containerSecurityContext.runAsGroup` | | `65532` |
| `lifecycleOperator.manager.containerSecurityContext.runAsNonRoot` | | `true` |
| `lifecycleOperator.manager.containerSecurityContext.runAsUser` | | `65532` |
| `lifecycleOperator.manager.containerSecurityContext.seccompProfile.type` | | `RuntimeDefault` |
| `lifecycleOperator.manager.env.keptnAppControllerLogLevel` | sets the log level of Keptn App Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppCreationRequestControllerLogLevel` | sets the log level of Keptn App Creation Request Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppVersionControllerLogLevel` | sets the log level of Keptn AppVersion Controller | `0` |
| `lifecycleOperator.manager.env.keptnEvaluationControllerLogLevel` | sets the log level of Keptn Evaluation Controller | `0` |
| `lifecycleOperator.manager.env.keptnTaskControllerLogLevel` | sets the log level of Keptn Task Controller | `0` |
| `lifecycleOperator.manager.env.keptnTaskDefinitionControllerLogLevel` | sets the log level of Keptn TaskDefinition Controller | `0` |
| `lifecycleOperator.manager.env.keptnWorkloadControllerLogLevel` | sets the log level of Keptn Workload Controller | `0` |
| `lifecycleOperator.manager.env.keptnWorkloadInstanceControllerLogLevel` | sets the log level of Keptn WorkloadInstance Controller | `0` |
| `lifecycleOperator.manager.env.optionsControllerLogLevel` | sets the log level of Keptn Options Controller | `0` |
| `lifecycleOperator.manager.env.otelCollectorUrl` | Sets the URL for the open telemetry collector | `otel-collector:4317` |
| `lifecycleOperator.manager.env.functionRunnerImage` | specify image for task runtime with Deno runner <!---x-release-please-version--> | `ghcr.io/keptn/functions-runtime:v0.7.1` |
| `lifecycleOperator.manager.env.pythonRunnerImage` | specify image for task runtime with python runner <!---x-release-please-version--> | `ghcr.io/keptn/python-runtime:0.0.0` |
| `lifecycleOperator.manager.image.repository` | specify registry for manager image | `ghcr.io/keptn/lifecycle-operator` |
| `lifecycleOperator.manager.image.tag` | select tag for manager image <!---x-release-please-version--> | `v0.7.1` |
| `lifecycleOperator.manager.imagePullPolicy` | specify pull policy for manager image | `Always` |
| `lifecycleOperator.manager.livenessProbe` | custom livenessprobe for manager container | |
| `lifecycleOperator.manager.readinessProbe` | custom readinessprobe for manager container | |
| `lifecycleOperator.manager.resources` | specify limits and requests for manager container | |
| Name | Description | Value |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------- |
| `lifecycleOperator.manager.containerSecurityContext` | Sets security context privileges | |
| `lifecycleOperator.manager.containerSecurityContext.allowPrivilegeEscalation` | | `false` |
| `lifecycleOperator.manager.containerSecurityContext.capabilities.drop` | | `["ALL"]` |
| `lifecycleOperator.manager.containerSecurityContext.privileged` | | `false` |
| `lifecycleOperator.manager.containerSecurityContext.runAsGroup` | | `65532` |
| `lifecycleOperator.manager.containerSecurityContext.runAsNonRoot` | | `true` |
| `lifecycleOperator.manager.containerSecurityContext.runAsUser` | | `65532` |
| `lifecycleOperator.manager.containerSecurityContext.seccompProfile.type` | | `RuntimeDefault` |
| `lifecycleOperator.manager.env.keptnAppControllerLogLevel` | sets the log level of Keptn App Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppCreationRequestControllerLogLevel` | sets the log level of Keptn App Creation Request Controller | `0` |
| `lifecycleOperator.manager.env.keptnAppVersionControllerLogLevel` | sets the log level of Keptn AppVersion Controller | `0` |
| `lifecycleOperator.manager.env.keptnEvaluationControllerLogLevel` | sets the log level of Keptn Evaluation Controller | `0` |
| `lifecycleOperator.manager.env.keptnTaskControllerLogLevel` | sets the log level of Keptn Task Controller | `0` |
| `lifecycleOperator.manager.env.keptnTaskDefinitionControllerLogLevel` | sets the log level of Keptn TaskDefinition Controller | `0` |
| `lifecycleOperator.manager.env.keptnWorkloadControllerLogLevel` | sets the log level of Keptn Workload Controller | `0` |
| `lifecycleOperator.manager.env.keptnWorkloadInstanceControllerLogLevel` | sets the log level of Keptn WorkloadInstance Controller | `0` |
| `lifecycleOperator.manager.env.optionsControllerLogLevel` | sets the log level of Keptn Options Controller | `0` |
| `lifecycleOperator.manager.env.otelCollectorUrl` | Sets the URL for the open telemetry collector | `otel-collector:4317` |
| `lifecycleOperator.manager.env.functionRunnerImage` | specify image for deno task runtime <!---x-release-please-version--> | `ghcr.io/keptn/functions-runtime:v0.7.1` |
| `lifecycleOperator.manager.env.pythonRunnerImage` | specify image for python task runtime <!---x-release-please-version--> | `ghcr.io/keptn/python-runtime:0.0.0` |
| `lifecycleOperator.manager.image.repository` | specify registry for manager image | `ghcr.io/keptn/lifecycle-operator` |
| `lifecycleOperator.manager.image.tag` | select tag for manager image <!---x-release-please-version--> | `v0.7.1` |
| `lifecycleOperator.manager.imagePullPolicy` | specify pull policy for manager image | `Always` |
| `lifecycleOperator.manager.livenessProbe` | custom livenessprobe for manager container | |
| `lifecycleOperator.manager.readinessProbe` | custom readinessprobe for manager container | |
| `lifecycleOperator.manager.resources` | specify limits and requests for manager container | |

### Keptn Metrics Operator common

Expand Down
4 changes: 2 additions & 2 deletions helm/chart/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
## @param lifecycleOperator.manager.env.optionsControllerLogLevel sets the log level of Keptn Options Controller

## @param lifecycleOperator.manager.env.otelCollectorUrl Sets the URL for the open telemetry collector
## @param lifecycleOperator.manager.env.functionRunnerImage specify image for task runtime with Deno runner <!---x-release-please-version-->
## @param lifecycleOperator.manager.env.pythonRunnerImage specify image for task runtime with python runner <!---x-release-please-version-->
## @param lifecycleOperator.manager.env.functionRunnerImage specify image for deno task runtime <!---x-release-please-version-->
## @param lifecycleOperator.manager.env.pythonRunnerImage specify image for python task runtime <!---x-release-please-version-->

## @param lifecycleOperator.manager.image.repository specify registry for manager image
## @param lifecycleOperator.manager.image.tag select tag for manager image <!---x-release-please-version-->
Expand Down
Loading

0 comments on commit b79f7c4

Please sign in to comment.