Skip to content

Commit

Permalink
Use networking.TrustBundleLabelKey
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Dec 14, 2023
1 parent 268f7d9 commit fe0c4d2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pkg/generator/ingress_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (
"k8s.io/apimachinery/pkg/types"
pkgconfig "knative.dev/net-kourier/pkg/config"
envoy "knative.dev/net-kourier/pkg/envoy/api"
"knative.dev/net-kourier/pkg/reconciler/informerfiltering"
"knative.dev/net-kourier/pkg/reconciler/ingress/config"
"knative.dev/networking/pkg/apis/networking"
"knative.dev/networking/pkg/apis/networking/v1alpha1"
"knative.dev/networking/pkg/certificates"
netconfig "knative.dev/networking/pkg/config"
Expand Down Expand Up @@ -403,9 +403,9 @@ func (translator *IngressTranslator) buildTrustChain(logger *zap.SugaredLogger)
}
}

cms, err := translator.nsConfigmapGetter(informerfiltering.KnativeCABundleLabelKey)
cms, err := translator.nsConfigmapGetter(networking.TrustBundleLabelKey)
if err != nil {
return nil, fmt.Errorf("failed to fetch Configmaps with label: %s in namespace: %s: %w", informerfiltering.KnativeCABundleLabelKey, system.Namespace(), err)
return nil, fmt.Errorf("failed to fetch Configmaps with label: %s in namespace: %s: %w", networking.TrustBundleLabelKey, system.Namespace(), err)
}

newline := []byte("\n")
Expand Down
10 changes: 5 additions & 5 deletions pkg/generator/ingress_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes/fake"
envoy "knative.dev/net-kourier/pkg/envoy/api"
"knative.dev/net-kourier/pkg/reconciler/informerfiltering"
"knative.dev/net-kourier/pkg/reconciler/ingress/config"
"knative.dev/networking/pkg/apis/networking"
"knative.dev/networking/pkg/apis/networking/v1alpha1"
"knative.dev/networking/pkg/certificates"
netconfig "knative.dev/networking/pkg/config"
Expand Down Expand Up @@ -1957,7 +1957,7 @@ func ingHTTP01Challenge(ns, name string, opts ...func(*v1alpha1.Ingress)) *v1alp
}

func getConfigmaps(ctx context.Context, kubeclient *fake.Clientset) ([]*corev1.ConfigMap, error) {
cms, err := kubeclient.CoreV1().ConfigMaps(system.Namespace()).List(ctx, metav1.ListOptions{LabelSelector: informerfiltering.KnativeCABundleLabelKey})
cms, err := kubeclient.CoreV1().ConfigMaps(system.Namespace()).List(ctx, metav1.ListOptions{LabelSelector: networking.TrustBundleLabelKey})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -2026,7 +2026,7 @@ var (
Namespace: "knative-testing",
Name: "valid-ca",
Labels: map[string]string{
informerfiltering.KnativeCABundleLabelKey: "true",
networking.TrustBundleLabelKey: "true",
},
},
Data: map[string]string{
Expand All @@ -2038,7 +2038,7 @@ var (
Namespace: "knative-testing",
Name: "invalid-ca",
Labels: map[string]string{
informerfiltering.KnativeCABundleLabelKey: "true",
networking.TrustBundleLabelKey: "true",
},
},
Data: map[string]string{
Expand All @@ -2050,7 +2050,7 @@ var (
Namespace: "knative-testing",
Name: "partially-valid-ca",
Labels: map[string]string{
informerfiltering.KnativeCABundleLabelKey: "true",
networking.TrustBundleLabelKey: "true",
},
},
Data: map[string]string{
Expand Down
3 changes: 0 additions & 3 deletions pkg/reconciler/informerfiltering/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import (
filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
)

// TODO: rle extract this to pkg
const KnativeCABundleLabelKey = "knative-ca-trust-bundle"

const EnableSecretInformerFilteringByCertUIDEnv = "ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID"

// ShouldFilterByCertificateUID allows to choose whether to apply filtering on certificate related secrets
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (
"knative.dev/net-kourier/pkg/config"
envoy "knative.dev/net-kourier/pkg/envoy/server"
"knative.dev/net-kourier/pkg/generator"
"knative.dev/net-kourier/pkg/reconciler/informerfiltering"
store "knative.dev/net-kourier/pkg/reconciler/ingress/config"
"knative.dev/networking/pkg/apis/networking"
"knative.dev/networking/pkg/apis/networking/v1alpha1"
networkingClientSet "knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1"
knativeclient "knative.dev/networking/pkg/client/injection/client"
Expand Down Expand Up @@ -331,7 +331,7 @@ func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl

nsConfigmapInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: reconciler.ChainFilterFuncs(
reconciler.LabelExistsFilterFunc(informerfiltering.KnativeCABundleLabelKey),
reconciler.LabelExistsFilterFunc(networking.TrustBundleLabelKey),
),
Handler: controller.HandleAll(func(obj interface{}) {
logger.Info("Doing a global resync due to CA bundle Configmap changes")
Expand Down

0 comments on commit fe0c4d2

Please sign in to comment.