Skip to content

Commit

Permalink
[release/v1.4.x] chore: bump sdk-konnect-go to 0.1.10 (#894)
Browse files Browse the repository at this point in the history
* chore: bump sdk-konnect-go to 0.1.10

* chore: regenerate and fix erors after bump
  • Loading branch information
pmalek authored Nov 27, 2024
1 parent daa45d7 commit 1863053
Show file tree
Hide file tree
Showing 26 changed files with 133 additions and 148 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ install: manifests kustomize install-gateway-api-crds

KUBERNETES_CONFIGURATION_CRDS_PACKAGE ?= github.com/kong/kubernetes-configuration
KUBERNETES_CONFIGURATION_CRDS_VERSION ?= $(shell go list -m -f '{{ .Version }}' $(KUBERNETES_CONFIGURATION_CRDS_PACKAGE))
KUBERNETES_CONFIGURATION_CRDS_CRDS_LOCAL_PATH = $(shell go env GOPATH)/pkg/mod/$(KUBERNETES_CONFIGURATION_CRDS_PACKAGE)@$(KUBERNETES_CONFIGURATION_CRDS_VERSION)/config/crd
KUBERNETES_CONFIGURATION_CRDS_CRDS_LOCAL_PATH = $(shell go env GOPATH)/pkg/mod/$(KUBERNETES_CONFIGURATION_CRDS_PACKAGE)@$(KUBERNETES_CONFIGURATION_CRDS_VERSION)/config/crd/gateway-operator

# Install kubernetes-configuration CRDs into the K8s cluster specified in ~/.kube/config.
.PHONY: install.kubernetes-configuration-crds
Expand Down
31 changes: 19 additions & 12 deletions config/crd/bases/gateway-operator.konghq.com_konnectextensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,41 +79,48 @@ spec:
- name
type: object
type:
default: kic
description: |-
Type can be one of:
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
required:
- type
type: object
x-kubernetes-validations:
- message: Only konnectID type currently supported as controlPlaneRef.
rule: self.type == 'konnectID'
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: 'self.type == ''konnectNamespacedRef'' ? has(self.konnectNamespacedRef)
: true'
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
? has(self.konnectNamespacedRef) : true'
- message: when type is konnectNamespacedRef, konnectID must not be
set
rule: 'self.type == ''konnectNamespacedRef'' ? !has(self.konnectID)
: true'
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
? !has(self.konnectID) : true'
- message: when type is konnectID, konnectID must be set
rule: 'self.type == ''konnectID'' ? has(self.konnectID) : true'
rule: '(has(self.type) && self.type == ''konnectID'') ? has(self.konnectID)
: true'
- message: when type is konnectID, konnectNamespacedRef must not be
set
rule: 'self.type == ''konnectID'' ? !has(self.konnectNamespacedRef)
rule: '(has(self.type) && self.type == ''konnectID'') ? !has(self.konnectNamespacedRef)
: true'
- message: when type is kic, konnectID must not be set
rule: 'self.type == ''kic'' ? !has(self.konnectID) : true'
rule: '(has(self.type) && self.type == ''kic'') ? !has(self.konnectID)
: true'
- message: when type is kic, konnectNamespacedRef must not be set
rule: 'self.type == ''kic'' ? !has(self.konnectNamespacedRef) :
true'
rule: '(has(self.type) && self.type == ''kic'') ? !has(self.konnectNamespacedRef)
: true'
- message: when type is unset, konnectID must not be set
rule: '!has(self.type) ? !has(self.konnectID) : true'
- message: when type is unset, konnectNamespacedRef must not be set
rule: '!has(self.type) ? !has(self.konnectNamespacedRef) : true'
controlPlaneRegion:
description: ControlPlaneRegion is the region of the Konnect Control
Plane.
Expand Down
4 changes: 2 additions & 2 deletions controller/konnect/ops/ops_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func setGroupMembers(
}
}
return sdkkonnectcomp.Members{
ID: lo.ToPtr(memberCP.GetKonnectID()),
ID: memberCP.GetKonnectID(),
}, nil
})
if err != nil {
Expand Down Expand Up @@ -194,7 +194,7 @@ func setGroupMembers(
type membersByID []sdkkonnectcomp.Members

func (m membersByID) Len() int { return len(m) }
func (m membersByID) Less(i, j int) bool { return *m[i].ID < *m[j].ID }
func (m membersByID) Less(i, j int) bool { return m[i].ID < m[j].ID }
func (m membersByID) Swap(i, j int) { m[i], m[j] = m[j], m[i] }

// getControlPlaneForUID returns the Konnect ID of the Konnect ControlPlane
Expand Down
10 changes: 5 additions & 5 deletions controller/konnect/ops/ops_controlplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestCreateControlPlane(t *testing.T) {
PutControlPlanesIDGroupMemberships(ctx, cpgID, &sdkkonnectcomp.GroupMembership{
Members: []sdkkonnectcomp.Members{
{
ID: lo.ToPtr(cpID),
ID: cpID,
},
},
}).
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestCreateControlPlane(t *testing.T) {
PutControlPlanesIDGroupMemberships(ctx, cpgID, &sdkkonnectcomp.GroupMembership{
Members: []sdkkonnectcomp.Members{
{
ID: lo.ToPtr(cpID),
ID: cpID,
},
},
}).
Expand Down Expand Up @@ -718,7 +718,7 @@ func TestSetGroupMembers(t *testing.T) {
&sdkkonnectcomp.GroupMembership{
Members: []sdkkonnectcomp.Members{
{
ID: lo.ToPtr("cp-12345"),
ID: "cp-12345",
},
},
},
Expand Down Expand Up @@ -823,10 +823,10 @@ func TestSetGroupMembers(t *testing.T) {
&sdkkonnectcomp.GroupMembership{
Members: []sdkkonnectcomp.Members{
{
ID: lo.ToPtr("cp-12345"),
ID: "cp-12345",
},
{
ID: lo.ToPtr("cp-12346"),
ID: "cp-12346",
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/ops/ops_credentialacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func kongCredentialACLToACLWithoutParents(
cred *configurationv1alpha1.KongCredentialACL,
) sdkkonnectcomp.ACLWithoutParents {
return sdkkonnectcomp.ACLWithoutParents{
Group: lo.ToPtr(cred.Spec.Group),
Group: cred.Spec.Group,
Tags: GenerateTagsForObject(cred, cred.Spec.Tags...),
}
}
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/ops/ops_credentialapikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func kongCredentialAPIKeyToKeyAuthWithoutParents(
cred *configurationv1alpha1.KongCredentialAPIKey,
) sdkkonnectcomp.KeyAuthWithoutParents {
return sdkkonnectcomp.KeyAuthWithoutParents{
Key: lo.ToPtr(cred.Spec.Key),
Key: cred.Spec.Key,
Tags: GenerateTagsForObject(cred, cred.Spec.Tags...),
}
}
Expand Down
4 changes: 2 additions & 2 deletions controller/konnect/ops/ops_credentialbasicauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ func kongCredentialBasicAuthToBasicAuthWithoutParents(
cred *configurationv1alpha1.KongCredentialBasicAuth,
) sdkkonnectcomp.BasicAuthWithoutParents {
return sdkkonnectcomp.BasicAuthWithoutParents{
Password: lo.ToPtr(cred.Spec.Password),
Username: lo.ToPtr(cred.Spec.Username),
Password: cred.Spec.Password,
Username: cred.Spec.Username,
Tags: GenerateTagsForObject(cred, cred.Spec.Tags...),
}
}
Expand Down
8 changes: 5 additions & 3 deletions controller/konnect/ops/ops_credentialhmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ func kongCredentialHMACToHMACWithoutParents(
cred *configurationv1alpha1.KongCredentialHMAC,
) sdkkonnectcomp.HMACAuthWithoutParents {
ret := sdkkonnectcomp.HMACAuthWithoutParents{
Username: cred.Spec.Username,
Secret: cred.Spec.Secret,
Tags: GenerateTagsForObject(cred, cred.Spec.Tags...),
Secret: cred.Spec.Secret,
Tags: GenerateTagsForObject(cred, cred.Spec.Tags...),
}
if cred.Spec.Username != nil {
ret.Username = *cred.Spec.Username
}
return ret
}
Expand Down
2 changes: 1 addition & 1 deletion controller/konnect/ops/ops_kongroute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestKongRouteToSDKRouteInput_Tags(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "service-1",
},
},
Expand Down
3 changes: 1 addition & 2 deletions controller/konnect/reconciler_kongplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ func (r *KongPluginReconciler) Reconcile(ctx context.Context, req ctrl.Request)
WithControlPlaneRef(&configurationv1alpha1.ControlPlaneRef{
Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef,
KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{
Namespace: cpNN.Namespace,
Name: cpNN.Name,
Name: cpNN.Name,
},
})

Expand Down
12 changes: 6 additions & 6 deletions controller/konnect/reconciler_kongplugin_combinations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestGetCombinations(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestGetCombinations(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down Expand Up @@ -371,7 +371,7 @@ func TestGetCombinations(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down Expand Up @@ -417,7 +417,7 @@ func TestGetCombinations(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down Expand Up @@ -653,7 +653,7 @@ func TestGroupByControlPlane(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down Expand Up @@ -695,7 +695,7 @@ func TestGroupByControlPlane(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "s1",
},
},
Expand Down
8 changes: 4 additions & 4 deletions controller/konnect/reconciler_serviceref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestHandleServiceRef(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "svc-ok",
},
},
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestHandleServiceRef(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "svc-ok",
},
},
Expand All @@ -196,7 +196,7 @@ func TestHandleServiceRef(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "svc-not-programmed",
},
},
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestHandleServiceRef(t *testing.T) {
Spec: configurationv1alpha1.KongRouteSpec{
ServiceRef: &configurationv1alpha1.ServiceRef{
Type: configurationv1alpha1.ServiceRefNamespacedRef,
NamespacedRef: &configurationv1alpha1.NamespacedServiceRef{
NamespacedRef: &configurationv1alpha1.KongObjectRef{
Name: "svc-with-cp-ref-unprogrammed",
},
},
Expand Down
38 changes: 10 additions & 28 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ It is used to reference a Control Plane entity.

| Field | Description |
| --- | --- |
| `type` _string_ | Type can be one of: - konnectID - konnectNamespacedRef - kic |
| `type` _string_ | Type indicates the type of the control plane being referenced. Allowed values: - konnectID - konnectNamespacedRef - kic<br /><br /> The default is kic, which implies that the Control Plane is KIC. |
| `konnectID` _string_ | KonnectID is the schema for the KonnectID type. This field is required when the Type is konnectID. |
| `konnectNamespacedRef` _[KonnectNamespacedRef](#konnectnamespacedref)_ | KonnectNamespacedRef is a reference to a Konnect Control Plane entity inside the cluster. It contains the name of the Konnect Control Plane. This field is required when the Type is konnectNamespacedRef. |

Expand Down Expand Up @@ -1134,19 +1134,18 @@ _Appears in:_
#### KongObjectRef


KongObjectRef is a reference to another object representing a Kong entity with deterministic type.<br /><br />
TODO: https://github.com/Kong/kubernetes-configuration/issues/96
change other types to use the generic `KongObjectRef` and move it to a common package to prevent possible import cycles.
KongObjectRef is a reference to another object representing a Kong entity with deterministic type.



| Field | Description |
| --- | --- |
| `name` _string_ | Name is the name of the entity.<br /><br /> NOTE: the `Required` validation rule does not reject empty strings so we use `MinLength` to reject empty string here. |
| `name` _string_ | Name is the name of the entity. |


_Appears in:_
- [KongSNISpec](#kongsnispec)
- [ServiceRef](#serviceref)

#### KongPluginBindingSpec

Expand Down Expand Up @@ -1235,7 +1234,7 @@ _Appears in:_
#### KongRouteSpec


KongRouteSpec defines specification of a Kong Route.
KongRouteSpec defines spec of a Kong Route.



Expand Down Expand Up @@ -1284,7 +1283,7 @@ _Appears in:_
#### KongSNIAPISpec


KongSNIAPISpec defines specification of an SNI.
KongSNIAPISpec defines the spec of an SNI.



Expand Down Expand Up @@ -1333,7 +1332,7 @@ _Appears in:_
#### KongServiceAPISpec


KongServiceAPISpec defines specification of a Kong Service.
KongServiceAPISpec defines the specification of a Kong Service.



Expand Down Expand Up @@ -1423,8 +1422,7 @@ _Appears in:_
#### KongTargetSpec


KongTargetSpec defines the specification of a Kong Target.
KongTargetSpec defines the desired state of KongTarget.
KongTargetSpec defines the spec of KongTarget.



Expand Down Expand Up @@ -1490,7 +1488,7 @@ _Appears in:_
#### KongUpstreamSpec


KongUpstreamSpec defines specification of a Kong Upstream.
KongUpstreamSpec defines the spec of Kong Upstream.



Expand Down Expand Up @@ -1600,22 +1598,6 @@ Namespace refers to a Kubernetes namespace. It must be a RFC 1123 label.
_Appears in:_
- [ControllerReference](#controllerreference)

#### NamespacedServiceRef


NamespacedServiceRef is a namespaced reference to a KongService.<br /><br />
NOTE: currently cross namespace references are not supported.



| Field | Description |
| --- | --- |
| `name` _string_ | |


_Appears in:_
- [ServiceRef](#serviceref)

#### ObjectName
_Underlying type:_ `string`

Expand Down Expand Up @@ -1673,7 +1655,7 @@ ServiceRef is a reference to a KongService.
| Field | Description |
| --- | --- |
| `type` _string_ | Type can be one of: - namespacedRef |
| `namespacedRef` _[NamespacedServiceRef](#namespacedserviceref)_ | NamespacedRef is a reference to a KongService. |
| `namespacedRef` _[KongObjectRef](#kongobjectref)_ | NamespacedRef is a reference to a KongService. |


_Appears in:_
Expand Down
Loading

0 comments on commit 1863053

Please sign in to comment.