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

Commit

Permalink
Merge pull request #30 from keptn/feature/467/merge-master
Browse files Browse the repository at this point in the history
Release 0.1.2
  • Loading branch information
agrimmer authored Jun 28, 2019
2 parents 6b62569 + c132f44 commit b6ccdd3
Show file tree
Hide file tree
Showing 19 changed files with 822 additions and 55 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
dynatrace-service
# Binary
./dynatrace-service

# Auto-generated files
./deploy/manifests/dynatrace/gen/cr*

# Creds files
deploy/scripts/creds_dt.json
deploy/scripts/*creds*.json
creds_dt.json
80 changes: 48 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,71 @@
# Dynatrace Service
# Dynatrace Service and Dynatrace OneAgent Operator

This service sends information about the current state of a pipeline run for a service to Dynatrace by sending events for the correlating detected service.
The dynatrace-service sends information about the current state of a pipeline run for a service to Dynatrace by sending events for the correlating detected service.
The service is subscribed to the following keptn events:

- sh.keptn.events.deployment-finished
- sh.keptn.events.evaluation-done
- sh.keptn.events.tests-finished

## Installation
## Installation of Dynatrace Service and Dynatrace OneAgent Operator

To use this service, you must have set up Dynatrace monitoring, as described in the [documentation](https://keptn.sh/docs/0.2.1/monitoring/dynatrace/).
Afterwards, to install the service in your keptn installation checkout or copy the `dynatrace-service.yaml`.
1. Define your credentials by executing the following script:
```console
cd ./deploy/scripts
./defineDynatraceCredentials.sh
```
When the script asks for your Dynatrace tenant, please enter your tenant according to the appropriate pattern:
- Dynatrace SaaS tenant: `{your-environment-id}.live.dynatrace.com`
- Dynatrace-managed tenant: `{your-domain}/e/{your-environment-id}`

Then apply the `dynatrace-service.yaml` using `kubectl` to create the Dynatrace service and the subscriptions to the keptn channels.
1. Execute the installation script `deployDynatrace.sh` in the `/deploy/scripts` folder:
```console
./deployDynatrace.sh
```
When this script is finished, the Dynatrace OneAgent and the dynatrace-service are deployed in your cluster. Execute the following commands to verify the deployment of the dynatrace-service.

```
kubectl apply -f dynatrace-service.yaml
```
```console
kubectl get ksvc dynatrace-service -n keptn
```

Expected output:
```console
NAME DOMAIN LATESTCREATED LATESTREADY READY
dynatrace-service dynatrace-service.keptn.svc.cluster.local dynatrace-service-26sm4 dynatrace-service-26sm4 True
```

```console
kubectl get subscription -n keptn | grep dynatrace-subscription
```

```console
dynatrace-subscription-deployment-finished True
dynatrace-subscription-evaluation-done True
dynatrace-subscription-tests-finished True
```

When the next event is sent to any of the keptn channels you see an event in Dynatrace for the correlating service:
![Dynatrace events](assets/events.png?raw=true "Dynatrace Events")

## Installation of dynatrace-service only

To use this service, you must have set up Dynatrace monitoring, as described in the [documentation](https://keptn.sh/docs/0.2.1/monitoring/dynatrace/).
Afterwards, apply the `dynatrace-service.yaml` using `kubectl` to create the dynatrace-service and the subscriptions to the keptn channels.

```console
kubectl apply -f ./deploy/manifests/dynatrace-service/dynatrace-service.yaml
```

```console
service.serving.knative.dev/dynatrace-service created
subscription.eventing.knative.dev/dynatrace-subscription-deployment-finished created
subscription.eventing.knative.dev/dynatrace-subscription-tests-finished created
subscription.eventing.knative.dev/dynatrace-subscription-evaluation-done created
```

## Verification of installation

```
$ kubectl get ksvc dynatrace-service -n keptn
NAME DOMAIN LATESTCREATED LATESTREADY READY REASON
dynatrace-service dynatrace-service.keptn.x.x.x.x.xip.io dynatrace-service-dd9km dynatrace-service-dd9km True
```

```
$ kubectl get subscription -n keptn | grep dynatrace-subscription
dynatrace-subscription-deployment-finished True
dynatrace-subscription-evaluation-done True
dynatrace-subscription-tests-finished True
$
```

When the next event is sent to any of the keptn channels you should see an event in Dynatrace for the correlating service:
![Dynatrace events](assets/events.png?raw=true "Dynatrace Events")

## Uninstall service
## Uninstall of dynatrace-service only

To uninstall the dynatrace service and remove the subscriptions to keptn channels execute this command.

```
kubectl delete -f dynatrace-service.yaml
```console
kubectl delete -f ./deploy/manifests/dynatrace-service/dynatrace-service.yaml
```
11 changes: 0 additions & 11 deletions buildAndDeploy.sh

This file was deleted.

4 changes: 0 additions & 4 deletions deploy.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This is a very simple Knative Service that writes the input request to its log.

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
Expand All @@ -13,7 +11,7 @@ spec:
revisionTemplate:
spec:
container:
image: keptn/dynatrace-service:0.1.1
image: keptn/dynatrace-service:0.1.2
env:
- name: DT_API_TOKEN
valueFrom:
Expand All @@ -29,7 +27,7 @@ spec:
apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
name: dynatrace-subscription-deployment-finished
name: dynatrace-service-deployment-finished-subscription
namespace: keptn
spec:
channel:
Expand All @@ -45,7 +43,7 @@ spec:
apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
name: dynatrace-subscription-tests-finished
name: dynatrace-service-tests-finished-subscription
namespace: keptn
spec:
channel:
Expand All @@ -61,7 +59,7 @@ spec:
apiVersion: eventing.knative.dev/v1alpha1
kind: Subscription
metadata:
name: dynatrace-subscription-evaluation-done
name: dynatrace-service-evaluation-done-subscription
namespace: keptn
spec:
channel:
Expand Down
5 changes: 5 additions & 0 deletions deploy/manifests/dynatrace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dynatrace OneAgent Operator

The [Dynatrace OneAgent Operator](https://github.com/Dynatrace/dynatrace-oneagent-operator) will be downloaded and stored here by the `setupInfastructure` script when setting up keptn. Please do not remove this directory.


3 changes: 3 additions & 0 deletions deploy/manifests/dynatrace/gen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto-generated files

The directory `/gen/` contains auto-generated files that are added to the `.gitignore`:
202 changes: 202 additions & 0 deletions deploy/manifests/dynatrace/oneagent-operator-openshift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: dynatrace-oneagent-operator
namespace: dynatrace
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: dynatrace-oneagent
namespace: dynatrace
---
apiVersion: v1
kind: SecurityContextConstraints
metadata:
annotations:
kubernetes.io/description: 'dynatrace-oneagent-privileged allows access to all privileged and host features and the ability to run as any user, any group, any fsGroup, and with any SELinux context. This is a copy of privileged scc.'
name: dynatrace-oneagent-privileged
allowHostDirVolumePlugin: true
allowHostIPC: true
allowHostNetwork: true
allowHostPID: true
allowHostPorts: true
allowPrivilegedContainer: true
allowedCapabilities:
- '*'
allowedFlexVolumes: null
defaultAddCapabilities: null
fsGroup:
type: RunAsAny
priority: null
readOnlyRootFilesystem: false
requiredDropCapabilities: null
runAsUser:
type: RunAsAny
seLinuxContext:
type: RunAsAny
seccompProfiles:
- '*'
supplementalGroups:
type: RunAsAny
users:
- system:serviceaccount:dynatrace:dynatrace-oneagent
volumes:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: dynatrace-oneagent-operator
namespace: dynatrace
labels:
dynatrace: operator
operator: oneagent
rules:
- apiGroups:
- dynatrace.com
resources:
- oneagents
verbs:
- get
- list
- watch
- update
- apiGroups:
- apps
resources:
- daemonsets
verbs:
- get
- list
- watch
- create
- update
- delete
- apiGroups:
- "" # "" indicates the core API group
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- delete
- apiGroups:
- "" # "" indicates the core API group
resources:
- pods
verbs:
- get
- list
- watch
- delete
- apiGroups:
- "" # "" indicates the core API group
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- get
- create
- apiGroups:
- dynatrace.com
resources:
- oneagents/finalizers
- oneagents/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: dynatrace-oneagent-operator
namespace: dynatrace
labels:
dynatrace: operator
operator: oneagent
subjects:
- kind: ServiceAccount
name: dynatrace-oneagent-operator
roleRef:
kind: Role
name: dynatrace-oneagent-operator
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: oneagents.dynatrace.com
spec:
group: dynatrace.com
names:
kind: OneAgent
listKind: OneAgentList
plural: oneagents
singular: oneagent
scope: Namespaced
version: v1alpha1
subresources:
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dynatrace-oneagent-operator
namespace: dynatrace
labels:
dynatrace: operator
operator: oneagent
spec:
replicas: 1
revisionHistoryLimit: 1
selector:
matchLabels:
name: dynatrace-oneagent-operator
strategy:
type: Recreate
template:
metadata:
labels:
name: dynatrace-oneagent-operator
dynatrace: operator
operator: oneagent
spec:
containers:
- name: dynatrace-oneagent-operator
image: quay.io/dynatrace/dynatrace-oneagent-operator:v0.3.1
command:
- dynatrace-oneagent-operator
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: 60000
name: metrics
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
cpu: 100m
memory: 256Mi
nodeSelector:
beta.kubernetes.io/os: linux
beta.kubernetes.io/arch: amd64
serviceAccountName: dynatrace-oneagent-operator
Loading

0 comments on commit b6ccdd3

Please sign in to comment.