-
Notifications
You must be signed in to change notification settings - Fork 14
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 entitites
- Loading branch information
Showing
18 changed files
with
217 additions
and
266 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,31 @@ | ||
package konnect | ||
|
||
import ( | ||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
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
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.