From 8871e680015bee8930308085c0318e6745fba330 Mon Sep 17 00:00:00 2001 From: Peter Wilcsinszky Date: Mon, 25 Nov 2024 16:22:10 +0100 Subject: [PATCH] samples: keep the simple tc version and fix the source selector to be dynamic Signed-off-by: Peter Wilcsinszky --- .../multitenant-routing-tc/logging/README.md | 10 --- .../logging/tenant-a-logging.yaml | 57 ------------- .../logging/tenant-b-logging.yaml | 51 ------------ .../logging/tenant-infra-logging.yaml | 79 ------------------- .../logging/tenant-infra-receiver.yaml | 38 --------- .../tc-simple/tenant-infra.yaml | 4 +- 6 files changed, 2 insertions(+), 237 deletions(-) delete mode 100644 config/samples/multitenant-routing-tc/logging/README.md delete mode 100644 config/samples/multitenant-routing-tc/logging/tenant-a-logging.yaml delete mode 100644 config/samples/multitenant-routing-tc/logging/tenant-b-logging.yaml delete mode 100644 config/samples/multitenant-routing-tc/logging/tenant-infra-logging.yaml delete mode 100644 config/samples/multitenant-routing-tc/logging/tenant-infra-receiver.yaml diff --git a/config/samples/multitenant-routing-tc/logging/README.md b/config/samples/multitenant-routing-tc/logging/README.md deleted file mode 100644 index 76931bb39..000000000 --- a/config/samples/multitenant-routing-tc/logging/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Logging Operator multi-tenant routing - -```bash -make generate install -kubectl apply -f config/samples/multitenant-routing-tc/logging -helm upgrade --install --namespace customer-a log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator -helm upgrade --install --namespace customer-b log-generator oci://ghcr.io/kube-logging/helm-charts/log-generator -# in a separate shell -make run -``` diff --git a/config/samples/multitenant-routing-tc/logging/tenant-a-logging.yaml b/config/samples/multitenant-routing-tc/logging/tenant-a-logging.yaml deleted file mode 100644 index 34420cf21..000000000 --- a/config/samples/multitenant-routing-tc/logging/tenant-a-logging.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: customer-a - labels: - tenant: customer-a ---- -apiVersion: v1 -kind: Namespace -metadata: - name: customer-a-infra ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Logging -metadata: - name: customer-a - labels: - tenant: customer-a -spec: - controlNamespace: customer-a-infra - watchNamespaceSelector: - matchLabels: - tenant: customer-a ---- -kind: FluentdConfig -apiVersion: logging.banzaicloud.io/v1beta1 -metadata: - name: customer-a - namespace: customer-a-infra -spec: {} ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Output -metadata: - name: http - namespace: customer-a -spec: - http: - endpoint: http://test-receiver.infra:8080/customer-a - content_type: application/json - buffer: - type: memory - timekey: 1s - timekey_wait: 0s ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Flow -metadata: - name: log-generator - namespace: customer-a -spec: - match: - - select: - labels: - app.kubernetes.io/name: log-generator - localOutputRefs: - - http diff --git a/config/samples/multitenant-routing-tc/logging/tenant-b-logging.yaml b/config/samples/multitenant-routing-tc/logging/tenant-b-logging.yaml deleted file mode 100644 index c7b6697fe..000000000 --- a/config/samples/multitenant-routing-tc/logging/tenant-b-logging.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: customer-b - labels: - tenant: customer-b ---- -apiVersion: v1 -kind: Namespace -metadata: - name: customer-b-infra ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Logging -metadata: - name: customer-b - labels: - tenant: customer-b -spec: - fluentd: {} - controlNamespace: customer-b-infra - watchNamespaceSelector: - matchLabels: - tenant: customer-b ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Output -metadata: - name: http - namespace: customer-b -spec: - http: - endpoint: http://test-receiver.infra:8080/customer-b - content_type: application/json - buffer: - type: memory - timekey: 1s - timekey_wait: 0s ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Flow -metadata: - name: log-generator - namespace: customer-b -spec: - match: - - select: - labels: - app.kubernetes.io/name: log-generator - localOutputRefs: - - http diff --git a/config/samples/multitenant-routing-tc/logging/tenant-infra-logging.yaml b/config/samples/multitenant-routing-tc/logging/tenant-infra-logging.yaml deleted file mode 100644 index ad1dfc191..000000000 --- a/config/samples/multitenant-routing-tc/logging/tenant-infra-logging.yaml +++ /dev/null @@ -1,79 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: infra ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: Logging -metadata: - name: infra - labels: - tenant: infra -spec: - loggingRef: infra - fluentd: {} - controlNamespace: infra ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: ClusterFlow -metadata: - name: all - namespace: infra -spec: - loggingRef: infra - match: - - select: - labels: - app.kubernetes.io/name: log-generator - globalOutputRefs: - - http ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: ClusterOutput -metadata: - name: http - namespace: infra -spec: - loggingRef: infra - http: - endpoint: http://test-receiver.infra:8080/infra - content_type: application/json - buffer: - type: memory - timekey: 1s - timekey_wait: 0s ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: FluentbitAgent -metadata: - name: infra -spec: - loggingRef: infra - inputTail: - storage.type: filesystem - positiondb: - hostPath: - path: "" - bufferStorageVolume: - hostPath: - path: "" - network: - connectTimeout: 2 - metrics: {} - image: - tag: 3.1.8-debug ---- -apiVersion: logging.banzaicloud.io/v1beta1 -kind: LoggingRoute -metadata: - name: tenants -spec: - source: infra - targets: - matchExpressions: - - key: tenant - operator: Exists - - key: tenant - operator: NotIn - values: - - customer-a diff --git a/config/samples/multitenant-routing-tc/logging/tenant-infra-receiver.yaml b/config/samples/multitenant-routing-tc/logging/tenant-infra-receiver.yaml deleted file mode 100644 index 3fbf7bedc..000000000 --- a/config/samples/multitenant-routing-tc/logging/tenant-infra-receiver.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: test-receiver - namespace: infra -spec: - type: ClusterIP - ports: - - port: 8080 - targetPort: receiver - protocol: TCP - name: receiver - selector: - app.kubernetes.io/name: test-receiver ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: test-receiver - namespace: infra -spec: - selector: - matchLabels: - app.kubernetes.io/name: test-receiver - template: - metadata: - labels: - app.kubernetes.io/name: test-receiver - annotations: - fluentbit.io/exclude: "true" - spec: - containers: - - name: fluentbit - image: fluent/fluent-bit - args: ["-i", "http", "-p", "port=8080", "-o", "stdout"] - ports: - - name: receiver - containerPort: 8080 diff --git a/config/samples/multitenant-routing-tc/tc-simple/tenant-infra.yaml b/config/samples/multitenant-routing-tc/tc-simple/tenant-infra.yaml index f67fb6883..75b26bdf1 100644 --- a/config/samples/multitenant-routing-tc/tc-simple/tenant-infra.yaml +++ b/config/samples/multitenant-routing-tc/tc-simple/tenant-infra.yaml @@ -13,8 +13,8 @@ metadata: collector: cluster spec: logSourceNamespaceSelectors: - - matchExpression: - key: tenant + - matchExpressions: + - key: tenant operator: Exists subscriptionNamespaceSelectors: - matchLabels: