Skip to content
Closed
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
15 changes: 10 additions & 5 deletions sharedingress-config-generator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type externalDNSBackendDesc struct {
SVCIP string
SVCPort int32
AllowedCIDRs string

// AllowedEndpoints is list of endpoints seperated by " ".
// Traffic to these endpoints is always allowed and ignores AllowedCIDRs.
AllowedEndpoints string
}

func generateRouterConfig(ctx context.Context, client crclient.Client, w io.Writer) error {
Expand Down Expand Up @@ -158,11 +162,12 @@ func getBackendsForHostedCluster(ctx context.Context, hc hyperv1.HostedCluster,
switch route.Name {
case manifests.KubeAPIServerExternalPublicRoute("").Name:
externalDNSBackends = append(externalDNSBackends, externalDNSBackendDesc{
Name: route.Namespace + "-apiserver",
HostName: route.Spec.Host,
SVCIP: svc.Spec.ClusterIP,
SVCPort: config.KASSVCPort,
AllowedCIDRs: allowedCIDRs})
Name: route.Namespace + "-apiserver",
HostName: route.Spec.Host,
SVCIP: svc.Spec.ClusterIP,
SVCPort: config.KASSVCPort,
AllowedCIDRs: allowedCIDRs,
AllowedEndpoints: "/healthz"}) // always allow /healthz for the CPO KAS health check.
case ignitionserver.Route("").Name:
externalDNSBackends = append(externalDNSBackends, externalDNSBackendDesc{
Name: route.Namespace + "-ignition",
Expand Down
3 changes: 3 additions & 0 deletions sharedingress-config-generator/router_config.template
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ frontend external-dns
acl is_{{ .Name }} req_ssl_sni -i {{ .HostName }}
{{- if .AllowedCIDRs }}
acl is_{{ .Name }}_request_allowed src {{ .AllowedCIDRs }}
{{- if .AllowedEndpoints }}
acl is_{{ .Name }}_request_allowed path_beg -i {{ .AllowedEndpoints }}
{{- end }}
{{- end }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ frontend external-dns
acl is_test-hc2-konnectivity_request_allowed src 1.1.1.1/32 192.168.1.1/24
acl is_test-hc2-apiserver req_ssl_sni -i kube-apiserver-public.example.com
acl is_test-hc2-apiserver_request_allowed src 1.1.1.1/32 192.168.1.1/24
acl is_test-hc2-apiserver_request_allowed path_beg -i /healthz
acl is_test-hc2-oauth req_ssl_sni -i oauth-public.example.com
acl is_test-hc2-oauth_request_allowed src 1.1.1.1/32 192.168.1.1/24
use_backend test-hc1-ignition if is_test-hc1-ignition
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,11 @@ func ensureAPIServerAllowedCIDRs(ctx context.Context, t *testing.T, g Gomega, mg
} else {
g.Expect(err).To(HaveOccurred(), "kube-apiserver should not be reachable")
}

// validate that KAS /healthz endpoint is always reachable
result := guestClient.RESTClient().Get().AbsPath("/healthz").Do(ctx)
g.Expect(result.Error()).ToNot(HaveOccurred())

}).WithContext(ctx).WithTimeout(time.Minute * 3).WithPolling(time.Second * 5).Should(Succeed())

}
Expand Down