-
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 DataPlaneClientCertificate reconciler
- Loading branch information
Showing
20 changed files
with
703 additions
and
13 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 |
---|---|---|
|
@@ -30,3 +30,4 @@ packages: | |
KeysSDK: | ||
KeySetsSDK: | ||
SNIsSDK: | ||
DataPlaneClientCertificatesSDK: |
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
57 changes: 57 additions & 0 deletions
57
config/samples/konnect_kongdataplaneclientcertificate.yaml
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,57 @@ | ||
kind: KonnectAPIAuthConfiguration | ||
apiVersion: konnect.konghq.com/v1alpha1 | ||
metadata: | ||
name: konnect-api-auth-dev-1 | ||
namespace: default | ||
spec: | ||
type: token | ||
token: kpat_XXXXXXXXXXXXXXXXXXX | ||
serverURL: us.api.konghq.tech | ||
--- | ||
kind: KonnectGatewayControlPlane | ||
apiVersion: konnect.konghq.com/v1alpha1 | ||
metadata: | ||
name: test1 | ||
namespace: default | ||
spec: | ||
name: test1 | ||
labels: | ||
app: test1 | ||
key1: test1 | ||
konnect: | ||
authRef: | ||
name: konnect-api-auth-dev-1 | ||
--- | ||
kind: KongDataPlaneClientCertificate | ||
apiVersion: configuration.konghq.com/v1alpha1 | ||
metadata: | ||
name: dp-cert-1 | ||
namespace: default | ||
annotations: | ||
konghq.com/tags: "infra" | ||
spec: | ||
controlPlaneRef: | ||
type: konnectNamespacedRef | ||
konnectNamespacedRef: | ||
name: test1 | ||
cert: | | ||
-----BEGIN CERTIFICATE----- | ||
MIIDPTCCAiWgAwIBAgIUcNKAk2icWRJGwZ5QDpdSkkeF5kUwDQYJKoZIhvcNAQEL | ||
BQAwLjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQKDAlLb25nIElu | ||
Yy4wHhcNMjQwOTE5MDkwODEzWhcNMjkwOTE4MDkwODEzWjAuMQswCQYDVQQGEwJV | ||
UzELMAkGA1UECAwCQ0ExEjAQBgNVBAoMCUtvbmcgSW5jLjCCASIwDQYJKoZIhvcN | ||
AQEBBQADggEPADCCAQoCggEBAMvDhLM0vTw0QXmgE+sB6gvKx2PUWzvd2tRZoamH | ||
h4RAxYRjgJsJe6WEeAk0tjWQqwAq0Y2MQioMCC4X+L13kpdtomI+4PKjBozg+iTd | ||
ThyV0oQSVHHWzayUzcSODnGR524H9YxmkXV5ImrXwbEqXwiUESPVtjnf/ZzWS01v | ||
gtbu4x3YW+z8kRoXOTpJHKcEoI90SU9F4yeuQsCtbJHeJZRqPr6Kz84ZuHsZ2MeU | ||
os4j1GdMaH3dSysqFv6o1hJ2+6bsrE/ONiGtBb4+tyhivgf+u+ixQwqIERlEJzhI | ||
z/csoAAnfMBY401j2NNUgPpwx5sTQdCz5aFDmanol5152M8CAwEAAaNTMFEwHQYD | ||
VR0OBBYEFK2qd3oRF37acVvgfDeLakx66ioTMB8GA1UdIwQYMBaAFK2qd3oRF37a | ||
cVvgfDeLakx66ioTMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB | ||
AAuul+rAztaueTpPIM63nrS4bSZsIatCgAQ5Pihm0+rZ+13BJk4K2GxkS+T0qkB5 | ||
34+F3eVhUB4cC+kVkWZrlEzD9BsJwWjnoJK+848znTg+ufTeaOQWslYNqFKjmy2k | ||
K6NE7E6r+JLdNvafJzeDybSTXI1tCzDRWUdj5m+bgruX07B13KIJKrAweCTD1927 | ||
WvvfJYxsg8P7dYD9DPlcuOm22ggAaPPu4P/MsnApiq3kJEI/nSGSsboKyjBO2hcz | ||
VF1CYr6Epfyw/47kwuJLCVHjlTgT4haOChW1S8rZILCLXfb8ukM/g3XVYIeEwzsr | ||
KU74cm8lTFCdxlcXePbMdHc= | ||
-----END CERTIFICATE----- |
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 ( | ||
// IndexFieldKongDataPlaneClientCertificateOnKonnectGatewayControlPlane is the index field for KongDataPlaneCertificate -> KonnectGatewayControlPlane. | ||
IndexFieldKongDataPlaneClientCertificateOnKonnectGatewayControlPlane = "dataPlaneCertificateKonnectGatewayControlPlaneRef" | ||
) | ||
|
||
// IndexOptionsForKongDataPlaneCertificate returns required Index options for KongConsumer reconciler. | ||
func IndexOptionsForKongDataPlaneCertificate() []ReconciliationIndexOption { | ||
return []ReconciliationIndexOption{ | ||
{ | ||
IndexObject: &configurationv1alpha1.KongDataPlaneClientCertificate{}, | ||
IndexField: IndexFieldKongDataPlaneClientCertificateOnKonnectGatewayControlPlane, | ||
ExtractValue: kongDataPlaneCertificateReferencesKonnectGatewayControlPlane, | ||
}, | ||
} | ||
} | ||
|
||
func kongDataPlaneCertificateReferencesKonnectGatewayControlPlane(object client.Object) []string { | ||
dpCert, ok := object.(*configurationv1alpha1.KongDataPlaneClientCertificate) | ||
if !ok { | ||
return nil | ||
} | ||
|
||
return controlPlaneKonnectNamespacedRefAsSlice(dpCert) | ||
} |
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,14 @@ | ||
package ops | ||
|
||
import ( | ||
"context" | ||
|
||
sdkkonnectcomp "github.com/Kong/sdk-konnect-go/models/components" | ||
sdkkonnectops "github.com/Kong/sdk-konnect-go/models/operations" | ||
) | ||
|
||
// DataPlaneClientCertificatesSDK is the interface for the DataPlaneClientCertificatesSDK. | ||
type DataPlaneClientCertificatesSDK interface { | ||
CreateDataplaneCertificate(ctx context.Context, cpID string, dpReq *sdkkonnectcomp.DataPlaneClientCertificateRequest, opts ...sdkkonnectops.Option) (*sdkkonnectops.CreateDataplaneCertificateResponse, error) | ||
DeleteDataplaneCertificate(ctx context.Context, controlPlaneID string, certificateID string, opts ...sdkkonnectops.Option) (*sdkkonnectops.DeleteDataplaneCertificateResponse, error) | ||
} |
190 changes: 190 additions & 0 deletions
190
controller/konnect/ops/kongdataplanecertificate_mock.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.