Skip to content

Internal cloudendpoint without scheme in domain fails to create. #565

Open
@jtszalay

Description

@jtszalay

Kubernetes Version

Client Version: v1.32.0 Kustomize Version: v5.5.0 Server Version: v1.32.0

Helm Chart Version

Error: unknown flag: --all-namespace 0.16.4

Operator Configuration

error: the server doesn't have a resource type "OperatorConfigurations"

System Info

I'm running k8s on talos.

Kubernetes Logs

james@MacBookPro homelab % kubectl get events --sort-by='.lastTimestamp' -w -n ngrok-operator 
warning: --watch requested, --sort-by will be ignored for watch events received
LAST SEEN   TYPE      REASON                 OBJECT                                                                MESSAGE
6m8s        Normal    Scheduled              pod/ngrok-ingress-controller-ngrok-operator-manager-b548bcb8-pq268    Successfully assigned ngrok-operator/ngrok-ingress-controller-ngrok-operator-manager-b548bcb8-pq268 to talos-worker-01
6m8s        Normal    Scheduled              pod/ngrok-ingress-controller-ngrok-operator-agent-6d56479967-v78lm    Successfully assigned ngrok-operator/ngrok-ingress-controller-ngrok-operator-agent-6d56479967-v78lm to talos-worker-02
20m         Warning   DomainCreationFailed   cloudendpoint/homelab                                                 Failed to create Domain CRD
20m         Warning   CreateError            cloudendpoint/homelab                                                 Failed to Create CloudEndpoint/homelab: Domain.ingress.k8s.ngrok.com "" is invalid: metadata.name: Required value: name or generateName is required

Helm Chart configuration

No response

What happened

james@MacBookPro homelab % kubectl get events --sort-by='.lastTimestamp' -w -n ngrok-operator 
warning: --watch requested, --sort-by will be ignored for watch events received
LAST SEEN   TYPE      REASON                 OBJECT                                                                MESSAGE
6m8s        Normal    Scheduled              pod/ngrok-ingress-controller-ngrok-operator-manager-b548bcb8-pq268    Successfully assigned ngrok-operator/ngrok-ingress-controller-ngrok-operator-manager-b548bcb8-pq268 to talos-worker-01
6m8s        Normal    Scheduled              pod/ngrok-ingress-controller-ngrok-operator-agent-6d56479967-v78lm    Successfully assigned ngrok-operator/ngrok-ingress-controller-ngrok-operator-agent-6d56479967-v78lm to talos-worker-02
20m         Warning   DomainCreationFailed   cloudendpoint/homelab                                                 Failed to create Domain CRD
20m         Warning   CreateError            cloudendpoint/homelab                                                 Failed to Create CloudEndpoint/homelab: Domain.ingress.k8s.ngrok.com "" is invalid: metadata.name: Required value: name or generateName is required

Btw the template for making issues assumes you can run a bunch of commands but they're in the placeholder text so you can't copy paste them.

What you think should happen instead

Not putting a scheme should be fine.

How to reproduce

https://go.dev/play/p/bKC-1-yItRw

func (r *CloudEndpointReconciler) extractDomain(clep *ngrokv1alpha1.CloudEndpoint) string {
parsedURL, err := url.Parse(clep.Spec.URL)
if err != nil {
r.Recorder.Event(clep, v1.EventTypeWarning, "InvalidURL", fmt.Sprintf("Failed to parse URL: %s", clep.Spec.URL))
return ""
}
return parsedURL.Hostname()
}

Apply this:

apiVersion: ngrok.k8s.ngrok.com/v1alpha1
kind: CloudEndpoint
metadata:
name: homelab
namespace: ngrok-operator
spec:
url: homelab.internal
trafficPolicy:
policy:
on_http_request:
- expressions:
- req.host.startsWith('whoami.')
actions:
- type: forward-internal
config:
url: https://whoami.internal
- expressions:
- req.host.startsWith('httpbin.')
actions:
- type: forward-internal
config:
url: https://httpbin.internal

It'll fail. Adding an https:// in front of homelab.internal will make it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/controllerIssues dealing with the controllerbugSomething isn't workingneeds-triageIssues that need triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions