diff --git a/health-check/Makefile b/health-check/Makefile index d2bf4172..75e77907 100644 --- a/health-check/Makefile +++ b/health-check/Makefile @@ -7,7 +7,7 @@ export IMAGE_REGISTRY ?= ghcr.io/foundation-model-stack export OPERATOR_NAMESPACE ?= multi-nic-cni-operator IMAGE_TAG_BASE = $(IMAGE_REGISTRY)/multi-nic-cni -IMAGE_VERSION ?= 1.0.0 +IMAGE_VERSION ?= 1.0.5 SIDECAR_IMG ?= $(IMAGE_TAG_BASE)-health-check-sidecar:v$(IMAGE_VERSION) CHECKER_IMG ?= $(IMAGE_TAG_BASE)-health-checker:v$(IMAGE_VERSION) @@ -47,5 +47,6 @@ deploy: deploy-agent clean: @kubectl delete -f ./checker/deployment.yaml && echo "Completely delete checkers" || echo "Failed to clean checkers" + @kubectl delete -f ./checker/configmap.yaml && echo "Completely delete configmap of checkers" || echo "Failed to clean configmap of checkers" @kubectl delete -f ./checker/rbac.yaml && echo "Completely delete RBAC resource of checkers" || echo "Failed to clean RBAC resource of checkers" @kubectl delete -f ./sidecar/manifest.yaml && echo "Completely delete agents" || echo "Failed to clean agents" \ No newline at end of file diff --git a/health-check/README.md b/health-check/README.md index 004894ad..0caa1471 100644 --- a/health-check/README.md +++ b/health-check/README.md @@ -23,11 +23,29 @@ kubectl create ns multi-nic-cni-operator kubectl label ns multi-nic-cni-operator openshift.io/cluster-monitoring=true ``` -4. Run +4. Install health-check agents and checker - ```bash - make deploy - ``` + 4.1. (optional) specify node (agent) selector + + - Modify `agentSelector` in `./checker/configmap.yaml` + + 4.2. run deploy script + + - Cluster with only single multinicnetwork + ```bash + make deploy + ``` + + - Cluster with multiple multinicnetworks + + ```bash + # deploy health-check agents (used for all multinicnetwork) + make deploy-agent + + # deploy checker (one deployment per multinicnetwork) + export NETWORK_NAME= + ./checker/script.sh deploy ${NETWORK_NAME} + ``` ```bash # expected output @@ -119,4 +137,3 @@ kubectl create ns multi-nic-cni-operator ``` ![](./img/health-check-prom.png) - diff --git a/health-check/checker/configmap.yaml b/health-check/checker/configmap.yaml new file mode 100644 index 00000000..601b55d6 --- /dev/null +++ b/health-check/checker/configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: multi-nic-cni-health-checker-cfg + namespace: multi-nic-cni-operator +data: {} + # agentSelector: | + # target=true \ No newline at end of file diff --git a/health-check/checker/deployment.yaml b/health-check/checker/deployment.yaml index da39d45b..39c1b565 100644 --- a/health-check/checker/deployment.yaml +++ b/health-check/checker/deployment.yaml @@ -18,22 +18,29 @@ spec: serviceAccount: multi-nic-cni-health-checker-sa serviceAccountName: multi-nic-cni-health-checker-sa containers: - - name: checker - image: ghcr.io/foundation-model-stack/multi-nic-cni-health-checker:v1.0.5 - imagePullPolicy: Always - ports: - - containerPort: 8080 - name: http - env: - - name: CHECKER_NAME - valueFrom: + - name: checker + image: ghcr.io/foundation-model-stack/multi-nic-cni-health-checker:v1.0.5 + imagePullPolicy: Always + ports: + - containerPort: 8080 + name: http + env: + - name: CHECKER_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: CHECKER_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: TARGET_NETWORK + valueFrom: fieldRef: - fieldPath: metadata.name - - name: CHECKER_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: TARGET_NETWORK - valueFrom: - fieldRef: - fieldPath: metadata.annotations['k8s.v1.cni.cncf.io/networks'] \ No newline at end of file + fieldPath: metadata.annotations['k8s.v1.cni.cncf.io/networks'] + volumeMounts: + - name: checker-config + mountPath: /etc/config + volumes: + - name: checker-config + configMap: + name: multi-nic-cni-health-checker-cfg \ No newline at end of file diff --git a/health-check/checker/script.sh b/health-check/checker/script.sh index 359d6d36..ff8f0782 100755 --- a/health-check/checker/script.sh +++ b/health-check/checker/script.sh @@ -21,6 +21,7 @@ create_replacement() { } deploy() { + kubectl apply -f ./checker/configmap.yaml kubectl apply -f ./checker/rbac.yaml NETWORK_NAME=$1 if [ -z $1 ]; then diff --git a/health-check/sidecar/patch.yaml b/health-check/sidecar/patch.yaml index 2b8d759b..df63ab75 100644 --- a/health-check/sidecar/patch.yaml +++ b/health-check/sidecar/patch.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: multi-nicd + namespace: multi-nic-cni-operator spec: template: spec: