load-balancer-and-ingress-services-for-kubernetes icon indicating copy to clipboard operation
load-balancer-and-ingress-services-for-kubernetes copied to clipboard

Go API to create `HostRule` CRD without TLS fails

Open andrew-su opened this issue 8 months ago • 0 comments

Describe the bug

When creating a HostRule resource by consuming AKO as a Go library, the TLS field is required. However the CRD identifies it as optional.

Reproduction steps

  1. Create a HostRule resource which does not explicitly define a TLS section:
desired := &aviv1beta1.HostRule{
	ObjectMeta: metav1.ObjectMeta{
		Name: "app1",
		Labels: map[string]string{
			"app": "gslb",
		},
	},
	Spec: aviv1beta1.HostRuleSpec{
		VirtualHost: aviv1beta1.HostRuleVirtualHost{
			FqdnType:          aviv1beta1.Exact,
			Fqdn:              "app.default.example.com",
			EnableVirtualHost: ptr.To(true),
			Gslb: aviv1beta1.HostRuleGSLB{
				Fqdn: "app.example.com",
			},
		},
	},
}
  1. Apply it using the Go client:
_, err := akoclient.AkoV1beta1().HostRules("my-namespace").Create(ctx, desired, metav1.CreateOptions{})
  1. Client reports that TLS Certificate name can not be empty string.

Expected behavior

The resource is applied successfully.

Additional context

No response

andrew-su avatar May 31 '24 14:05 andrew-su