Skip to content

Commit

Permalink
update: import ingress from config.openshift.io
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Oct 29, 2024
1 parent 0956087 commit 93d74b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/go-logr/logr"
"github.com/hashicorp/go-multierror"
buildv1 "github.com/openshift/api/build/v1"
configv1 "github.com/openshift/api/config/v1"
imagev1 "github.com/openshift/api/image/v1"
operatorv1 "github.com/openshift/api/operator/v1"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
Expand All @@ -36,7 +37,6 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
k8serr "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/record"
Expand Down Expand Up @@ -539,12 +539,7 @@ func (r *DataScienceClusterReconciler) SetupWithManager(ctx context.Context, mgr
}),

Check warning on line 539 in controllers/datasciencecluster/datasciencecluster_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/datasciencecluster/datasciencecluster_controller.go#L537-L539

Added lines #L537 - L539 were not covered by tests
).
Watches( // ingress
&unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "config.openshift.io/v1",
"kind": "Ingress",
},
},
&configv1.Ingress{},
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, a client.Object) []reconcile.Request {
return r.watchIngressResources(ctx, a)
}),

Check warning on line 545 in controllers/datasciencecluster/datasciencecluster_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/datasciencecluster/datasciencecluster_controller.go#L543-L545

Added lines #L543 - L545 were not covered by tests
Expand Down
10 changes: 4 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
networkingv1 "k8s.io/api/networking/v1"
rbacv1 "k8s.io/api/rbac/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
Expand Down Expand Up @@ -68,7 +67,6 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/secretgenerator"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/webhook"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster/gvk"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/logger"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/upgrade"
)
Expand Down Expand Up @@ -182,13 +180,13 @@ func main() { //nolint:funlen,maintidx
secretCache := createSecretCacheConfig(platform)
deploymentCache := createDeploymentCacheConfig(platform)

uingress := &unstructured.Unstructured{}
uingress.SetGroupVersionKind(gvk.OpenshiftIngress)

cacheOptions := cache.Options{
Scheme: scheme,
ByObject: map[client.Object]cache.ByObject{
uingress: {},
// for Ingress from config.openshift.io/v1
&configv1.Ingress{}: {
Field: fields.Set{"metadata.name": "cluster"}.AsSelector(),
},
// all CRD: mainly for pipeline v1 teckon and v2 argo and dashboard's own CRD
&apiextensionsv1.CustomResourceDefinition{}: {},
// Cannot find a label on various screts, so we need to watch all secrets
Expand Down

0 comments on commit 93d74b1

Please sign in to comment.