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

Commit

Permalink
feat: Use cp-connector instead of distributor (#817)
Browse files Browse the repository at this point in the history
* Update dependencies

Signed-off-by: Arthur Pitman <[email protected]>

* Use `api.InternalAPISet`

Signed-off-by: Arthur Pitman <[email protected]>

* Allow in-cluster API mappings

Signed-off-by: Arthur Pitman <[email protected]>

* Remove hard-coded defaults from deployment

Signed-off-by: Arthur Pitman <[email protected]>

* Switch to cp-connector

Signed-off-by: Arthur Pitman <[email protected]>

* Linting

Signed-off-by: Arthur Pitman <[email protected]>

* Remove unused health package

Signed-off-by: Arthur Pitman <[email protected]>

* Add todo

Signed-off-by: Arthur Pitman <[email protected]>

* Use `controlplane.EventSender` directly

Signed-off-by: Arthur Pitman <[email protected]>

* Improve error message

Signed-off-by: Arthur Pitman <[email protected]>

* Improve health and readiness endpoints

Signed-off-by: Arthur Pitman <[email protected]>

* Add distributor version

Signed-off-by: Arthur Pitman <[email protected]>

* Allow API service URL customization

Signed-off-by: Arthur Pitman <[email protected]>

* Add missing error assignment

Signed-off-by: Arthur Pitman <[email protected]>

* Remove unused error from function signature

Signed-off-by: Arthur Pitman <[email protected]>

* Update TODOs

Signed-off-by: Arthur Pitman <[email protected]>

* Update distributor version

Signed-off-by: Arthur Pitman <[email protected]>

* Go mod tidy

Signed-off-by: Arthur Pitman <[email protected]>
  • Loading branch information
arthurpitman authored Jun 14, 2022
1 parent 6fcb16b commit 9fb6b1e
Show file tree
Hide file tree
Showing 22 changed files with 423 additions and 577 deletions.
11 changes: 0 additions & 11 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ The following table lists the configurable parameters of the *dynatrace-service*
| `dynatraceService.config.httpsProxy` | Proxy for HTTPS requests | `""` |
| `dynatraceService.config.noProxy` | Proxy exceptions for HTTP and HTTPS requests | `""` |
| `dynatraceService.config.logLevel`| Minimum log level to log | `info` |
| `distributor.stageFilter` | Sets the stage this *dynatrace-service* belongs to | `""` |
| `distributor.serviceFilter` | Sets the service this *dynatrace-service* belongs to | `""` |
| `distributor.projectFilter` | Sets the project this *dynatrace-service* belongs to | `""` |
| `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 or 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 | `{}` |
Expand Down
117 changes: 34 additions & 83 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,45 @@ spec:
- containerPort: 80
env:
- name: DATASTORE
value: 'http://mongodb-datastore:8080'
value: ''
- name: CONFIGURATION_SERVICE
value: 'http://configuration-service:8080'
value: ''
- name: SHIPYARD_CONTROLLER
value: 'http://shipyard-controller:8080'
- name: PLATFORM
value: kubernetes
value: ''
- name: K8S_DEPLOYMENT_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: 'metadata.labels[''app.kubernetes.io/name'']'
- name: K8S_DEPLOYMENT_VERSION
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: 'metadata.labels[''app.kubernetes.io/version'']'
- name: K8S_DEPLOYMENT_COMPONENT
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: 'metadata.labels[''app.kubernetes.io/component'']'
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: K8S_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: GENERATE_TAGGING_RULES
value: '{{ .Values.dynatraceService.config.generateTaggingRules }}'
Expand Down Expand Up @@ -103,84 +132,6 @@ spec:
periodSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
- name: distributor
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.distributor.image.repository }}:{{ .Values.distributor.image.tag }}"
livenessProbe:
httpGet:
path: /health
port: 8070
initialDelaySeconds: 0
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
imagePullPolicy: Always
ports:
- containerPort: 8080
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "500m"
env:
- name: PUBSUB_TOPIC
value: 'sh.keptn.>'
- name: PUBSUB_RECIPIENT
value: '127.0.0.1'
- name: STAGE_FILTER
value: "{{ .Values.distributor.stageFilter }}"
- name: PROJECT_FILTER
value: "{{ .Values.distributor.projectFilter }}"
- name: SERVICE_FILTER
value: "{{ .Values.distributor.serviceFilter }}"
{{- if .Values.remoteControlPlane.enabled }}
- name: KEPTN_API_ENDPOINT
value: "{{ .Values.remoteControlPlane.api.protocol }}://{{ .Values.remoteControlPlane.api.hostname }}/api"
- name: KEPTN_API_TOKEN
value: "{{ .Values.remoteControlPlane.api.token }}"
- name: HTTP_SSL_VERIFY
value: "{{ .Values.remoteControlPlane.api.apiValidateTls | default "true" }}"
{{- end }}
- name: VERSION
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: 'metadata.labels[''app.kubernetes.io/version'']'
- name: K8S_DEPLOYMENT_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: 'metadata.labels[''app.kubernetes.io/name'']'
- name: K8S_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: K8S_NAMESPACE
{{- if .Values.distributor.metadata.namespace }}
value: {{ .Values.distributor.metadata.namespace }}
{{- else }}
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
{{- end }}
- name: K8S_NODE_NAME
{{- if .Values.distributor.metadata.hostname }}
value: {{ .Values.distributor.metadata.hostname }}
{{- else }}
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
19 changes: 0 additions & 19 deletions chart/templates/tests/test-api-connection.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"remoteControlPlane": {
"type": "object",
"required": [
"enabled"
],
"properties": {
"enabled": {
"type": "boolean"
}
},
"if": {
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"properties": {
"api": {
"type": "object",
"required": [
"protocol",
"hostname",
"token"
],
"properties": {
"hostname": {
"pattern": "^([a-z0-9][a-z0-9-.]{2,63})(:[0-9]+)?$"
},
"protocol": {
"enum": [
"http",
"https"
]
},
"apiValidateTls": {
"type": "boolean"
},
"token": {
"pattern": "^[A-Za-z0-9-.]{2,63}$"
}
}
}
}
}
},
"dynatraceService": {
"type": "object",
"required": [
Expand Down Expand Up @@ -116,36 +69,6 @@
}
}
},
"distributor": {
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"properties": {
"repository": {
"pattern": "[a-z][a-z0-9-./]{2,63}$"
},
"pullPolicy": {
"enum": [
"IfNotPresent",
"Always"
]
}
}
},
"stageFilter": {
"pattern": "^$|[A-Za-z0-9-.]{2,63}$"
},
"serviceFilter": {
"pattern": "^$|[A-Za-z0-9-.]{2,63}$"
},
"projectFilter": {
"pattern": "^$|[A-Za-z0-9-.]{2,63}$"
}
}
},
"terminationGracePeriodSeconds": {
"type": "integer"
},
Expand Down
20 changes: 0 additions & 20 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,6 @@ dynatraceService:
keptnApiUrl: "" # URL of keptn API
keptnBridgeUrl: "" # URL of keptn bridge

distributor:
metadata:
hostname: "" # Sets the hostname sent by the distributor to the control-plane
namespace: "" # Sets the namespace sent by the distributor to the control-plane
stageFilter: "" # Sets the stage this dynatrace-service belongs to
serviceFilter: "" # Sets the service this dynatrace-service belongs to
projectFilter: "" # Sets the project this dynatrace-service belongs to
image:
repository: docker.io/keptn/distributor # Container Image Name
pullPolicy: IfNotPresent # Kubernetes Image Pull Policy
tag: "" # Container Tag

remoteControlPlane:
enabled: false # Enables remote execution plane mode
api:
protocol: "https" # Used Protocol (http, https)
hostname: "" # Hostname of the control plane cluster (and Port)
apiValidateTls: true # Defines if the control plane certificate should be validated
token: "" # Keptn API Token

imagePullSecrets: [] # Secrets to use for container registry credentials

serviceAccount:
Expand Down
Loading

0 comments on commit 9fb6b1e

Please sign in to comment.