-
Notifications
You must be signed in to change notification settings - Fork 16
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 index for KongSNI on referenced certificate name
- Loading branch information
Showing
4 changed files
with
52 additions
and
12 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
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 ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" | ||
) | ||
|
||
const ( | ||
// IndexFieldKongSNIOnCertificateRefNmae is the index field for KongSNI -> Certificate. | ||
IndexFieldKongSNIOnCertificateRefNmae = "kongSNICertificateRefName" | ||
) | ||
|
||
// IndexOptionsForKongSNI returns required Index options for KongSNI reconciler. | ||
func IndexOptionsForKongSNI() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongSNI{}, | ||
IndexField: IndexFieldKongSNIOnCertificateRefNmae, | ||
ExtractValue: kongSNIReferencesCertificate, | ||
}, | ||
} | ||
} | ||
|
||
func kongSNIReferencesCertificate(object client.Object) []string { | ||
sni, ok := object.(*configurationv1alpha1.KongSNI) | ||
if !ok { | ||
return nil | ||
} | ||
return []string{sni.Spec.CertificateRef.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