Skip to content

Commit a00a303

Browse files
committed
Backport helm updates
1 parent ff2f36e commit a00a303

29 files changed

+9697
-9178
lines changed

.github/workflows/pull_request.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
files: ./cover.out
3434
flags: unittests
3535
fail_ci_if_error: false
36-
verbose: true
36+
verbose: true
3737

3838
bundle-check:
3939
runs-on: ubuntu-latest
@@ -47,3 +47,27 @@ jobs:
4747
run: make update-bundle
4848
- name: check bundle clean state
4949
run: git add -A && git diff HEAD -I "operator-sdk-v" --exit-code
50+
51+
helm-check:
52+
runs-on: ubuntu-latest
53+
name: Checking helm up-to-date and valid
54+
steps:
55+
- name: install make
56+
run: sudo apt-get install make
57+
58+
- name: checkout
59+
uses: actions/checkout@v3
60+
61+
- name: generate helm
62+
run: make helm-update
63+
64+
- name: check helm clean state
65+
run: git add -A && git diff HEAD --exit-code
66+
67+
- name: set up Helm
68+
uses: azure/[email protected]
69+
with:
70+
version: v3.17.0
71+
72+
- name: run helm lint
73+
run: helm lint helm/

.mk/development.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ undeploy-loki-tls:
3131
.PHONY: deploy-loki-tls
3232
deploy-loki-tls:
3333
@echo -e "\n==> Deploy tls loki"
34-
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
34+
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
3535
kubectl config set-context --current --namespace=$(NAMESPACE)
3636
curl -S -L https://raw.githubusercontent.com/netobserv/documents/main/examples/zero-click-loki/1-storage.yaml | kubectl create -f - || true
3737
curl -S -L https://raw.githubusercontent.com/netobserv/documents/main/examples/zero-click-loki/2-loki-tls.yaml | kubectl create -f - || true
@@ -119,6 +119,8 @@ undeploy-all: undeploy-infra undeploy-sample-cr undeploy-sample-workload
119119
.PHONY: deploy-prometheus
120120
deploy-prometheus: ## Deploy prometheus.
121121
@echo -e "\n==> Deploy prometheus"
122+
kubectl create namespace $(NAMESPACE) || true
123+
kubectl config set-context --current --namespace=$(NAMESPACE)
122124
kubectl apply -f config/kind/deployment-prometheus.yaml
123125
kubectl rollout status "deploy/prometheus" --timeout=600s
124126
-pkill --oldest --full "9090:9090"

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,14 @@ endif
526526
@echo ""
527527
@echo "Everything is ready to be pushed. Before that, you should compare the content of $(BUNDLE_VERSION) with $(PREVIOUS_VERSION) to make sure it looks correct."
528528

529+
# Update helm templates
530+
.PHONY: helm-update
531+
helm-update: YQ ## Update helm template
532+
sed -i -r 's/appVersion:.*/appVersion: $(BUNDLE_VERSION)/g' helm/Chart.yaml
533+
sed -i -r 's/version:.*/version: $(BUNDLE_VERSION:%-community=%)/g' helm/Chart.yaml
534+
hack/helm-update.sh
535+
cp LICENSE helm/
536+
529537
include .mk/sample.mk
530538
include .mk/development.mk
531539
include .mk/local.mk

README.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,73 @@ Flow data is then available in multiple ways, each optional:
1616

1717
## Getting Started
1818

19-
You can install NetObserv Operator using [OLM](https://olm.operatorframework.io/) if it is available in your cluster, or directly from its repository.
19+
You can install the NetObserv Operator using [Helm](https://helm.sh/), or directly from sources.
2020

21-
### Install with OLM
21+
In OpenShift, NetObserv is named Network Observability operator and can be found in OperatorHub as an OLM operator. This section does not apply to it: please refer to the [OpenShift documentation](https://docs.openshift.com/container-platform/latest/observability/network_observability/installing-operators.html) in that case.
2222

2323
> [!IMPORTANT]
24-
> There hasn't been recent releases pushed to the community OperatorHub. This is mostly due to the lack of demand. Unless there is demand, going forward we only release the downstream NetObserv aka [Network Observability operator](https://docs.openshift.com/container-platform/latest/observability/network_observability/network-observability-operator-release-notes.html) for OpenShift. But there's nothing written in stone. [Let us know](https://github.com/netobserv/network-observability-operator/discussions) if you would like that to change.
24+
> NetObserv community was previously distributed via [OperatorHub](https://operatorhub.io/operator/netobserv-operator). This installation method is replaced with a helm chart. If you previously installed NetObserv community from OperatorHub, we recommend that you uninstall it, and re-install using the helm chart. The operation should not cause any data loss.
2525
26-
NetObserv Operator is available in [OperatorHub](https://operatorhub.io/operator/netobserv-operator) with guided steps on how to install this. It is also available in the OperatorHub catalog directly in the OpenShift Console.
26+
### Pre-requisite
2727

28-
![OpenShift OperatorHub search](./docs/assets/operatorhub-search.png)
28+
NetObserv has a couple of dependencies that must be installed on your cluster:
2929

30-
Please read the [operator description in OLM](./config/descriptions/upstream.md).
30+
- Cert-manager
31+
- Prometheus
32+
- Loki
3133

32-
After the operator is installed, create a `FlowCollector` resource:
34+
Loki is not mandatory but improves the overall experience with NetObserv.
35+
If you don't have these dependencies already, some convenience scripts are available from the repository, provided for demo purpose:
3336

34-
![OpenShift OperatorHub FlowCollector](./docs/assets/operatorhub-flowcollector.png)
37+
```bash
38+
git clone https://github.com/netobserv/network-observability-operator.git && cd network-observability-operator
39+
PORT_FWD=false make deploy-prometheus deploy-loki install-cert-manager
40+
# (it is expected to see errors while running this script, since it runs several attempts creating a certificate for testing, before eventually succeeding)
41+
```
3542

36-
Refer to the [Configuration section](#configuration) of this document.
43+
### Install with Helm
44+
45+
Check it out on [ArtifactHub](https://artifacthub.io/packages/helm/netobserv/netobserv-operator).
46+
47+
```bash
48+
helm repo add netobserv https://netobserv.io/static/helm/ --force-update
49+
helm install my-netobserv --set standaloneConsole.enable=true netobserv/netobserv-operator
50+
# If you're in OpenShift, you can omit "--set standaloneConsole.enable=true" to use the Console plugin instead.
51+
```
52+
53+
You can now create a `FlowCollector` resource. Refer to the [Configuration section](#configuration) of this document. A very short `FlowCollector` should work, using default values, plus with the standalone console enabled:
54+
55+
```bash
56+
cat <<EOF | kubectl apply -f -
57+
apiVersion: flows.netobserv.io/v1beta2
58+
kind: FlowCollector
59+
metadata:
60+
name: cluster
61+
spec:
62+
namespace: netobserv
63+
consolePlugin:
64+
advanced:
65+
env:
66+
TEST_CONSOLE: "true"
67+
prometheus:
68+
querier:
69+
manual:
70+
url: http://prometheus:9090
71+
EOF
72+
```
73+
74+
A few remarks:
75+
- While the [web console](https://github.com/netobserv/network-observability-console-plugin) is primarily designed as a plugin for the OpenShift Console, it is still possible to deploy it as a standalone, which the dev team sometimes use for testing. This is why it is mentioned as "TEST_CONSOLE" here.
76+
- If you're in OpenShift, you should omit "TEST_CONSOLE: true" to use the Console plugin instead, which offers a better / more integrated experience.
77+
- You can change the Prometheus URL depending on your installation. This example URL works if you use the `make deploy-prometheus` script from the repository. Prometheus configuration options are documented [here](./docs/FlowCollector.md#flowcollectorspecprometheus-1).
78+
79+
To view the test console, you can port-forward 9001:
80+
81+
```bash
82+
kubectl port-forward svc/netobserv-plugin 9001:9001 -n netobserv
83+
```
84+
85+
Then open http://localhost:9001/ in your browser.
3786

3887
### Install from repository
3988

RELEASE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ Once all sub-components are released (or have a release candidate), we can proce
3232
Edit the [Makefile](./Makefile) to update `PREVIOUS_VERSION`, `BUNDLE_VERSION`, `PLG_VERSION`, `FLP_VERSION` and `BPF_VERSION`.
3333

3434
```bash
35-
36-
make update-bundle
35+
make update-bundle helm-update
3736

3837
# Set desired operator version - CAREFUL, no leading "v" here
3938
version="1.8.1-community"

config/kind/deployment-prometheus.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: prometheus-scraper
5+
rules:
6+
- apiGroups:
7+
- ""
8+
resources:
9+
- pods
10+
- services
11+
verbs:
12+
- list
13+
- get
14+
- watch
15+
---
16+
apiVersion: v1
17+
kind: ServiceAccount
18+
metadata:
19+
name: prometheus-sa
20+
---
21+
apiVersion: rbac.authorization.k8s.io/v1
22+
kind: RoleBinding
23+
metadata:
24+
name: prometheus-scraper
25+
roleRef:
26+
apiGroup: rbac.authorization.k8s.io
27+
kind: Role
28+
name: prometheus-scraper
29+
subjects:
30+
- kind: ServiceAccount
31+
name: prometheus-sa
32+
---
133
apiVersion: apps/v1
234
kind: Deployment
335
metadata:
@@ -35,7 +67,7 @@ spec:
3567
mountPath: /etc/prometheus/
3668
- name: prometheus-storage-volume
3769
mountPath: /prometheus/
38-
serviceAccountName: flowlogs-pipeline
70+
serviceAccountName: prometheus-sa
3971
volumes:
4072
- name: prometheus-config-volume
4173
configMap:
@@ -75,6 +107,8 @@ data:
75107
- job_name: 'flowlogs-pipeline'
76108
kubernetes_sd_configs:
77109
- role: pod
110+
namespaces:
111+
own_namespace: true
78112
79113
relabel_configs:
80114
# Scrape only pods that have "prometheus.io/scrape = true" annotation.
-55.4 KB
Binary file not shown.

docs/assets/operatorhub-search.png

-63.5 KB
Binary file not shown.

hack/helm-update.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir -p _tmp
4+
5+
# Copy and edit CRDs
6+
for crd in "flows.netobserv.io_flowcollectors.yaml" "flows.netobserv.io_flowmetrics.yaml"; do
7+
cp "bundle/manifests/$crd" helm/templates
8+
sed -i -r 's/(`[^`]*\{\{[^`]*`)/{{\1}}/g' helm/templates/$crd # escape "{{" for helm
9+
yq -i '.spec.conversion.webhook.clientConfig.service.namespace="{{ .Release.Namespace }}"' helm/templates/$crd
10+
done
11+
12+
# Copy unchanged files
13+
for file in "netobserv-manager-config_v1_configmap.yaml" "netobserv-metrics-service_v1_service.yaml" "netobserv-webhook-service_v1_service.yaml" ; do
14+
cp "bundle/manifests/$file" helm/templates
15+
done
16+
17+
# Services: remove openshift annotations for certificates (and some kubeconfig labels)
18+
yq -i 'del(.metadata.annotations)' helm/templates/netobserv-metrics-service_v1_service.yaml
19+
yq -i 'del(.metadata.annotations)' helm/templates/netobserv-webhook-service_v1_service.yaml
20+
yq -i 'del(.metadata.labels)' helm/templates/netobserv-webhook-service_v1_service.yaml
21+
22+
# Extract data from clusterserviceversion
23+
yq '.spec.install.spec.deployments[0].spec' bundle/manifests/netobserv-operator.clusterserviceversion.yaml > _tmp/csv-deployment.yaml
24+
yq '.spec.install.spec.clusterPermissions[0]' bundle/manifests/netobserv-operator.clusterserviceversion.yaml > _tmp/csv-clusterrole.yaml
25+
yq '.spec.install.spec.permissions[0]' bundle/manifests/netobserv-operator.clusterserviceversion.yaml > _tmp/csv-role.yaml
26+
27+
# Create deployment
28+
yq '{"apiVersion": "apps/v1", "kind": "Deployment", "metadata": {"name": "netobserv-controller-manager", "labels": {"app": "netobserv-operator", "control-plane": "controller-manager"}}, "spec": .}' _tmp/csv-deployment.yaml > helm/templates/deployment.yaml
29+
30+
# Inject paramterized standalone console in deployment
31+
PLUGIN_IMAGE=$(yq '(.spec.template.spec.containers[0].env[] | select(.name=="RELATED_IMAGE_CONSOLE_PLUGIN") | .value)' helm/templates/deployment.yaml)
32+
STANDALONE_IMAGE=$(echo $PLUGIN_IMAGE | sed 's/network-observability-console-plugin/network-observability-standalone-frontend/')
33+
yq -i "(.spec.template.spec.containers[0].env[] | select(.name==\"RELATED_IMAGE_CONSOLE_PLUGIN\") | .value) = \"{{ if .Values.standaloneConsole.enable }}$STANDALONE_IMAGE{{ else }}$PLUGIN_IMAGE{{ end }}\"" helm/templates/deployment.yaml
34+
35+
# Create roles
36+
yq '{"apiVersion": "v1", "kind": "ServiceAccount", "metadata": {"name": .serviceAccountName}}' _tmp/csv-clusterrole.yaml > helm/templates/serviceaccount.yaml
37+
yq '{"apiVersion": "rbac.authorization.k8s.io/v1", "kind": "ClusterRole", "metadata": {"name": "netobserv-manager-role"}, "rules": .rules}' _tmp/csv-clusterrole.yaml > helm/templates/clusterrole.yaml
38+
yq '{"apiVersion": "rbac.authorization.k8s.io/v1", "kind": "ClusterRoleBinding", "metadata": {"name": "netobserv-manager-rolebinding"}, "roleRef": {"apiGroup": "rbac.authorization.k8s.io", "kind": "ClusterRole", "name": "netobserv-manager-role"}, "subjects": [{"kind": "ServiceAccount", "name": .serviceAccountName, "namespace": "{{ .Release.Namespace }}"}]}' _tmp/csv-clusterrole.yaml > helm/templates/clusterrolebinding.yaml
39+
yq '{"apiVersion": "rbac.authorization.k8s.io/v1", "kind": "Role", "metadata": {"name": "netobserv-leader-election-role"}, "rules": .rules}' _tmp/csv-role.yaml > helm/templates/role.yaml
40+
yq '{"apiVersion": "rbac.authorization.k8s.io/v1", "kind": "RoleBinding", "metadata": {"name": "netobserv-leader-election-rolebinding"}, "roleRef": {"apiGroup": "rbac.authorization.k8s.io", "kind": "Role", "name": "netobserv-leader-election-role"}, "subjects": [{"kind": "ServiceAccount", "name": .serviceAccountName, "namespace": "{{ .Release.Namespace }}"}]}' _tmp/csv-role.yaml > helm/templates/rolebinding.yaml

helm/netobserv/Chart.yaml renamed to helm/Chart.yaml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
2-
name: Netobserv
3-
description: A Helm chart to install Network Observability Operator on k8s
2+
name: netobserv-operator
3+
description: Network Observability in Kubernetes based on eBPF.
44

55
# A chart can be either an 'application' or a 'library' chart.
66
#
@@ -15,10 +15,43 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.0.1
18+
version: 1.8.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "1.6.2-community"
24+
appVersion: 1.8.1-community
25+
26+
keywords:
27+
- network observability
28+
- ebpf
29+
- ipfix
30+
- flow tracing
31+
- flows
32+
- topology
33+
- network
34+
- observability
35+
36+
home: https://netobserv.io/
37+
38+
sources:
39+
- https://github.com/netobserv/network-observability-operator
40+
- https://github.com/netobserv/flowlogs-pipeline
41+
- https://github.com/netobserv/netobserv-ebpf-agent
42+
- https://github.com/netobserv/network-observability-console-plugin
43+
- https://github.com/netobserv/network-observability-cli
44+
45+
maintainers:
46+
47+
name: Julien Pinsonneau
48+
49+
name: Joel Takvorian
50+
51+
name: Mohamed S. Mahmoud
52+
53+
name: Olivier Cazade
54+
55+
name: Steven Lee
56+
57+
icon: https://netobserv.io/static/assets/images/netobserv.svg

0 commit comments

Comments
 (0)