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
@@ -18,6 +18,7 @@ package kubewatcher
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -162,13 +163,13 @@ func createKubernetesWatch(kubeClient *kubernetes.Clientset, w *fv1.KubernetesWa
|
||||
// TODO handle the full list of types
|
||||
switch strings.ToUpper(w.Spec.Type) {
|
||||
case "POD":
|
||||
wi, err = kubeClient.CoreV1().Pods(w.Spec.Namespace).Watch(listOptions)
|
||||
wi, err = kubeClient.CoreV1().Pods(w.Spec.Namespace).Watch(context.TODO(), listOptions)
|
||||
case "SERVICE":
|
||||
wi, err = kubeClient.CoreV1().Services(w.Spec.Namespace).Watch(listOptions)
|
||||
wi, err = kubeClient.CoreV1().Services(w.Spec.Namespace).Watch(context.TODO(), listOptions)
|
||||
case "REPLICATIONCONTROLLER":
|
||||
wi, err = kubeClient.CoreV1().ReplicationControllers(w.Spec.Namespace).Watch(listOptions)
|
||||
wi, err = kubeClient.CoreV1().ReplicationControllers(w.Spec.Namespace).Watch(context.TODO(), listOptions)
|
||||
case "JOB":
|
||||
wi, err = kubeClient.BatchV1().Jobs(w.Spec.Namespace).Watch(listOptions)
|
||||
wi, err = kubeClient.BatchV1().Jobs(w.Spec.Namespace).Watch(context.TODO(), listOptions)
|
||||
default:
|
||||
err = errors.NewBadRequest(fmt.Sprintf("Error: unknown obj type '%v'", w.Spec.Type))
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package kubewatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -46,7 +47,7 @@ func MakeWatchSync(logger *zap.Logger, client *crd.FissionClient, kubeWatcher *K
|
||||
func (ws *WatchSync) syncSvc() {
|
||||
// TODO watch instead of polling
|
||||
for {
|
||||
watches, err := ws.client.CoreV1().KubernetesWatchTriggers(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
watches, err := ws.client.CoreV1().KubernetesWatchTriggers(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
|
||||
if err != nil {
|
||||
ws.logger.Fatal("failed to get Kubernetes watch trigger list", zap.Error(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user