-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(konnect): add indices for Konnect entities (#707)
* feat(konnect): add indices for Konnect entitites
- Loading branch information
Showing
20 changed files
with
262 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKongCACertificateOnKonnectGatewayControlPlane is the index field for KongCACertificate -> KonnectGatewayControlPlane. | ||
IndexFieldKongCACertificateOnKonnectGatewayControlPlane = "kongCACertificateKonnectGatewayControlPlaneRef" | ||
) | ||
|
||
// IndexOptionsForKongCACertificate returns required Index options for KongCACertificate reconclier. | ||
func IndexOptionsForKongCACertificate() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongCACertificate{}, | ||
IndexField: IndexFieldKongCACertificateOnKonnectGatewayControlPlane, | ||
ExtractValue: konnectGatewayControlPlaneRefFromKongCACertificate, | ||
}, | ||
} | ||
} | ||
|
||
// konnectGatewayControlPlaneRefFromKongCACertificate returns namespace/name of referenced KonnectGatewayControlPlane in KongCACertificate spec. | ||
func konnectGatewayControlPlaneRefFromKongCACertificate(obj client.Object) []string { | ||
cert, ok := obj.(*configurationv1alpha1.KongCACertificate) | ||
if !ok { | ||
return nil | ||
} | ||
return controlPlaneKonnectNamespacedRefAsSlice(cert) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKongCertificateOnKonnectGatewayControlPlane is the index field for KongCertificate -> KonnectGatewayControlPlane. | ||
IndexFieldKongCertificateOnKonnectGatewayControlPlane = "kongCertificateKonnectGatewayControlPlaneRef" | ||
) | ||
|
||
// IndexOptionsForKongCertificate returns required Index options for KongCertificate reconclier. | ||
func IndexOptionsForKongCertificate() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongCertificate{}, | ||
IndexField: IndexFieldKongCertificateOnKonnectGatewayControlPlane, | ||
ExtractValue: konnectGatewayControlPlaneRefFromKongCertificate, | ||
}, | ||
} | ||
} | ||
|
||
// konnectGatewayControlPlaneRefFromKongCertificate returns namespace/name of referenced KonnectGatewayControlPlane in KongCertificate spec. | ||
func konnectGatewayControlPlaneRefFromKongCertificate(obj client.Object) []string { | ||
cert, ok := obj.(*configurationv1alpha1.KongCertificate) | ||
if !ok { | ||
return nil | ||
} | ||
return controlPlaneKonnectNamespacedRefAsSlice(cert) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKongKeySetOnKonnectGatewayControlPlane is the index field for KongKeySet -> KonnectGatewayControlPlane. | ||
IndexFieldKongKeySetOnKonnectGatewayControlPlane = "kongKeySetKonnectGatewayControlPlaneRef" | ||
) | ||
|
||
// IndexOptionsForKongKeySet returns required Index options for KongKeySet reconclier. | ||
func IndexOptionsForKongKeySet() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongKeySet{}, | ||
IndexField: IndexFieldKongKeySetOnKonnectGatewayControlPlane, | ||
ExtractValue: konnectGatewayControlPlaneRefFromKongKeySet, | ||
}, | ||
} | ||
} | ||
|
||
// konnectGatewayControlPlaneRefFromKongKeySet returns namespace/name of referenced KonnectGatewayControlPlane in KongKeySet spec. | ||
func konnectGatewayControlPlaneRefFromKongKeySet(obj client.Object) []string { | ||
keySet, ok := obj.(*configurationv1alpha1.KongKeySet) | ||
if !ok { | ||
return nil | ||
} | ||
return controlPlaneKonnectNamespacedRefAsSlice(keySet) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKongVaultOnKonnectGatewayControlPlane is the index field for KongVault -> KonnectGatewayControlPlane. | ||
IndexFieldKongVaultOnKonnectGatewayControlPlane = "vaultKonnectGatewayControlPlaneRef" | ||
) | ||
|
||
// IndexOptionsForKongVault returns required Index options for KongVault reconciler. | ||
func IndexOptionsForKongVault() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongVault{}, | ||
IndexField: IndexFieldKongVaultOnKonnectGatewayControlPlane, | ||
ExtractValue: kongVaultReferencesKonnectGatewayControlPlane, | ||
}, | ||
} | ||
} | ||
|
||
func kongVaultReferencesKonnectGatewayControlPlane(object client.Object) []string { | ||
vault, ok := object.(*configurationv1alpha1.KongVault) | ||
if !ok { | ||
return nil | ||
} | ||
|
||
return controlPlaneKonnectNamespacedRefAsSlice(vault) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKonnectGatewayControlPlaneOnAPIAuthConfiguration is the index field for KonnectGatewayControlPlane -> APIAuthConfiguration. | ||
IndexFieldKonnectGatewayControlPlaneOnAPIAuthConfiguration = "konnectGatewayControlPlaneAPIAuthConfigurationRef" | ||
) | ||
|
||
// IndexOptionsForKonnectGatewayControlPlane returns required Index options for KonnectGatewayControlPlane reconciler. | ||
func IndexOptionsForKonnectGatewayControlPlane() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &konnectv1alpha1.KonnectGatewayControlPlane{}, | ||
IndexField: IndexFieldKonnectGatewayControlPlaneOnAPIAuthConfiguration, | ||
ExtractValue: konnectGatewayControlPlaneAPIAuthConfigurationRef, | ||
}, | ||
} | ||
} | ||
|
||
func konnectGatewayControlPlaneAPIAuthConfigurationRef(object client.Object) []string { | ||
cp, ok := object.(*konnectv1alpha1.KonnectGatewayControlPlane) | ||
if !ok { | ||
return nil | ||
} | ||
|
||
return []string{cp.Spec.KonnectConfiguration.APIAuthConfigurationRef.Name} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.