Crds update (#2033)
* 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>
This commit is contained in:
co-authored by
Sanket Sudake
parent
a9c56e5bb2
commit
1e0baf5f6c
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -116,7 +117,7 @@ func (a *API) FunctionApiList(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceAll
|
||||
}
|
||||
|
||||
funcs, err := a.fissionClient.CoreV1().Functions(ns).List(metav1.ListOptions{})
|
||||
funcs, err := a.fissionClient.CoreV1().Functions(ns).List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -152,7 +153,7 @@ func (a *API) FunctionApiCreate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
fnew, err := a.fissionClient.CoreV1().Functions(f.ObjectMeta.Namespace).Create(&f)
|
||||
fnew, err := a.fissionClient.CoreV1().Functions(f.ObjectMeta.Namespace).Create(context.TODO(), &f, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -176,7 +177,7 @@ func (a *API) FunctionApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
f, err := a.fissionClient.CoreV1().Functions(ns).Get(name, metav1.GetOptions{})
|
||||
f, err := a.fissionClient.CoreV1().Functions(ns).Get(context.TODO(), name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -213,7 +214,7 @@ func (a *API) FunctionApiUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
fnew, err := a.fissionClient.CoreV1().Functions(f.ObjectMeta.Namespace).Update(&f)
|
||||
fnew, err := a.fissionClient.CoreV1().Functions(f.ObjectMeta.Namespace).Update(context.TODO(), &f, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -235,7 +236,7 @@ func (a *API) FunctionApiDelete(w http.ResponseWriter, r *http.Request) {
|
||||
ns = metav1.NamespaceDefault
|
||||
}
|
||||
|
||||
err := a.fissionClient.CoreV1().Functions(ns).Delete(name, &metav1.DeleteOptions{})
|
||||
err := a.fissionClient.CoreV1().Functions(ns).Delete(context.TODO(), name, metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -298,7 +299,7 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
|
||||
podNs = ns
|
||||
}
|
||||
|
||||
f, err := a.fissionClient.CoreV1().Functions(ns).Get(fnName, metav1.GetOptions{})
|
||||
f, err := a.fissionClient.CoreV1().Functions(ns).Get(context.TODO(), fnName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -310,7 +311,7 @@ func (a *API) FunctionPodLogs(w http.ResponseWriter, r *http.Request) {
|
||||
fv1.ENVIRONMENT_NAME: f.Spec.Environment.Name,
|
||||
fv1.ENVIRONMENT_NAMESPACE: f.Spec.Environment.Namespace,
|
||||
}
|
||||
podList, err := a.kubernetesClient.CoreV1().Pods(podNs).List(metav1.ListOptions{
|
||||
podList, err := a.kubernetesClient.CoreV1().Pods(podNs).List(context.TODO(), metav1.ListOptions{
|
||||
LabelSelector: labels.Set(selector).AsSelector().String(),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -346,7 +347,7 @@ func getContainerLog(kubernetesClient *kubernetes.Clientset, w http.ResponseWrit
|
||||
podLogOpts := apiv1.PodLogOptions{Container: container.Name} // Only the env container, not fetcher
|
||||
podLogsReq := kubernetesClient.CoreV1().Pods(pod.Namespace).GetLogs(pod.ObjectMeta.Name, &podLogOpts)
|
||||
|
||||
podLogs, err := podLogsReq.Stream()
|
||||
podLogs, err := podLogsReq.Stream(context.Background())
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "error streaming pod log")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user