-
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 consumer credentials secrets reconciler for API Ke…
…y credentials (#1168)
- Loading branch information
Showing
11 changed files
with
493 additions
and
62 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
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,47 @@ | ||
kind: KonnectAPIAuthConfiguration | ||
apiVersion: konnect.konghq.com/v1alpha1 | ||
metadata: | ||
name: konnect-api-auth-dev-1 | ||
namespace: default | ||
spec: | ||
type: token | ||
token: kpat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
serverURL: us.api.konghq.com | ||
--- | ||
kind: KonnectGatewayControlPlane | ||
apiVersion: konnect.konghq.com/v1alpha1 | ||
metadata: | ||
name: test-cp-key-auth | ||
namespace: default | ||
spec: | ||
name: test-cp-key-auth | ||
labels: | ||
app: test-cp-key-auth | ||
key1: test-cp-key-auth | ||
konnect: | ||
authRef: | ||
name: konnect-api-auth-dev-1 | ||
--- | ||
kind: KongConsumer | ||
apiVersion: configuration.konghq.com/v1 | ||
metadata: | ||
name: consumer1 | ||
namespace: default | ||
username: consumer1 | ||
spec: | ||
controlPlaneRef: | ||
type: konnectNamespacedRef | ||
konnectNamespacedRef: | ||
name: test-cp-key-auth | ||
credentials: | ||
- consumer1-key-auth1 | ||
--- | ||
kind: Secret | ||
apiVersion: v1 | ||
metadata: | ||
name: consumer1-key-auth1 | ||
namespace: default | ||
labels: | ||
konghq.com/credential: key-auth | ||
stringData: | ||
key: key |
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,25 @@ | ||
package konnect | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"github.com/kong/gateway-operator/controller/konnect/constraints" | ||
) | ||
|
||
func kongCredentialReferencesSecret[ | ||
T constraints.SupportedCredentialType, | ||
TEnt constraints.KongCredential[T], | ||
](obj client.Object) []string { | ||
cred, ok := obj.(TEnt) | ||
if !ok { | ||
return nil | ||
} | ||
|
||
var ret []string | ||
for _, or := range cred.GetOwnerReferences() { | ||
if or.Kind == "Secret" { | ||
ret = append(ret, or.Name) | ||
} | ||
} | ||
return ret | ||
} |
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.