Skip to content

Commit 6a3d47c

Browse files
authored
Merge pull request #272 from jiaxunsongucb/customization_for_azurestack
chore: customization for Azure Stack Cloud
2 parents 2a0c8b7 + 25d796b commit 6a3d47c

File tree

10 files changed

+64
-1
lines changed

10 files changed

+64
-1
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ spec:
9595
optional: true
9696
- name: CSI_ENDPOINT
9797
value: unix:///csi/csi.sock
98+
- name: AZURE_ENVIRONMENT_FILEPATH # For Azure Stack Cloud
99+
value: /etc/kubernetes/azurestackcloud.json
98100
imagePullPolicy: {{ .Values.image.blob.pullPolicy }}
99101
volumeMounts:
100102
- mountPath: /csi
@@ -104,6 +106,9 @@ spec:
104106
- mountPath: /var/lib/waagent/ManagedIdentity-Settings
105107
readOnly: true
106108
name: msi
109+
- name: ssl
110+
mountPath: /etc/ssl/certs
111+
readOnly: true
107112
resources:
108113
limits:
109114
cpu: 200m
@@ -121,4 +126,7 @@ spec:
121126
- name: msi
122127
hostPath:
123128
path: /var/lib/waagent/ManagedIdentity-Settings
129+
- name: ssl
130+
hostPath:
131+
path: /etc/ssl/certs
124132
---

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ spec:
113113
fieldRef:
114114
apiVersion: v1
115115
fieldPath: spec.nodeName
116+
- name: AZURE_ENVIRONMENT_FILEPATH # For Azure Stack Cloud
117+
value: /etc/kubernetes/azurestackcloud.json
116118
imagePullPolicy: {{ .Values.image.pullPolicy }}
117119
securityContext:
118120
privileged: true
@@ -129,6 +131,9 @@ spec:
129131
name: msi
130132
- mountPath: /mnt
131133
name: blob-cache
134+
- name: ssl
135+
mountPath: /etc/ssl/certs
136+
readOnly: true
132137
resources:
133138
limits:
134139
cpu: 2
@@ -159,3 +164,6 @@ spec:
159164
- hostPath:
160165
path: /mnt
161166
name: blob-cache
167+
- name: ssl
168+
hostPath:
169+
path: /etc/ssl/certs

deploy/csi-blob-controller.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec:
9393
optional: true
9494
- name: CSI_ENDPOINT
9595
value: unix:///csi/csi.sock
96+
- name: AZURE_ENVIRONMENT_FILEPATH # For Azure Stack Cloud
97+
value: /etc/kubernetes/azurestackcloud.json
9698
volumeMounts:
9799
- mountPath: /csi
98100
name: socket-dir
@@ -101,6 +103,9 @@ spec:
101103
- mountPath: /var/lib/waagent/ManagedIdentity-Settings
102104
readOnly: true
103105
name: msi
106+
- name: ssl
107+
mountPath: /etc/ssl/certs
108+
readOnly: true
104109
resources:
105110
limits:
106111
cpu: 200m
@@ -118,3 +123,6 @@ spec:
118123
- name: msi
119124
hostPath:
120125
path: /var/lib/waagent/ManagedIdentity-Settings
126+
- name: ssl
127+
hostPath:
128+
path: /etc/ssl/certs

deploy/csi-blob-node.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ spec:
112112
fieldRef:
113113
apiVersion: v1
114114
fieldPath: spec.nodeName
115+
- name: AZURE_ENVIRONMENT_FILEPATH # For Azure Stack Cloud
116+
value: /etc/kubernetes/azurestackcloud.json
115117
securityContext:
116118
privileged: true
117119
volumeMounts:
@@ -127,6 +129,9 @@ spec:
127129
name: msi
128130
- mountPath: /mnt
129131
name: blob-cache
132+
- name: ssl
133+
mountPath: /etc/ssl/certs
134+
readOnly: true
130135
resources:
131136
limits:
132137
cpu: 2
@@ -157,4 +162,7 @@ spec:
157162
- hostPath:
158163
path: /mnt
159164
name: blob-cache
165+
- name: ssl
166+
hostPath:
167+
path: /etc/ssl/certs
160168
---

hack/verify-boilerplate.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21+
echo "Verifying boilerplate"
22+
23+
if [[ -z "$(command -v python)" ]]; then
24+
echo "Cannot find python. Make link to python3..."
25+
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
26+
fi
2127

2228
REPO_ROOT=$(dirname "${BASH_SOURCE}")/..
2329

@@ -40,4 +46,6 @@ if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then
4046
done
4147

4248
exit 1
43-
fi
49+
fi
50+
51+
echo "Done"

hack/verify-golint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ set -euo pipefail
1919
if [[ -z "$(command -v golangci-lint)" ]]; then
2020
echo "Cannot find golangci-lint. Installing golangci-lint..."
2121
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0
22+
export PATH=$PATH:$(go env GOPATH)/bin
2223
fi
2324

25+
echo "Verifying golint"
26+
2427
golangci-lint run --no-config --enable=golint --disable=typecheck --deadline=10m
2528

2629
echo "Congratulations! Lint check completed for all Go source files."

hack/verify-gomod.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
set -euo pipefail
1818

19+
echo "Verifying gomod"
1920
export GO111MODULE=on
2021
echo "go mod tidy"
2122
go mod tidy

hack/verify-helm-chart.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ function validate_image() {
3737

3838
echo "Comparing image version between helm chart and manifests in deploy folder"
3939

40+
if [[ -z "$(command -v pip)" ]]; then
41+
echo "Cannot find pip. Installing pip3..."
42+
apt install python3-pip -y
43+
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
44+
fi
45+
46+
if [[ -z "$(command -v jq)" ]]; then
47+
echo "Cannot find jq. Installing yq..."
48+
apt install jq -y
49+
fi
50+
4051
# jq-equivalent for yaml
4152
pip install yq
4253

pkg/blob/azure.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ var (
4040
DefaultCredFilePath = "/etc/kubernetes/azure.json"
4141
)
4242

43+
// IsAzureStackCloud decides whether the driver is running on Azure Stack Cloud.
44+
func IsAzureStackCloud(cloud *azureprovider.Cloud) bool {
45+
return strings.EqualFold(cloud.Config.Cloud, "AZURESTACKCLOUD")
46+
}
47+
4348
// GetCloudProvider get Azure Cloud Provider
4449
func GetCloudProvider(kubeconfig string) (*azureprovider.Cloud, error) {
4550
kubeClient, err := getKubeClient(kubeconfig)

pkg/blob/controllerserver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
110110
if strings.HasPrefix(strings.ToLower(storageAccountType), "premium") {
111111
accountKind = string(storage.BlockBlobStorage)
112112
}
113+
if IsAzureStackCloud(d.cloud) {
114+
accountKind = string(storage.Storage)
115+
}
113116

114117
tags, err := azure.ConvertTagsToMap(customTags)
115118
if err != nil {

0 commit comments

Comments
 (0)