Skip to content

Commit

Permalink
update CRDS and reorganize code in api gateway type
Browse files Browse the repository at this point in the history
  • Loading branch information
jm96441n committed Feb 8, 2024
1 parent cbc14c4 commit 6f44ddb
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
3 changes: 0 additions & 3 deletions charts/consul/templates/crd-apigateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,6 @@ spec:
format: date-time
type: string
type: object
required:
- addresses
- listeners
type: object
type: object
served: true
Expand Down
32 changes: 16 additions & 16 deletions control-plane/api/mesh/v2beta1/api_gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,8 @@ type APIGateway struct {

type APIGatewayStatus struct {
Status `json:"status,omitempty"`
Addresses []GatewayAddress `json:"addresses"`
Listeners []ListenerStatus `json:"listeners"`
}

func (in *APIGatewayList) ReconcileRequests() []reconcile.Request {
requests := make([]reconcile.Request, 0, len(in.Items))

for _, item := range in.Items {
requests = append(requests, reconcile.Request{
NamespacedName: types.NamespacedName{
Name: item.Name,
Namespace: item.Namespace,
},
})
}
return requests
Addresses []GatewayAddress `json:"addresses,omitempty"`
Listeners []ListenerStatus `json:"listeners,omitempty"`
}

type ListenerStatus struct {
Expand All @@ -85,6 +71,20 @@ type APIGatewayList struct {
Items []*APIGateway `json:"items"`
}

func (in *APIGatewayList) ReconcileRequests() []reconcile.Request {
requests := make([]reconcile.Request, 0, len(in.Items))

for _, item := range in.Items {
requests = append(requests, reconcile.Request{
NamespacedName: types.NamespacedName{
Name: item.Name,
Namespace: item.Namespace,
},
})
}
return requests
}

func (in *APIGateway) ResourceID(namespace, partition string) *pbresource.ID {
return &pbresource.ID{
Name: in.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ spec:
format: date-time
type: string
type: object
required:
- addresses
- listeners
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (r *APIGatewayController) Reconcile(ctx context.Context, req ctrl.Request)
gcc: gcc,
gatewayConfig: r.GatewayConfig,
}, resource); err != nil {
logger.Error(err, "unable to create/update gateway")
return ctrl.Result{}, err
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package resources

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package resources

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package resources

import (
Expand Down

0 comments on commit 6f44ddb

Please sign in to comment.