@@ -160,7 +160,7 @@ func SetAuthzForPods(podNames []string, info string) {
160
160
os .Exit (1 )
161
161
}
162
162
for _ , pod := range podList .Items {
163
- AuthzPerKmeshDaemon (cli , pod .GetName (), info )
163
+ SetAuthzPerKmeshDaemon (cli , pod .GetName (), info )
164
164
}
165
165
} else {
166
166
// Process for specified pods.
@@ -184,18 +184,9 @@ func SetAuthzPerKmeshDaemon(cli kube.CLIClient, podName, info string) {
184
184
}
185
185
defer fw .Close ()
186
186
187
- var url , method string
187
+ url := fmt . Sprintf ( "http://%s%s?enable=%s" , fw . Address (), patternAuthz , info )
188
188
189
- switch info {
190
- case "true" , "false" :
191
- url = fmt .Sprintf ("http://%s%s?enable=%s" , fw .Address (), patternAuthz , info )
192
- method = http .MethodPost
193
- case "display" :
194
- url = fmt .Sprintf ("http://%s%s" , fw .Address (), patternAuthz )
195
- method = http .MethodGet
196
- }
197
-
198
- req , err := http .NewRequest (method , url , nil )
189
+ req , err := http .NewRequest (http .MethodPost , url , nil )
199
190
if err != nil {
200
191
log .Errorf ("Error creating request: %v" , err )
201
192
return
@@ -214,19 +205,6 @@ func SetAuthzPerKmeshDaemon(cli kube.CLIClient, podName, info string) {
214
205
log .Errorf ("Error: received status code %d" , resp .StatusCode )
215
206
return
216
207
}
217
-
218
- body , err := io .ReadAll (resp .Body )
219
- if err != nil {
220
- log .Errorf ("failed to read from resp body: %v" , err )
221
- return
222
- }
223
-
224
- switch info {
225
- case "true" , "false" :
226
- fmt .Printf ("%s\n " , body )
227
- case "display" :
228
- fmt .Printf ("%s %s\n " , podName , body )
229
- }
230
208
}
231
209
232
210
// fetchAuthzStatus sends a GET request to a specific kmesh daemon pod
0 commit comments