refactor: Replaced context.TODO() with request.Context() in API files (#2214)

This commit is contained in:
Pradeep Lakshmi Narasimha
2021-10-04 12:52:50 +05:30
committed by GitHub
parent 6e00aa6cf5
commit 23f4643c6e
11 changed files with 58 additions and 66 deletions
+1 -2
View File
@@ -17,7 +17,6 @@ limitations under the License.
package controller
import (
"context"
"net/http"
"github.com/gorilla/mux"
@@ -33,7 +32,7 @@ func (a *API) ConfigMapExists(w http.ResponseWriter, r *http.Request) {
ns = metav1.NamespaceDefault
}
_, err := a.kubernetesClient.CoreV1().ConfigMaps(ns).Get(context.TODO(), name, metav1.GetOptions{})
_, err := a.kubernetesClient.CoreV1().ConfigMaps(ns).Get(r.Context(), name, metav1.GetOptions{})
if err != nil {
a.logger.Error("error getting config map", zap.Error(err), zap.String("config_map_name", name), zap.String("namespace", ns))
a.respondWithError(w, err)