Skip to content

Commit

Permalink
chore: adopt to changes in sdk-konnect-go and kubernetes-configuration (
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Sep 23, 2024
1 parent 4f9871c commit 450c48a
Show file tree
Hide file tree
Showing 31 changed files with 171 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ packages:
PluginSDK:
UpstreamsSDK:
MeSDK:
CredentialBasicAuthSDK:
KongCredentialBasicAuthSDK:
CACertificatesSDK:
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ spec:
name:
description: Name is the name of the Konnect Control Plane.
type: string
namespace:
description: |-
Namespace is the namespace where the Konnect Control Plane is in.
Currently only cluster scoped resources (KongVault) are allowed to set `konnectNamespacedRef.namespace`.
type: string
required:
- name
type: object
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/role/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ rules:
- apiGroups:
- configuration.konghq.com
resources:
- credentialbasicauths
- ingressclassparameterses
- kongclusterplugins
- kongconsumergroups
- kongconsumers
- kongcredentialbasicauths
- kongcustomentities
- kongingresses
- konglicenses
Expand All @@ -144,10 +144,10 @@ rules:
- apiGroups:
- configuration.konghq.com
resources:
- credentialbasicauths/status
- kongclusterplugins/status
- kongconsumergroups/status
- kongconsumers/status
- kongcredentialbasicauths/status
- kongcustomentities/status
- kongingresses/status
- konglicenses/status
Expand Down
2 changes: 1 addition & 1 deletion config/samples/konnect_kongconsumer_basicauth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
name: test-cp-basic-auth
---
apiVersion: configuration.konghq.com/v1alpha1
kind: CredentialBasicAuth
kind: KongCredentialBasicAuth
metadata:
name: basic-auth-1
namespace: default
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/constraints/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type SupportedKonnectEntityType interface {
configurationv1.KongConsumer |
configurationv1beta1.KongConsumerGroup |
configurationv1alpha1.KongPluginBinding |
configurationv1alpha1.CredentialBasicAuth |
configurationv1alpha1.KongCredentialBasicAuth |
configurationv1alpha1.KongUpstream |
configurationv1alpha1.KongCACertificate
// TODO: add other types
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func ReconciliationIndexOptionsForEntity[
switch any(e).(type) {
case *configurationv1alpha1.KongPluginBinding:
return IndexOptionsForKongPluginBinding()
case *configurationv1alpha1.CredentialBasicAuth:
case *configurationv1alpha1.KongCredentialBasicAuth:
return IndexOptionsForCredentialsBasicAuth()
}
return nil
Expand Down
18 changes: 9 additions & 9 deletions controller/konnect/index_credentials_basicauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ import (
)

const (
// IndexFieldCredentialBasicAuthReferencesKongConsumer is the index name for CredentialBasicAuth -> Consumer.
IndexFieldCredentialBasicAuthReferencesKongConsumer = "kongCredentialsBasicAuthConsumerRef"
// IndexFieldKongCredentialBasicAuthReferencesKongConsumer is the index name for KongCredentialBasicAuth -> Consumer.
IndexFieldKongCredentialBasicAuthReferencesKongConsumer = "kongCredentialsBasicAuthConsumerRef"
)

// IndexOptionsForCredentialsBasicAuth returns required Index options for CredentialBasicAuth.
// IndexOptionsForCredentialsBasicAuth returns required Index options for KongCredentialBasicAuth.
func IndexOptionsForCredentialsBasicAuth() []ReconciliationIndexOption {
return []ReconciliationIndexOption{
{
IndexObject: &configurationv1alpha1.CredentialBasicAuth{},
IndexField: IndexFieldCredentialBasicAuthReferencesKongConsumer,
ExtractValue: kongCredentialBasicAuthReferencesConsumer,
IndexObject: &configurationv1alpha1.KongCredentialBasicAuth{},
IndexField: IndexFieldKongCredentialBasicAuthReferencesKongConsumer,
ExtractValue: kongKongCredentialBasicAuthReferencesConsumer,
},
}
}

// kongCredentialBasicAuthReferencesConsumer returns the name of referenced Consumer.
func kongCredentialBasicAuthReferencesConsumer(obj client.Object) []string {
cred, ok := obj.(*configurationv1alpha1.CredentialBasicAuth)
// kongKongCredentialBasicAuthReferencesConsumer returns the name of referenced Consumer.
func kongKongCredentialBasicAuthReferencesConsumer(obj client.Object) []string {
cred, ok := obj.(*configurationv1alpha1.KongCredentialBasicAuth)
if !ok {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions controller/konnect/ops/credentialbasicauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
sdkkonnectops "github.com/Kong/sdk-konnect-go/models/operations"
)

// CredentialBasicAuthSDK is the interface for the Konnect CredentialBasicAuthSDK.
type CredentialBasicAuthSDK interface {
// KongCredentialBasicAuthSDK is the interface for the Konnect KongCredentialBasicAuthSDK.
type KongCredentialBasicAuthSDK interface {
CreateBasicAuthWithConsumer(ctx context.Context, req sdkkonnectops.CreateBasicAuthWithConsumerRequest, opts ...sdkkonnectops.Option) (*sdkkonnectops.CreateBasicAuthWithConsumerResponse, error)
DeleteBasicAuthWithConsumer(ctx context.Context, request sdkkonnectops.DeleteBasicAuthWithConsumerRequest, opts ...sdkkonnectops.Option) (*sdkkonnectops.DeleteBasicAuthWithConsumerResponse, error)
UpsertBasicAuthWithConsumer(ctx context.Context, request sdkkonnectops.UpsertBasicAuthWithConsumerRequest, opts ...sdkkonnectops.Option) (*sdkkonnectops.UpsertBasicAuthWithConsumerResponse, error)
Expand Down
66 changes: 33 additions & 33 deletions controller/konnect/ops/credentialbasicauth_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 450c48a

Please sign in to comment.