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

istio: invalid convert result #154

Closed
zirain opened this issue Apr 19, 2024 · 0 comments · Fixed by #155
Closed

istio: invalid convert result #154

zirain opened this issue Apr 19, 2024 · 0 comments · Fixed by #155
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@zirain
Copy link
Contributor

zirain commented Apr 19, 2024

What happened:

try to convert following configuration to istio, but rejected by apiserver

What you expected to happen:

apiserver didn't reject the converted result.

How to reproduce it (as minimally and precisely as possible):

apply following result to cluster:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
spec:
  hosts:
    - "*"
  gateways:
    - httpbin-gateway
  http:
    - match:
        - uri:
            prefix: /get
        - uri:
            regex: ^/status/[0-9]{3}$
      route:
        - destination:
            host: httpbin
            port:
              number: 8080
    - match:
        - uri:
            prefix: /
      route:
        - destination:
            host: httpbin
            port:
              number: 8080

then running:

ingress2gateway print --providers istio | k apply -f -
I0419 16:42:17.535135   38688 converter.go:148] ignoring field: istio.Gateway[httpbin-gateway].Server[0].Port.Name
gateway.gateway.networking.k8s.io/httpbin-gateway configured
Error from server (Invalid): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"gateway.networking.k8s.io/v1\",\"kind\":\"HTTPRoute\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":null,\"name\":\"httpbin-idx-0\",\"namespace\":\"default\"},\"spec\":{\"hostnames\":[\"*\"],\"parentRefs\":[{\"group\":\"gateway.networking.k8s.io\",\"kind\":\"Gateway\",\"name\":\"httpbin-gateway\"}],\"rules\":[{\"backendRefs\":[{\"name\":\"httpbin\",\"namespace\":\"default\",\"port\":8080,\"weight\":0}],\"matches\":[{\"path\":{\"type\":\"PathPrefix\",\"value\":\"/get\"}},{\"path\":{\"type\":\"RegularExpression\",\"value\":\"^/status/[0-9]{3}$\"}}]}]},\"status\":{\"parents\":null}}\n"}},"spec":{"hostnames":["*"],"rules":[{"backendRefs":[{"name":"httpbin","namespace":"default","port":8080,"weight":0}],"matches":[{"path":{"type":"PathPrefix","value":"/get"}},{"path":{"type":"RegularExpression","value":"^/status/[0-9]{3}$"}}]}]}}
to:
Resource: "gateway.networking.k8s.io/v1, Resource=httproutes", GroupVersionKind: "gateway.networking.k8s.io/v1, Kind=HTTPRoute"
Name: "httpbin-idx-0", Namespace: "default"
for: "STDIN": error when patching "STDIN": HTTPRoute.gateway.networking.k8s.io "httpbin-idx-0" is invalid: spec.hostnames[0]: Invalid value: "*": spec.hostnames[0] in body should match '^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'
Error from server (Invalid): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"gateway.networking.k8s.io/v1\",\"kind\":\"HTTPRoute\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":null,\"name\":\"httpbin-idx-1\",\"namespace\":\"default\"},\"spec\":{\"hostnames\":[\"*\"],\"parentRefs\":[{\"group\":\"gateway.networking.k8s.io\",\"kind\":\"Gateway\",\"name\":\"httpbin-gateway\"}],\"rules\":[{\"backendRefs\":[{\"name\":\"httpbin\",\"namespace\":\"default\",\"port\":8080,\"weight\":0}],\"matches\":[{\"path\":{\"type\":\"PathPrefix\",\"value\":\"/\"}}]}]},\"status\":{\"parents\":null}}\n"}},"spec":{"hostnames":["*"],"rules":[{"backendRefs":[{"name":"httpbin","namespace":"default","port":8080,"weight":0}],"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]}}
to:
Resource: "gateway.networking.k8s.io/v1, Resource=httproutes", GroupVersionKind: "gateway.networking.k8s.io/v1, Kind=HTTPRoute"
Name: "httpbin-idx-1", Namespace: "default"
for: "STDIN": error when patching "STDIN": HTTPRoute.gateway.networking.k8s.io "httpbin-idx-1" is invalid: spec.hostnames[0]: Invalid value: "*": spec.hostnames[0] in body should match '^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'

Anything else we need to know?:

@zirain zirain added the kind/bug Categorizes issue or PR as related to a bug. label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant