Skip to content

Commit dabab73

Browse files
authored
optimize pipline gates (#310)
1 parent cd6ae2c commit dabab73

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/open-policy-agent/gatekeeper/v3 v3.17.1
2929
github.com/orcaman/concurrent-map/v2 v2.0.1
3030
github.com/pkg/errors v0.9.1
31-
github.com/pluralsh/console/go/client v1.22.2
31+
github.com/pluralsh/console/go/client v1.22.3
3232
github.com/pluralsh/controller-reconcile-helper v0.1.0
3333
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34
3434
github.com/pluralsh/polly v0.1.10

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rK
666666
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
667667
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
668668
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
669-
github.com/pluralsh/console/go/client v1.22.2 h1:mOWPel/oZ9vypJvF136/CWIl6P2Rj89uarHvoRJDnHI=
670-
github.com/pluralsh/console/go/client v1.22.2/go.mod h1:lpoWASYsM9keNePS3dpFiEisUHEfObIVlSL3tzpKn8k=
669+
github.com/pluralsh/console/go/client v1.22.3 h1:5CUV4E/EH5G84ZVIIdr4NuUzM92AKUrZBLEh2SjLeEc=
670+
github.com/pluralsh/console/go/client v1.22.3/go.mod h1:lpoWASYsM9keNePS3dpFiEisUHEfObIVlSL3tzpKn8k=
671671
github.com/pluralsh/controller-reconcile-helper v0.1.0 h1:BV3dYZFH5rn8ZvZjtpkACSv/GmLEtRftNQj/Y4ddHEo=
672672
github.com/pluralsh/controller-reconcile-helper v0.1.0/go.mod h1:RxAbvSB4/jkvx616krCdNQXPbpGJXW3J1L3rASxeFOA=
673673
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34 h1:ab2PN+6if/Aq3/sJM0AVdy1SYuMAnq4g20VaKhTm/Bw=

pkg/client/console.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type Client interface {
5555
ParsePipelineGateCR(pgFragment *console.PipelineGateFragment, operatorNamespace string) (*v1alpha1.PipelineGate, error)
5656
GateExists(id string) bool
5757
GetClusterGate(id string) (*console.PipelineGateFragment, error)
58-
GetClusterGates(after *string, first *int64) (*console.PagedClusterGates, error)
58+
GetClusterGates(after *string, first *int64) (*console.PagedClusterGateIDs, error)
5959
UpdateGate(id string, attributes console.GateUpdateAttributes) error
6060
UpsertConstraints(constraints []*console.PolicyConstraintAttributes) (*console.UpsertPolicyConstraints, error)
6161
GetNamespace(id string) (*console.ManagedNamespaceFragment, error)

pkg/client/pipelines.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func (c *client) UpdateGate(id string, attributes console.GateUpdateAttributes)
2222
return err
2323
}
2424

25-
func (c *client) GetClusterGates(after *string, first *int64) (*console.PagedClusterGates, error) {
26-
resp, err := c.consoleClient.PagedClusterGates(c.ctx, after, first, nil, nil)
25+
func (c *client) GetClusterGates(after *string, first *int64) (*console.PagedClusterGateIDs, error) {
26+
resp, err := c.consoleClient.PagedClusterGateIDs(c.ctx, after, first, nil, nil)
2727
if err != nil {
2828
return nil, err
2929
}

pkg/controller/pipelinegates/reconciler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ func (s *GateReconciler) GetPollInterval() time.Duration {
8585
return s.pollInterval
8686
}
8787

88-
func (s *GateReconciler) ListGates(ctx context.Context) *algorithms.Pager[*console.PipelineGateEdgeFragment] {
88+
func (s *GateReconciler) ListGates(ctx context.Context) *algorithms.Pager[*console.PipelineGateIDsEdgeFragment] {
8989
logger := log.FromContext(ctx)
9090
logger.Info("create pipeline gate pager")
91-
fetch := func(page *string, size int64) ([]*console.PipelineGateEdgeFragment, *algorithms.PageInfo, error) {
91+
fetch := func(page *string, size int64) ([]*console.PipelineGateIDsEdgeFragment, *algorithms.PageInfo, error) {
9292
resp, err := s.consoleClient.GetClusterGates(page, &size)
9393
if err != nil {
9494
logger.Error(err, "failed to fetch gates")
@@ -101,7 +101,7 @@ func (s *GateReconciler) ListGates(ctx context.Context) *algorithms.Pager[*conso
101101
}
102102
return resp.PagedClusterGates.Edges, pageInfo, nil
103103
}
104-
return algorithms.NewPager[*console.PipelineGateEdgeFragment](common.DefaultPageSize, fetch)
104+
return algorithms.NewPager[*console.PipelineGateIDsEdgeFragment](common.DefaultPageSize, fetch)
105105
}
106106

107107
func (s *GateReconciler) Poll(ctx context.Context) error {

pkg/test/mocks/Client_mock.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)