* Add code generated using latest code-generator Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Update client-go and respective dependencies to v0.19.2 Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Upgrading CRD version Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Minor changes Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Resolved client-go calls as per new generated code Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Function validations fix Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Fix environment and package validations Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Add basic validation to all CRDs Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Remove CRD installation related code Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Modify GHA for CRD installation Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Fix Package and HTTPTrigger validations Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Change Go version in CI to 1.15 Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Style: kubebuilder marker change Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Fix test with deprecated fields Signed-off-by: Harsh Thakur <harshthakur9030@gmail.com> * Update kind node image to v1.16.15 in CI Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Update kind node image to v1.19.11 in CI Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Replace context Background with TODO for future implementation Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Optimize initial CRD check code Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Use Get call only to check CRDs Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Add kustomize for CRD apply Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
/*
|
|
Copyright 2016 The Fission Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package controller
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
"go.uber.org/zap"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
func (a *API) SecretExists(w http.ResponseWriter, r *http.Request) {
|
|
vars := mux.Vars(r)
|
|
name := vars["secret"]
|
|
ns := a.extractQueryParamFromRequest(r, "namespace")
|
|
if len(ns) == 0 {
|
|
ns = metav1.NamespaceDefault
|
|
}
|
|
|
|
_, err := a.kubernetesClient.CoreV1().Secrets(ns).Get(context.TODO(), name, metav1.GetOptions{})
|
|
if err != nil {
|
|
a.logger.Error("error getting secret",
|
|
zap.Error(err),
|
|
zap.String("secret_name", name),
|
|
zap.String("namespace", ns))
|
|
a.respondWithError(w, err)
|
|
return
|
|
}
|
|
a.respondWithSuccess(w, nil)
|
|
}
|