Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove binding name #567

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/bindings/v1alpha1/boundendpoint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SOFTWARE.
package v1alpha1

import (
v6 "github.com/ngrok/ngrok-api-go/v6"
v6 "github.com/ngrok/ngrok-api-go/v7"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion api/ingress/v1alpha1/domain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package v1alpha1
import (
"strings"

"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion api/ingress/v1alpha1/httpsedge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package v1alpha1
import (
"encoding/json"

"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
"golang.org/x/exp/slices"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion api/ingress/v1alpha1/httpsedge_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1alpha1
import (
"testing"

"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
)

func TestHTTPSEdgeEqual(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion api/ingress/v1alpha1/ngrok_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1alpha1
import (
"encoding/json"

"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
"k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
5 changes: 0 additions & 5 deletions api/ngrok/v1alpha1/kubernetesoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ type KubernetesOperatorDeployment struct {
}

type KubernetesOperatorBinding struct {
// Name is the name of the k8s-binding for the account to bind to this configuration and the ngrok API
// +kubebuilder:validation:Required
// +kubebuilder:validation:Pattern=`^k8s[/][a-zA-Z0-9-]{1,63}$`
Name string `json:"name,omitempty"`

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't leave this field in here but mark it as deprecated and change the validation to optional. The only thing I'm worried about if we remove it right now is if someone deploys this change and then rolls back to a previous version, what happens?

If there aren't a lot of users using bindings right now, I think its a lower risk change.

Copy link
Member Author

@masonj5n masonj5n Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're breaking the API on the hosted side bindings won't work with this field anyway so I don't think it matters too much. Whenever we cut a release with these and a couple other upcoming changes that'll be the first release that works with bindings going forward

// AllowedURLs is a list of URI patterns ([scheme://]<service-name>.<namespace-name>) thet determine which BoundEndpoints are allowed to be created by the operator
// You may specify a wildcard for:
// - All endpoints: `*`
Expand Down
7 changes: 2 additions & 5 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"

"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v6/api_keys"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-api-go/v7/api_keys"

bindingsv1alpha1 "github.com/ngrok/ngrok-operator/api/bindings/v1alpha1"
common "github.com/ngrok/ngrok-operator/api/common/v1alpha1"
Expand Down Expand Up @@ -121,7 +121,6 @@ type managerOpts struct {

bindings struct {
allowedURLs []string
name string
serviceAnnotations string
serviceLabels string
ingressEndpoint string
Expand Down Expand Up @@ -165,7 +164,6 @@ func cmd() *cobra.Command {
c.Flags().BoolVar(&opts.enableFeatureGateway, "enable-feature-gateway", false, "Enables the Gateway controller")
c.Flags().BoolVar(&opts.enableFeatureBindings, "enable-feature-bindings", false, "Enables the Endpoint Bindings controller")
c.Flags().StringSliceVar(&opts.bindings.allowedURLs, "bindings-allowed-urls", []string{"*"}, "Allowed URLs for Endpoint Bindings")
c.Flags().StringVar(&opts.bindings.name, "bindings-name", "default", "Name of the Endpoint Binding Configuration")
c.Flags().StringVar(&opts.bindings.serviceAnnotations, "bindings-service-annotations", "", "Service Annotations to propagate to the target service")
c.Flags().StringVar(&opts.bindings.serviceLabels, "bindings-service-labels", "", "Service Labels to propagate to the target service")
c.Flags().StringVar(&opts.bindings.ingressEndpoint, "bindings-ingress-endpoint", "", "The endpoint the bindings forwarder connects to")
Expand Down Expand Up @@ -671,7 +669,6 @@ func createKubernetesOperator(ctx context.Context, client client.Client, opts ma
if opts.enableFeatureBindings {
features = append(features, ngrokv1alpha1.KubernetesOperatorFeatureBindings)
k8sOperator.Spec.Binding = &ngrokv1alpha1.KubernetesOperatorBinding{
Name: opts.bindings.name,
TlsSecretName: "ngrok-operator-default-tls",
AllowedURLs: opts.bindings.allowedURLs,
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/mock v1.4.4
github.com/google/uuid v1.3.1
github.com/imdario/mergo v0.3.16
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241219193420-f4e8c117e57f
github.com/ngrok/ngrok-api-go/v7 v7.1.0
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/spf13/cobra v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241219193420-f4e8c117e57f h1:+0NOrD1yO/psIunSg6Ea+PQXej8TWWNG5yKryppU/DI=
github.com/ngrok/ngrok-api-go/v6 v6.1.1-0.20241219193420-f4e8c117e57f/go.mod h1:KtRxWqEomaHZfgeS+q/7nFHF+gPYFghS5wTl5AIUjIk=
github.com/ngrok/ngrok-api-go/v7 v7.1.0 h1:iZiIEaI3OwBrr6Y2Kj43/qBtG037sdJsprpTTcJ4p1g=
github.com/ngrok/ngrok-api-go/v7 v7.1.0/go.mod h1:nq/6DWucmk9utTfPGrx7VvhrQQFpO5IOzSPtRE/MCAc=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
1 change: 0 additions & 1 deletion helm/ngrok-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ To uninstall the chart:
| Name | Description | Value |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bindings.enabled` | Whether to enable the Endpoint Bindings feature | `false` |
| `bindings.name` | Unique name of this kubernetes binding in your ngrok account | `""` |
| `bindings.description` | Description of this kubernetes binding in your ngrok account | `Created by ngrok-operator` |
| `bindings.allowedURLs` | List of allowed endpoint URL formats that this binding will project into the cluster | `["*"]` |
| `bindings.serviceAnnotations` | Annotations to add to projected services bound to an endpoint | `{}` |
Expand Down
1 change: 0 additions & 1 deletion helm/ngrok-operator/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ spec:
- --one-click-demo-mode
{{- end }}
{{- if .Values.bindings.enabled }}
- --bindings-name={{ .Values.bindings.name }}
- --bindings-allowed-urls={{ join "," .Values.bindings.allowedURLs }}
{{- if .Values.bindings.serviceAnnotations }}
- --bindings-service-annotations={{- $serviceAnnotations := list -}}
Expand Down

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

5 changes: 0 additions & 5 deletions helm/ngrok-operator/values.schema.json

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

2 changes: 0 additions & 2 deletions helm/ngrok-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ gateway:
## @section Kubernetes Bindings feature configuration
##
## @param bindings.enabled Whether to enable the Endpoint Bindings feature
## @param bindings.name Unique name of this kubernetes binding in your ngrok account
## @param bindings.description Description of this kubernetes binding in your ngrok account
## @param bindings.allowedURLs List of allowed endpoint URL formats that this binding will project into the cluster
## @param bindings.serviceAnnotations Annotations to add to projected services bound to an endpoint
Expand All @@ -296,7 +295,6 @@ gateway:
##
bindings:
enabled: false # in-development
name: ""
description: "Created by ngrok-operator"
allowedURLs:
- "*"
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/base_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/go-logr/logr"
"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-operator/internal/util"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/record"
Expand Down
5 changes: 2 additions & 3 deletions internal/controller/bindings/boundendpoint_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

"github.com/go-logr/logr"
"github.com/google/uuid"
"github.com/ngrok/ngrok-api-go/v6"
v6 "github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v7"
bindingsv1alpha1 "github.com/ngrok/ngrok-operator/api/bindings/v1alpha1"
ngrokv1alpha1 "github.com/ngrok/ngrok-operator/api/ngrok/v1alpha1"
"github.com/ngrok/ngrok-operator/internal/ngrokapi"
Expand Down Expand Up @@ -193,7 +192,7 @@
}

// Fetch the mock endpoint data from the API
var apiBindingEndpoints []v6.Endpoint
var apiBindingEndpoints []ngrok.Endpoint

Check warning on line 195 in internal/controller/bindings/boundendpoint_poller.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/bindings/boundendpoint_poller.go#L195

Added line #L195 was not covered by tests
iter := r.NgrokClientset.KubernetesOperators().GetBoundEndpoints(r.koId, &ngrok.Paging{})
for iter.Next(ctx) {
item := iter.Item()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/go-logr/logr"
v6 "github.com/ngrok/ngrok-api-go/v6"
v6 "github.com/ngrok/ngrok-api-go/v7"
bindingsv1alpha1 "github.com/ngrok/ngrok-operator/api/bindings/v1alpha1"
"github.com/ngrok/ngrok-operator/internal/ngrokapi"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/ingress/domain_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/go-logr/logr"
"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v6/reserved_domains"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-api-go/v7/reserved_domains"
ingressv1alpha1 "github.com/ngrok/ngrok-operator/api/ingress/v1alpha1"
"github.com/ngrok/ngrok-operator/internal/controller"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/ingress/httpsedge_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/go-logr/logr"
"github.com/ngrok/ngrok-api-go/v6"
"github.com/ngrok/ngrok-api-go/v6/backends/tunnel_group"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-api-go/v7/backends/tunnel_group"
ingressv1alpha1 "github.com/ngrok/ngrok-operator/api/ingress/v1alpha1"
"github.com/ngrok/ngrok-operator/internal/controller"
ierr "github.com/ngrok/ngrok-operator/internal/errors"
Expand Down
Loading
Loading