Skip to content

Commit 14b09a8

Browse files
authored
Merge pull request #231 from andyzhangx/metrics-issue
fix: metrics port and doc issue
2 parents 5420cd2 + 2b37d07 commit 14b09a8

File tree

10 files changed

+31
-9
lines changed

10 files changed

+31
-9
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,7 @@ build-push: blob-container
130130
clean:
131131
go clean -r -x
132132
-rm -rf _output
133+
134+
.PHONY: create-metrics-svc
135+
create-metrics-svc:
136+
kubectl create -f deploy/example/metrics/csi-blob-controller-svc.yaml

charts/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ The following table lists the configurable parameters of the latest Azure Blob S
6464
| `serviceAccount.create` | whether create service account of csi-blob-controller | true |
6565
| `rbac.create` | whether create rbac of csi-blob-controller | true |
6666
| `controller.replicas` | the replicas of csi-blob-controller | 2 |
67+
| `controller.metricsPort` | metrics port of csi-blob-controller | 29634 |
68+
| `node.metricsPort` | metrics port of csi-blob-node | 29635 |
69+
6770
## Troubleshooting
6871

6972
If there are some errors when using helm to install, follow the steps to debug:

charts/latest/blob-csi-driver/templates/csi-blob-controller.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ spec:
9090
args:
9191
- "--v=5"
9292
- "--endpoint=$(CSI_ENDPOINT)"
93+
- "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}"
9394
ports:
9495
- containerPort: 29632
9596
name: healthz
9697
protocol: TCP
97-
- containerPort: 29634
98+
- containerPort: {{ .Values.controller.metricsPort }}
9899
name: metrics
99100
protocol: TCP
100101
livenessProbe:

charts/latest/blob-csi-driver/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ rbac:
2727
create: true
2828

2929
controller:
30+
metricsPort: 29634
3031
replicas: 2
3132

3233
node:
33-
metricsPort: 29625
34+
metricsPort: 29635

deploy/csi-blob-controller.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ spec:
8787
args:
8888
- "--v=5"
8989
- "--endpoint=$(CSI_ENDPOINT)"
90+
- "--metrics-address=0.0.0.0:29634"
9091
ports:
9192
- containerPort: 29632
9293
name: healthz

deploy/example/metrics/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/blob-csi-driv
99
```console
1010
$ kubectl get svc csi-blob-controller -n kube-system
1111
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
12-
csi-blob-controller ClusterIP 10.0.156.8 <none> 29634/TCP 32m
12+
csi-blob-controller ClusterIP 10.0.156.8 20.39.0.113 29634/TCP 32m
1313
```
1414

1515
3. Run following command to get cloudprovider_azure metrics
1616
```console
17-
curl http://{CLUSTER-IP}:29634/metrics | grep cloudprovider_azure
18-
```
17+
ip=`kubectl get svc csi-blob-controller -n kube-system | grep blob | awk '{print $4}'`
18+
curl http://$ip:29634/metrics | grep cloudprovider_azure | grep -e sum -e count
19+
```

deploy/example/metrics/csi-blob-controller-svc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ spec:
1010
ports:
1111
- port: 29634
1212
targetPort: 29634
13-
type: ClusterIP
13+
type: LoadBalancer

pkg/blobplugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var (
3939
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
4040
nodeID = flag.String("nodeid", "", "node id")
4141
version = flag.Bool("version", false, "Print the version and exit.")
42-
metricsAddress = flag.String("metrics-address", "0.0.0.0:29624", "export the metrics")
42+
metricsAddress = flag.String("metrics-address", "0.0.0.0:29634", "export the metrics")
4343
kubeconfig = flag.String("kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
4444
)
4545

test/e2e/suite_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,17 @@ var _ = ginkgo.BeforeSuite(func() {
8888
e2eBootstrap := testCmd{
8989
command: "make",
9090
args: []string{"e2e-bootstrap"},
91-
startLog: "Installing Azure Blob Storage CSI driver...",
91+
startLog: "Installing Azure Blob Storage CSI driver ...",
9292
endLog: "Azure Blob Storage CSI driver installed",
9393
}
94-
execTestCmd([]testCmd{e2eBootstrap})
9594

95+
createMetricsSVC := testCmd{
96+
command: "make",
97+
args: []string{"create-metrics-svc"},
98+
startLog: "create metrics service ...",
99+
endLog: "metrics service created",
100+
}
101+
execTestCmd([]testCmd{e2eBootstrap, createMetricsSVC})
96102
}
97103
nodeid := os.Getenv("nodeid")
98104
kubeconfig := os.Getenv(kubeconfigEnvVar)

test/utils/blob_log.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ LABEL='app=csi-blob-node'
4040
kubectl get pods -n${NS} -l${LABEL} \
4141
| awk 'NR>1 {print $1}' \
4242
| xargs -I {} kubectl logs {} --prefix -c${CONTAINER} -n${NS}
43+
44+
echo "print out cloudprovider_azure metrics ..."
45+
echo "======================================================================================"
46+
ip=`kubectl get svc csi-blob-controller -n kube-system | grep blob | awk '{print $4}'`
47+
curl http://$ip:29634/metrics

0 commit comments

Comments
 (0)