Skip to content

Commit ee8fda3

Browse files
authored
Merge pull request #456 from ngrok/ngrok/ryan/migrate-to-phase-based-naming
update traffic policy for phase-based naming
2 parents 3c2d988 + e9d2178 commit ee8fda3

34 files changed

+1383
-439
lines changed

api/ingress/v1alpha1/domain_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
package v1alpha1
2626

2727
import (
28-
"github.com/ngrok/ngrok-api-go/v5"
28+
"github.com/ngrok/ngrok-api-go/v6"
2929
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3030
)
3131

api/ingress/v1alpha1/httpsedge_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ package v1alpha1
2727
import (
2828
"encoding/json"
2929

30-
"github.com/ngrok/ngrok-api-go/v5"
30+
"github.com/ngrok/ngrok-api-go/v6"
3131
"golang.org/x/exp/slices"
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
)
@@ -76,7 +76,7 @@ type HTTPSEdgeRouteSpec struct {
7676
// WebhookVerification is webhook verification configuration to apply to this route
7777
WebhookVerification *EndpointWebhookVerification `json:"webhookVerification,omitempty"`
7878

79-
// raw json policy string that was applied to the ngrok API
79+
// TrafficPolicy is the raw json policy string that was applied to the ngrok API
8080
// +kubebuilder:validation:Schemaless
8181
// +kubebuilder:pruning:PreserveUnknownFields
8282
// +kubebuilder:validation:Type=object

api/ingress/v1alpha1/httpsedge_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package v1alpha1
33
import (
44
"testing"
55

6-
"github.com/ngrok/ngrok-api-go/v5"
6+
"github.com/ngrok/ngrok-api-go/v6"
77
)
88

99
func TestHTTPSEdgeEqual(t *testing.T) {

api/ingress/v1alpha1/ngrok_common.go

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package v1alpha1
33
import (
44
"encoding/json"
55

6-
"github.com/ngrok/ngrok-api-go/v5"
6+
"github.com/ngrok/ngrok-api-go/v6"
77
"k8s.io/apimachinery/pkg/api/resource"
88
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
)
@@ -488,61 +488,3 @@ type EndpointAction struct {
488488
// +kubebuilder:validation:Type=object
489489
Config json.RawMessage `json:"config,omitempty"`
490490
}
491-
492-
func (policy *EndpointPolicy) ToNgrok() *ngrok.EndpointPolicy {
493-
if policy == nil {
494-
return nil
495-
}
496-
497-
var inbound []ngrok.EndpointRule
498-
for _, rule := range policy.Inbound {
499-
p := rule
500-
inbound = append(inbound, *p.ToNgrok())
501-
}
502-
var outbound []ngrok.EndpointRule
503-
for _, rule := range policy.Outbound {
504-
p := rule
505-
mod := p.ToNgrok()
506-
if mod != nil {
507-
outbound = append(outbound, *mod)
508-
}
509-
}
510-
511-
return &ngrok.EndpointPolicy{
512-
Enabled: policy.Enabled,
513-
Inbound: inbound,
514-
Outbound: outbound,
515-
}
516-
}
517-
518-
func (rule *EndpointRule) ToNgrok() *ngrok.EndpointRule {
519-
if rule == nil {
520-
return nil
521-
}
522-
523-
var actions []ngrok.EndpointAction
524-
for _, action := range rule.Actions {
525-
a := action
526-
mod := a.ToNgrok()
527-
if mod != nil {
528-
actions = append(actions, *mod)
529-
}
530-
}
531-
532-
return &ngrok.EndpointRule{
533-
Expressions: rule.Expressions,
534-
Actions: actions,
535-
Name: rule.Name,
536-
}
537-
}
538-
539-
func (action *EndpointAction) ToNgrok() *ngrok.EndpointAction {
540-
if action == nil {
541-
return nil
542-
}
543-
544-
return &ngrok.EndpointAction{
545-
Type: action.Type,
546-
Config: action.Config,
547-
}
548-
}

api/ingress/v1alpha1/ngrokmoduleset_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type NgrokModuleSetModules struct {
3939
IPRestriction *EndpointIPPolicy `json:"ipRestriction,omitempty"`
4040
// OAuth configuration for this module set
4141
OAuth *EndpointOAuth `json:"oauth,omitempty"`
42-
// Policy configuration for this module set
42+
// Policy module is deprecated, use the `NgrokTrafficPolicy` CRD or the Gateway API instead
4343
Policy *EndpointPolicy `json:"policy,omitempty"`
4444
// OIDC configuration for this module set
4545
OIDC *EndpointOIDC `json:"oidc,omitempty"`

api/ingress/v1alpha1/tcpedge_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type TCPEdgeSpec struct {
4545
// IPRestriction is an IPRestriction to apply to this edge
4646
IPRestriction *EndpointIPPolicy `json:"ipRestriction,omitempty"`
4747

48-
// raw json policy string that was applied to the ngrok API
48+
// Policy is the raw json policy string that was applied to the ngrok API
4949
// +kubebuilder:validation:Schemaless
5050
// +kubebuilder:pruning:PreserveUnknownFields
5151
// +kubebuilder:validation:Type=object

api/ingress/v1alpha1/tlsedge_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type TLSEdgeSpec struct {
5353

5454
MutualTLS *EndpointMutualTLS `json:"mutualTls,omitempty"`
5555

56-
// raw json policy string that was applied to the ngrok API
56+
// Policy is the raw json policy string that was applied to the ngrok API
5757
// +kubebuilder:validation:Schemaless
5858
// +kubebuilder:pruning:PreserveUnknownFields
5959
// +kubebuilder:validation:Type=object

cmd/api/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import (
4747
"sigs.k8s.io/controller-runtime/pkg/webhook"
4848
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
4949

50-
"github.com/ngrok/ngrok-api-go/v5"
50+
"github.com/ngrok/ngrok-api-go/v6"
5151

5252
bindingsv1alpha1 "github.com/ngrok/ngrok-operator/api/bindings/v1alpha1"
5353
ingressv1alpha1 "github.com/ngrok/ngrok-operator/api/ingress/v1alpha1"

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/golang/mock v1.4.4
99
github.com/google/uuid v1.3.1
1010
github.com/imdario/mergo v0.3.16
11-
github.com/ngrok/ngrok-api-go/v5 v5.4.1
1211
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241025160627-dcdb6f5b23f8
1312
github.com/onsi/ginkgo/v2 v2.14.0
1413
github.com/onsi/gomega v1.30.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
416416
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
417417
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
418418
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
419-
github.com/ngrok/ngrok-api-go/v5 v5.4.1 h1:rjofyT5M4pi3PtobyNy+3RMhq2uUaKuqsP34IwXRE28=
420-
github.com/ngrok/ngrok-api-go/v5 v5.4.1/go.mod h1:UVTaHI5B4gEsfHCOZTlRg8WkT6+KBijIkVtjpDqCyIU=
421419
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241025160627-dcdb6f5b23f8 h1:HHfIX3/eXsnxwSxXpLJFSUO5sXWwxdNIkWVMsQd5f7o=
422420
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241025160627-dcdb6f5b23f8/go.mod h1:KtRxWqEomaHZfgeS+q/7nFHF+gPYFghS5wTl5AIUjIk=
423421
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=

0 commit comments

Comments
 (0)