fix: resolve missing restrict resources namespace
This commit is contained in:
@@ -2,6 +2,7 @@ package crd
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
"os"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/dynamic"
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type Crd struct {
|
||||
client dynamic.NamespaceableResourceInterface
|
||||
client dynamic.ResourceInterface
|
||||
runtimeClient client.Client
|
||||
}
|
||||
|
||||
@@ -32,12 +33,12 @@ func New() *Crd {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
shema := runtime.NewScheme()
|
||||
v1alpha1.AddKnownTypes(shema)
|
||||
scheme := runtime.NewScheme()
|
||||
v1alpha1.AddKnownTypes(scheme)
|
||||
// Get FlinkJob resource interface
|
||||
flinkJobClient := dynamicClient.Resource(v1alpha1.FlinkJobGVR)
|
||||
flinkJobClient := dynamicClient.Resource(v1alpha1.FlinkJobGVR).Namespace(os.Getenv("NAMESPACE"))
|
||||
runtimeClient, err := client.New(config.GetConfigOrDie(), client.Options{
|
||||
Scheme: shema,
|
||||
Scheme: scheme,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user