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

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

Open
jtszalay opened this issue Jan 9, 2025 · 0 comments
Open

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

jtszalay opened this issue Jan 9, 2025 · 0 comments
Labels
area/controller Issues dealing with the controller bug Something isn't working needs-triage Issues that need triage

Comments

@jtszalay
Copy link
Collaborator

jtszalay commented Jan 9, 2025

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.

@jtszalay jtszalay added bug Something isn't working area/controller Issues dealing with the controller needs-triage Issues that need triage labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controller Issues dealing with the controller bug Something isn't working needs-triage Issues that need triage
Projects
None yet
Development

No branches or pull requests

1 participant