-
Notifications
You must be signed in to change notification settings - Fork 25
mbp-1128: Add Network Observability with NooBaa-backed Loki #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sabre1041
merged 13 commits into
validatedpatterns:main
from
pmatouse:mbp-1128-network-observability
Aug 13, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1ebb7bc
feat: add Network Observability with NooBaa-backed Loki
pmatouse ffee937
fix(netobserv): resolve LokiStack storageClassName for Helm and Argo
pmatouse da21ff8
fix(netobserv): harden OBC credentials Job error handling
pmatouse 4d0a141
docs: comment netobserv enablement in values-hub
pmatouse b46e35c
feat(netobserv): add NetworkPolicies for LokiStack namespace
pmatouse b349833
docs(netobserv): add storageClassName override examples
pmatouse b56eb16
fix(netobserv): unpin Loki operator channel
pmatouse 66d5c8c
fix(netobserv): drop redundant Job securityContext fields
pmatouse 0323cd0
fix(netobserv): pin LokiStack NetworkPolicy ingress ports
pmatouse bd3136b
fix(netobserv): require explicit loki.storageClassName
pmatouse 44a2e8f
fix(netobserv): omit FlowCollector privileged when false
pmatouse c31ca39
fix(netobserv): ignore FlowCollector operator-managed fields
pmatouse c131741
docs(netobserv): list NetworkPolicies in sync-wave inventory
pmatouse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,4 @@ __pycache__/ | |
| .cursorrules | ||
| .cursor/ | ||
| .vscode/ | ||
| .venv/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| apiVersion: v2 | ||
| name: netobserv | ||
| description: OpenShift Network Observability (NooBaa-backed LokiStack + FlowCollector) for ZTVP | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "1.12" | ||
| keywords: | ||
| - network-observability | ||
| - zero-trust | ||
| maintainers: | ||
| - name: Validated Patterns Team | ||
| home: https://validatedpatterns.io/patterns/layered-zero-trust/ | ||
| sources: | ||
| - https://github.com/validatedpatterns/layered-zero-trust |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| {{- define "netobserv.name" -}} | ||
| netobserv | ||
| {{- end }} | ||
|
|
||
| {{- define "netobserv.labels" -}} | ||
| app.kubernetes.io/name: {{ include "netobserv.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Resolve LokiStack storageClassName (required by the LokiStack CRD). | ||
|
|
||
| Use .Values.loki.storageClassName when set; otherwise fail. No Helm lookup — | ||
| Argo CD does not support it. Set explicitly via chart values, --set, or an | ||
| Argo CD / clusterGroup helm parameter override (see values.yaml comments and | ||
| scripts/features/netobserv.yaml). Discover classes with: oc get storageclass | ||
| */}} | ||
| {{- define "netobserv.lokiStorageClassName" -}} | ||
| {{- $sc := .Values.loki.storageClassName | default "" -}} | ||
| {{- if $sc -}} | ||
| {{- $sc -}} | ||
| {{- else -}} | ||
| {{- fail "loki.storageClassName is required (LokiStack CRD). Set it in chart values (loki.storageClassName), via --set, or as an Argo CD / clusterGroup helm parameter override. See charts/netobserv/values.yaml. Discover classes: oc get storageclass" -}} | ||
| {{- end -}} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| {{- if .Values.enabled }} | ||
| apiVersion: flows.netobserv.io/v1beta2 | ||
| kind: FlowCollector | ||
| metadata: | ||
| name: {{ .Values.flowcollector.name }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "42" | ||
| argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
| spec: | ||
| namespace: {{ .Values.flowcollector.namespace }} | ||
| deploymentModel: {{ .Values.flowcollector.deploymentModel }} | ||
| agent: | ||
| type: {{ .Values.flowcollector.agent.type }} | ||
| ebpf: | ||
| sampling: {{ .Values.flowcollector.agent.sampling }} | ||
| {{- if eq (.Values.flowcollector.agent.privileged | toString) "true" }} | ||
| privileged: true | ||
| {{- end }} | ||
| loki: | ||
| enable: {{ .Values.flowcollector.loki.enable }} | ||
| mode: {{ .Values.flowcollector.loki.mode }} | ||
| lokiStack: | ||
| name: {{ .Values.loki.name }} | ||
| namespace: {{ .Values.loki.namespace }} | ||
| consolePlugin: | ||
| enable: {{ .Values.flowcollector.consolePlugin.enable }} | ||
| {{- if eq (.Values.networkPolicy.enabled | toString) "true" }} | ||
| # Operator-managed NPs for netobserv + netobserv-privileged (not LokiStack ns). | ||
| networkPolicy: | ||
| enable: true | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
161 changes: 161 additions & 0 deletions
161
charts/netobserv/templates/loki-s3-credentials-job.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| {{- if and .Values.enabled .Values.loki.enabled }} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: netobserv-loki-s3-setup | ||
| namespace: {{ .Values.loki.namespace }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "37" | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: netobserv-loki-s3-setup | ||
| namespace: {{ .Values.loki.namespace }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "37" | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["get", "list", "create", "update", "patch"] | ||
| - apiGroups: [""] | ||
| resources: ["configmaps"] | ||
| verbs: ["get", "list"] | ||
| - apiGroups: ["objectbucket.io"] | ||
| resources: ["objectbucketclaims"] | ||
| verbs: ["get", "list", "watch"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: netobserv-loki-s3-setup | ||
| namespace: {{ .Values.loki.namespace }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "37" | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: netobserv-loki-s3-setup | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: netobserv-loki-s3-setup | ||
| namespace: {{ .Values.loki.namespace }} | ||
| --- | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: netobserv-loki-s3-credentials | ||
| namespace: {{ .Values.loki.namespace }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "39" | ||
| argocd.argoproj.io/hook: Sync | ||
| argocd.argoproj.io/hook-delete-policy: BeforeHookCreation | ||
| spec: | ||
| ttlSecondsAfterFinished: 600 | ||
| backoffLimit: {{ .Values.credentialsJob.backoffLimit }} | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 8 }} | ||
| spec: | ||
| serviceAccountName: netobserv-loki-s3-setup | ||
| automountServiceAccountToken: true | ||
| restartPolicy: OnFailure | ||
| securityContext: | ||
| runAsNonRoot: true | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| containers: | ||
| - name: remap-obc-secret | ||
| image: {{ .Values.credentialsJob.image }} | ||
| imagePullPolicy: IfNotPresent | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| readOnlyRootFilesystem: true | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| resources: | ||
| {{- toYaml .Values.credentialsJob.resources | nindent 12 }} | ||
| volumeMounts: | ||
| - name: tmp | ||
| mountPath: /tmp | ||
| env: | ||
| - name: NS | ||
| value: {{ .Values.loki.namespace | quote }} | ||
| - name: OBC_NAME | ||
| value: {{ .Values.loki.objectBucketClaim.name | quote }} | ||
| - name: LOKI_SECRET | ||
| value: {{ .Values.loki.storageSecretName | quote }} | ||
| - name: REGION | ||
| value: {{ .Values.loki.region | quote }} | ||
| command: | ||
| - /bin/bash | ||
| - -ec | ||
| - | | ||
| # NooBaa OBC creates a Secret (keys) + ConfigMap (bucket/host/port) | ||
| # with the same name as the claim — not all keys live in the Secret. | ||
| echo "Checking ObjectBucketClaim ${OBC_NAME} in ${NS}..." | ||
| oc get objectbucketclaim "${OBC_NAME}" -n "${NS}" | ||
|
|
||
| echo "Waiting for ObjectBucketClaim ${OBC_NAME} to be Bound (timeout: 10 minutes)..." | ||
| oc wait --for=jsonpath='{.status.phase}'=Bound \ | ||
| "objectbucketclaim/${OBC_NAME}" -n "${NS}" --timeout=600s || { | ||
| echo "ERROR: ObjectBucketClaim failed to reach Bound state within timeout" >&2 | ||
| oc describe objectbucketclaim "${OBC_NAME}" -n "${NS}" >&2 || true | ||
| exit 1 | ||
| } | ||
|
|
||
| echo "Waiting for OBC Secret and ConfigMap ${OBC_NAME}..." | ||
| found=0 | ||
| for i in $(seq 1 60); do | ||
| if oc get secret "${OBC_NAME}" -n "${NS}" >/dev/null 2>&1 \ | ||
| && oc get configmap "${OBC_NAME}" -n "${NS}" >/dev/null 2>&1; then | ||
| found=1 | ||
| break | ||
| fi | ||
| sleep 5 | ||
| done | ||
| if [[ "${found}" -ne 1 ]]; then | ||
| echo "ERROR: OBC Secret and/or ConfigMap ${OBC_NAME} not available after 5 minutes" >&2 | ||
| oc describe objectbucketclaim "${OBC_NAME}" -n "${NS}" >&2 || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| ACCESS=$(oc get secret "${OBC_NAME}" -n "${NS}" -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' | base64 -d) | ||
| SECRET=$(oc get secret "${OBC_NAME}" -n "${NS}" -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' | base64 -d) | ||
| BUCKET=$(oc get configmap "${OBC_NAME}" -n "${NS}" -o jsonpath='{.data.BUCKET_NAME}') | ||
| HOST=$(oc get configmap "${OBC_NAME}" -n "${NS}" -o jsonpath='{.data.BUCKET_HOST}') | ||
| PORT=$(oc get configmap "${OBC_NAME}" -n "${NS}" -o jsonpath='{.data.BUCKET_PORT}') | ||
|
|
||
| if [[ -z "${ACCESS}" || -z "${SECRET}" || -z "${BUCKET}" || -z "${HOST}" ]]; then | ||
| echo "OBC Secret/ConfigMap is missing required keys" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -n "${PORT}" && "${PORT}" != "443" ]]; then | ||
| ENDPOINT="https://${HOST}:${PORT}" | ||
| else | ||
| ENDPOINT="https://${HOST}" | ||
| fi | ||
|
|
||
| oc create secret generic "${LOKI_SECRET}" -n "${NS}" \ | ||
| --from-literal=access_key_id="${ACCESS}" \ | ||
| --from-literal=access_key_secret="${SECRET}" \ | ||
| --from-literal=bucketnames="${BUCKET}" \ | ||
| --from-literal=endpoint="${ENDPOINT}" \ | ||
| --from-literal=region="${REGION}" \ | ||
| --dry-run=client -o yaml | oc apply -f - | ||
| echo "Created/updated ${LOKI_SECRET} for LokiStack (endpoint=${ENDPOINT})" | ||
| volumes: | ||
| - name: tmp | ||
| emptyDir: {} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| {{- if and .Values.enabled .Values.loki.enabled }} | ||
| apiVersion: loki.grafana.com/v1 | ||
| kind: LokiStack | ||
| metadata: | ||
| name: {{ .Values.loki.name }} | ||
| namespace: {{ .Values.loki.namespace }} | ||
| labels: | ||
| {{- include "netobserv.labels" . | nindent 4 }} | ||
| annotations: | ||
| argocd.argoproj.io/sync-wave: "41" | ||
| argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
| spec: | ||
| size: {{ .Values.loki.size }} | ||
| storage: | ||
| schemas: | ||
| - version: v13 | ||
| effectiveDate: "2022-06-01" | ||
| secret: | ||
| name: {{ .Values.loki.storageSecretName }} | ||
| type: s3 | ||
| storageClassName: {{ include "netobserv.lokiStorageClassName" . }} | ||
| tenants: | ||
| mode: openshift-network | ||
| {{- end }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.