Skip to content

Commit 5dfb0b0

Browse files
Merge pull request #25 from kube-logging/readme
Add readme with example deployment
2 parents 9d52956 + fded74b commit 5dfb0b0

File tree

12 files changed

+302
-33
lines changed

12 files changed

+302
-33
lines changed

.github/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
2+
changelog:
3+
exclude:
4+
labels:
5+
- ignore-for-release-note
6+
categories:
7+
- title: Breaking Changes
8+
labels:
9+
- breaking-change
10+
- title: New Features
11+
labels:
12+
- feature
13+
- title: Enhancements
14+
labels:
15+
- enhancement
16+
- title: Dependency and image updates
17+
labels:
18+
- dependencies
19+
- title: Bug fixes
20+
labels:
21+
- bugfix
22+
- title: Documentation
23+
labels:
24+
- documentation
25+
- title: Testing
26+
labels:
27+
- testing
28+
- title: Other Changes
29+
labels:
30+
- "*"

.github/workflows/release.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["[0-9]+.[0-9]+.[0-9]+*"]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
artifacts:
12+
name: Artifacts
13+
uses: ./.github/workflows/artifacts.yaml
14+
with:
15+
publish: true
16+
release: true
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
security-events: write

README.md

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# telemetry-controller
2-
// TODO(user): Add simple overview of use/purpose
3-
2+
The Telemetry Controller is a multi-tenancy focused solution, that facilitates collection of telemetry data from Kubernetes workloads, without any need for changes to the running software.
43
## Description
5-
// TODO(user): An in-depth paragraph about your project and overview of use
6-
4+
Telemetry-controller can be configured using Custom Resources to set up an opinionated Opentelemetry Collector configuration to route log messages based on rules defined as a Tenant -> Subscription relation map.
75
## Getting Started
86

97
### Prerequisites
@@ -13,51 +11,72 @@
1311
- Access to a Kubernetes v1.11.3+ cluster.
1412

1513
### To Deploy on the cluster
16-
**Build and push your image to the location specified by `IMG`:**
1714

15+
**Install cert-manager, and opentelemtry-operator:**
1816
```sh
19-
make docker-build docker-push IMG=<some-registry>/telemetry-controller:tag
20-
```
17+
helm upgrade --install --repo https://charts.jetstack.io cert-manager cert-manager --namespace cert-manager --create-namespace --version v1.13.3 --set installCRDs=true --wait
2118

22-
**NOTE:** This image ought to be published in the personal registry you specified.
23-
And it is required to have access to pull the image from the working environment.
24-
Make sure you have the proper permission to the registry if the above commands don’t work.
19+
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml --wait
20+
```
2521

2622
**Install the CRDs into the cluster:**
2723

2824
```sh
2925
make install
3026
```
3127

28+
**Build your image and load it to your KinD nodes**
29+
```sh
30+
make docker-build IMG=telemetry-controller:latest
31+
kind load docker-image telemetry-controller:latest
32+
```
33+
3234
**Deploy the Manager to the cluster with the image specified by `IMG`:**
3335

3436
```sh
35-
make deploy IMG=<some-registry>/telemetry-controller:tag
37+
make deploy IMG=telemetry-controller:tag
3638
```
3739

3840
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
3941
privileges or be logged in as admin.
4042

4143
**Create instances of your solution**
42-
You can apply the samples (examples) from the config/sample:
44+
You can deploy the example configuration provided as part of the docs. This will deploy a demo pipeline with one tenant, two subscriptions, and an OpenObserve instance.
45+
Deploying Openobserve is an optional, but recommended step, logs can be forwarded to any OTLP endpoint. Openobserve provides a UI to visualize the ingested logstream.
4346

4447
```sh
45-
kubectl apply -k config/samples/
48+
# Deploy Openobserve
49+
kubectl apply -f docs/examples/simple-demo/openobserve.yaml
50+
51+
# Set up portforwarding for Openobserve UI
52+
kubectl -n openobserve port-forward svc/openobserve 5080:5080 &
4653
```
4754

48-
>**NOTE**: Ensure that the samples has default values to test it out.
55+
Open the UI at `localhost:5080`, navigate to the `Ingestion/OTEL Collector` tab, and copy the authorization token as seen on the screenshot.
56+
![Openobserve auth](docs/assets/openobserve-auth.png)
4957

50-
### To Uninstall
51-
**Delete the instances (CRs) from the cluster:**
58+
Paste this token to the example manifests:
59+
```sh
60+
sed -i '' -e "s/\<TOKEN\>/INSERT YOUR COPIED TOKEN HERE/" docs/examples/simple-demo/one_tenant_two_subscriptions.yaml
61+
```
62+
```sh
63+
# Deploy the pipeline definition
64+
kubectl apply -f docs/examples/simple-demo/one_tenant_two_subscriptions.yaml
65+
```
5266

67+
**Create a workload, which will generate logs for the pipeline:**
5368
```sh
54-
kubectl delete -k config/samples/
69+
helm install --wait --create-namespace --namespace example-tenant-ns --generate-name oci://ghcr.io/kube-logging/helm-charts/log-generator
5570
```
5671

57-
**Delete the APIs(CRDs) from the cluster:**
72+
**Open the Openobserve UI and inspect the generated log messages**
73+
![Openobserve logs](docs/assets/openobserve-logs.png)
74+
75+
### To Uninstall
76+
**Delete the instances (CRs) from the cluster:**
5877

5978
```sh
60-
make uninstall
79+
kubectl delete -f docs/examples/simple-demo/
6180
```
6281

6382
**UnDeploy the controller from the cluster:**
@@ -66,16 +85,27 @@ make uninstall
6685
make undeploy
6786
```
6887

88+
**Delete the APIs(CRDs) from the cluster:**
89+
90+
```sh
91+
make uninstall
92+
```
93+
6994
## Contributing
70-
// TODO(user): Add detailed information on how you would like others to contribute to this project
7195

72-
**NOTE:** Run `make --help` for more information on all potential `make` targets
96+
If you find this project useful, help us:
97+
98+
- Support the development of this project and star this repo! :star:
99+
- Help new users with issues they may encounter :muscle:
100+
- Send a pull request with your new features and bug fixes :rocket:
101+
102+
Please read the [Organisation's Code of Conduct](https://github.com/kube-logging/.github/blob/main/CODE_OF_CONDUCT.md)!
73103

74-
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)
104+
*For more information, read our organization's [contribution guidelines](https://github.com/kube-logging/.github/blob/main/CONTRIBUTING.md)*.
75105

76106
## License
77107

78-
Copyright © 2023 Kube logging authors
108+
Copyright © 2024 Kube logging authors
79109

80110
Licensed under the Apache License, Version 2.0 (the "License");
81111
you may not use this file except in compliance with the License.

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: controller
7+
newName: ghcr.io/kube-logging/telemetry-controller
88
newTag: latest

docs/assets/openobserve-auth.png

262 KB
Loading

docs/assets/openobserve-logs.png

734 KB
Loading

docs/demos/openobserve/start.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ set -euo pipefail
55
KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-kind}
66

77
# Install OpenObserve
8-
kubectl create namespace openobserve
9-
108
kubectl apply -f - <<EOF
119
apiVersion: v1
10+
kind: Namespace
11+
metadata:
12+
name: openobserve
13+
---
14+
apiVersion: v1
1215
kind: Service
1316
metadata:
1417
name: openobserve

docs/examples/simple-demo/one_tenant_two_subscriptions.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ metadata:
4040
name: subscription-sample-1
4141
namespace: example-tenant-ns
4242
spec:
43-
ottl: 'route()'
43+
ottl: "route()"
4444
outputs:
45-
- name: otlp-test-output
45+
- name: otlp-test-output-1
4646
namespace: collector
4747
---
4848
apiVersion: telemetry.kube-logging.dev/v1alpha1
@@ -51,19 +51,23 @@ metadata:
5151
name: subscription-sample-2
5252
namespace: example-tenant-ns
5353
spec:
54-
ottl: 'route()'
54+
ottl: "route()"
5555
outputs:
5656
- name: otlp-test-output-2
5757
namespace: collector
5858
---
5959
apiVersion: telemetry.kube-logging.dev/v1alpha1
6060
kind: OtelOutput
6161
metadata:
62-
name: otlp-test-output
62+
name: otlp-test-output-1
6363
namespace: collector
6464
spec:
6565
otlp:
66-
endpoint: receiver-collector.example-tenant-ns.svc.cluster.local:4317
66+
endpoint: openobserve-otlp-grpc.openobserve.svc.cluster.local:5081
67+
headers:
68+
Authorization: "Basic <TOKEN>"
69+
organization: default
70+
stream-name: default
6771
tls:
6872
insecure: true
6973
---
@@ -74,6 +78,10 @@ metadata:
7478
namespace: collector
7579
spec:
7680
otlp:
77-
endpoint: receiver-collector.example-tenant-ns.svc.cluster.local:4317
81+
endpoint: openobserve-otlp-grpc.openobserve.svc.cluster.local:5081
82+
headers:
83+
Authorization: "Basic <TOKEN>"
84+
organization: default
85+
stream-name: default
7886
tls:
7987
insecure: true
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: openobserve
5+
---
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: openobserve
10+
namespace: openobserve
11+
spec:
12+
clusterIP: None
13+
selector:
14+
app: openobserve
15+
ports:
16+
- name: http
17+
port: 5080
18+
targetPort: 5080
19+
---
20+
apiVersion: v1
21+
kind: Service
22+
metadata:
23+
name: openobserve-otlp-grpc
24+
namespace: openobserve
25+
spec:
26+
clusterIP: None
27+
selector:
28+
app: openobserve
29+
ports:
30+
- name: otlp-grpc
31+
port: 5081
32+
targetPort: 5081
33+
---
34+
# create statefulset
35+
apiVersion: apps/v1
36+
kind: StatefulSet
37+
metadata:
38+
name: openobserve
39+
namespace: openobserve
40+
labels:
41+
name: openobserve
42+
spec:
43+
serviceName: openobserve
44+
replicas: 1
45+
selector:
46+
matchLabels:
47+
name: openobserve
48+
app: openobserve
49+
template:
50+
metadata:
51+
labels:
52+
name: openobserve
53+
app: openobserve
54+
spec:
55+
securityContext:
56+
fsGroup: 2000
57+
runAsUser: 10000
58+
runAsGroup: 3000
59+
runAsNonRoot: true
60+
# terminationGracePeriodSeconds: 0
61+
containers:
62+
- name: openobserve
63+
image: public.ecr.aws/zinclabs/openobserve:v0.7.2
64+
env:
65+
- name: ZO_ROOT_USER_EMAIL
66+
value: root@example.com
67+
- name: ZO_ROOT_USER_PASSWORD
68+
value: Complexpass#123
69+
- name: ZO_DATA_DIR
70+
value: /data
71+
# command: ["/bin/bash", "-c", "while true; do sleep 1; done"]
72+
imagePullPolicy: Always
73+
resources:
74+
limits:
75+
cpu: 4096m
76+
memory: 2048Mi
77+
requests:
78+
cpu: 256m
79+
memory: 50Mi
80+
ports:
81+
- containerPort: 5080
82+
name: http
83+
- containerPort: 50801
84+
name: otlp-grpc
85+
volumeMounts:
86+
- name: data
87+
mountPath: /data
88+
volumeClaimTemplates:
89+
- metadata:
90+
name: data
91+
spec:
92+
accessModes:
93+
- ReadWriteOnce
94+
# storageClassName: default
95+
# NOTE: You can increase the storage size
96+
resources:
97+
requests:
98+
storage: 10Gi

e2e/e2e_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ kubectl wait --namespace opentelemetry-operator-system --for=condition=available
3838
(cd .. && make manifests generate install)
3939

4040
# Use example
41-
kubectl apply -f ../docs/examples/simple-demo
41+
kubectl apply -f ../e2e/testdata/one_tenant_two_subscriptions
4242

4343
if [[ -z "${CI_MODE}" ]]; then
4444
$(cd .. && timeout 5m make run &)

0 commit comments

Comments
 (0)