File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -120,13 +120,20 @@ func mutateHandler(w http.ResponseWriter, r *http.Request) {
120
120
ReadOnly : true ,
121
121
}
122
122
123
- // Define the env var
124
123
if needsCreds {
124
+ // Define the env var
125
125
e := corev1.EnvVar {
126
126
Name : "GOOGLE_APPLICATION_CREDENTIALS" ,
127
127
Value : "/google-app-creds.json" ,
128
128
}
129
129
envVars = append (envVars , e )
130
+
131
+ // add the volume in the list of patches
132
+ patch = append (patch , patchOperation {
133
+ Op : "add" ,
134
+ Path : "/spec/volumes" ,
135
+ Value : append (pod .Spec .Volumes , v ),
136
+ })
130
137
}
131
138
132
139
// If GOOGLE_CLOUD_PROJECT is set in the VM, set it for all GCP apps.
@@ -145,14 +152,6 @@ func mutateHandler(w http.ResponseWriter, r *http.Request) {
145
152
}
146
153
}
147
154
148
- if needsCreds {
149
- patch = append (patch , patchOperation {
150
- Op : "add" ,
151
- Path : "/spec/volumes" ,
152
- Value : append (pod .Spec .Volumes , v ),
153
- })
154
- }
155
-
156
155
if len (envVars ) > 0 {
157
156
for i , c := range pod .Spec .Containers {
158
157
if needsCreds {
You can’t perform that action at this time.
0 commit comments