diff --git a/Examples/Readme.md b/Examples/Readme.md index 62a1a3d8..bde89915 100644 --- a/Examples/Readme.md +++ b/Examples/Readme.md @@ -5,4 +5,5 @@ You may need to set the prometheus source manually. By default the Prometheus ad | Example | Description| |-----|-------------| |run-with-docker| This example includes a basic example pipeline using **CortexBrain Identity** and **Metrics** components. Metrics are scraped by Prometheus and visualized using a custom Grafana dashboard| -|run-with-docker-gpu| This example includes a basic example pipeline using **CortexBrain Identity** and **Metrics** components. GPU data are provided by the **NVIDIA-DCGM** exporter. Metrics are scraped by Prometheus and visualized using a custom Grafana dashboard| \ No newline at end of file +|run-with-docker-gpu| This example includes a basic example pipeline using **CortexBrain Identity** and **Metrics** components. GPU data are provided by the **NVIDIA-DCGM** exporter. Metrics are scraped by Prometheus and visualized using a custom Grafana dashboard| +|minikube| This example includes a basic minikube setup to test CortexBrain components using **Minikube**. Includes **CortexBrain Identity** and **CortexBrain Metrics** components setup, basic RBAC setup and a simple chaos injection setup using **Chaos Mesh**. As the other examples metrics are scraped by Prometheus and visualized using Grafana| \ No newline at end of file diff --git a/core/src/testing/agent.yaml b/Examples/minikube/agent.yaml similarity index 100% rename from core/src/testing/agent.yaml rename to Examples/minikube/agent.yaml diff --git a/core/src/testing/chaos-mess.yaml b/Examples/minikube/chaos-injection/chaos-mesh.yaml similarity index 100% rename from core/src/testing/chaos-mess.yaml rename to Examples/minikube/chaos-injection/chaos-mesh.yaml diff --git a/core/src/testing/configmap-role.yaml b/Examples/minikube/configmap-role.yaml similarity index 100% rename from core/src/testing/configmap-role.yaml rename to Examples/minikube/configmap-role.yaml diff --git a/core/src/testing/cortexflow-rolebinding.yaml b/Examples/minikube/cortexflow-rolebinding.yaml similarity index 100% rename from core/src/testing/cortexflow-rolebinding.yaml rename to Examples/minikube/cortexflow-rolebinding.yaml diff --git a/core/src/testing/grafana.yaml b/Examples/minikube/grafana.yaml similarity index 100% rename from core/src/testing/grafana.yaml rename to Examples/minikube/grafana.yaml diff --git a/core/src/testing/identity.yaml b/Examples/minikube/identity.yaml similarity index 55% rename from core/src/testing/identity.yaml rename to Examples/minikube/identity.yaml index 43e6c928..a78d60fc 100644 --- a/core/src/testing/identity.yaml +++ b/Examples/minikube/identity.yaml @@ -17,42 +17,9 @@ spec: spec: hostPID: true hostNetwork: true - initContainers: - - name: bpf-map-permissions - image: ubuntu:24.04 - command: ["/bin/bash","-c"] - args: - - | - echo "mounting the bpf path " - mount -t bpf bpf /sys/fs/bpf - - echo "checking permissions" - ls -ld /sys/fs/bpf - volumeMounts: - - name: bpf - mountPath: /sys/fs/bpf - mountPropagation: Bidirectional - readOnly: false - - name: kernel-dev - mountPath: /lib/modules - readOnly: false - - name: cgroup - mountPath: /sys/fs/cgroup - readOnly: true - securityContext: - runAsUser: 0 - privileged: true - allowPrivilegeEscalation: true - capabilities: - add: - - SYS_ADMIN - - NET_ADMIN - - SYS_RESOURCE - - BPF - - SYS_PTRACE containers: - name: identity - image: ghcr.io/cortexflow/identity:latest + image: lorenzotettamanti/cortexflow-identity:lru-update2 command: ["/bin/bash", "-c"] args: - | @@ -107,37 +74,6 @@ spec: - SYS_RESOURCE - BPF - SYS_PTRACE - - name: bpftool-control-manager - image: danielpacak/bpftool-runner:latest - command: ["/bin/bash", "-c","sleep infinity"] - volumeMounts: - - name: bpf - mountPath: /sys/fs/bpf - mountPropagation: Bidirectional - readOnly: false - - name: kernel-dev - mountPath: /lib/modules - readOnly: false - - name: cgroup - mountPath: /sys/fs/cgroup - readOnly: true - resources: - limits: - cpu: "1" - memory: "200Mi" - requests: - cpu: "1" - memory: "100Mi" - securityContext: - privileged: true - allowPrivilegeEscalation: true - capabilities: - add: - - SYS_ADMIN - - NET_ADMIN - - SYS_RESOURCE - - BPF - - SYS_PTRACE volumes: - name: bpf hostPath: diff --git a/core/src/testing/metrics.yaml b/Examples/minikube/metrics.yaml similarity index 100% rename from core/src/testing/metrics.yaml rename to Examples/minikube/metrics.yaml diff --git a/core/src/testing/otel_agent.yaml b/Examples/minikube/otel_agent.yaml similarity index 100% rename from core/src/testing/otel_agent.yaml rename to Examples/minikube/otel_agent.yaml diff --git a/core/src/testing/prometheus.yaml b/Examples/minikube/prometheus.yaml similarity index 96% rename from core/src/testing/prometheus.yaml rename to Examples/minikube/prometheus.yaml index 1a1e10cd..2ba8ba55 100644 --- a/core/src/testing/prometheus.yaml +++ b/Examples/minikube/prometheus.yaml @@ -56,6 +56,7 @@ spec: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus" - "--web.enable-lifecycle" + - "--web.enable-admin-api" # useful to delete series from the tsdb ports: - containerPort: 9090 name: web diff --git a/core/src/testing/rolebinding.yaml b/Examples/minikube/rolebinding.yaml similarity index 100% rename from core/src/testing/rolebinding.yaml rename to Examples/minikube/rolebinding.yaml diff --git a/Examples/run-with-docker-gpu/docker-compose.yaml b/Examples/run-with-docker-gpu/docker-compose.yaml index 307603e0..8f4dbb16 100644 --- a/Examples/run-with-docker-gpu/docker-compose.yaml +++ b/Examples/run-with-docker-gpu/docker-compose.yaml @@ -70,7 +70,6 @@ services: - GOMEMLIMIT=1600MiB volumes: - ./otel-collector-config.yaml:/conf/otel-collector-config.yaml:ro - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow depends_on: @@ -111,7 +110,6 @@ services: volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - prometheus-data:/prometheus - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow healthcheck: @@ -140,7 +138,6 @@ services: - ./grafana/provisioning:/etc/grafana/provisioning:ro - ./grafana/dashboards:/var/lib/grafana/dashboards:ro - grafana-data:/var/lib/grafana - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow restart: on-failure diff --git a/Examples/run-with-docker/docker-compose.yaml b/Examples/run-with-docker/docker-compose.yaml index 1a98ca7a..0b4ea770 100644 --- a/Examples/run-with-docker/docker-compose.yaml +++ b/Examples/run-with-docker/docker-compose.yaml @@ -70,7 +70,6 @@ services: - GOMEMLIMIT=1600MiB volumes: - ./otel-collector-config.yaml:/conf/otel-collector-config.yaml:ro - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow depends_on: @@ -90,7 +89,6 @@ services: volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - prometheus-data:/prometheus - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow healthcheck: @@ -125,7 +123,6 @@ services: - ./grafana/provisioning:/etc/grafana/provisioning:ro - ./grafana/dashboards:/var/lib/grafana/dashboards:ro - grafana-data:/var/lib/grafana - - /var/run/docker.sock:/var/run/docker.sock networks: - cortexflow restart: on-failure diff --git a/core/src/testing/deploy-test-pod.yaml b/core/src/testing/deploy-test-pod.yaml deleted file mode 100644 index 1f2062e6..00000000 --- a/core/src/testing/deploy-test-pod.yaml +++ /dev/null @@ -1,148 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: testing-service-account - namespace: cortexflow ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: service-discovery-role - namespace: cortexflow -rules: -- apiGroups: [ "" ] - resources: [ "services", "pods" ] - verbs: [ "get", "list", "watch" ] -- apiGroups: [ "" ] - resources: [ "configmaps" ] - verbs: [ "get", "list", "watch" ] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: service-discovery-role-binding - namespace: cortexflow -subjects: -- kind: ServiceAccount - name: testing-service-account - namespace: cortexflow -roleRef: - kind: Role - name: service-discovery-role - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: v1 -kind: Pod -metadata: - name: test-pod - namespace: cortexflow - labels: - app: test1 -spec: - serviceAccountName: testing-service-account - containers: - - name: test-pod - image: nicolaka/netshoot - command: ["/bin/bash", "-c", "sleep 3600"] - ports: - - containerPort: 5053 - protocol: UDP - - containerPort: 5054 - protocol: TCP ---- -apiVersion: v1 -kind: Pod -metadata: - name: test-pod2 - namespace: cortexflow - labels: - app: test2 -spec: - serviceAccountName: testing-service-account - containers: - - name: test-pod2 - image: nicolaka/netshoot - command: ["/bin/bash", "-c", "sleep 3600"] - ports: - - containerPort: 5053 - protocol: UDP - - containerPort: 5054 - protocol: TCP ---- -apiVersion: v1 -kind: Pod -metadata: - name: test-pod3 - namespace: cortexflow - labels: - app: test3 -spec: - hostNetwork: true - hostPID: true - serviceAccountName: testing-service-account - containers: - - name: test-pod3 - image: nicolaka/netshoot - command: ["/bin/bash", "-c", "sleep 3600"] - ports: - - containerPort: 5053 - protocol: UDP - - containerPort: 5054 - protocol: TCP ---- -apiVersion: v1 -kind: Service -metadata: - name: test-pod - namespace: cortexflow -spec: - selector: - app: test1 - ports: - - protocol: TCP - name: tcp-connection - port: 5054 - targetPort: 5054 - - protocol: UDP - name: udp-connection - port: 5053 - targetPort: 5053 - type: ClusterIP ---- -apiVersion: v1 -kind: Service -metadata: - name: test-pod2 - namespace: cortexflow -spec: - selector: - app: test2 - ports: - - protocol: TCP - name: tcp-connection - port: 5054 - targetPort: 5054 - - protocol: UDP - name: udp-connection - port: 5053 - targetPort: 5053 - type: ClusterIP ---- -apiVersion: v1 -kind: Service -metadata: - name: test-pod3 - namespace: cortexflow -spec: - selector: - app: test3 - ports: - - protocol: TCP - name: tcp-connection - port: 5054 - targetPort: 5054 - - protocol: UDP - name: udp-connection - port: 5053 - targetPort: 5053 - type: ClusterIP