Updated store_test & helm chart clusterrole

This commit is contained in:
Thomas Kosiewski 2022-09-27 23:40:15 +02:00
parent 458b702762
commit 6c25133bce
3 changed files with 30 additions and 4 deletions

View File

@ -70,6 +70,11 @@ rules:
resources: ["tcpingresses"]
verbs: ["get","watch","list"]
{{- end }}
{{- if has "traefik-proxy" .Values.sources }}
- apiGroups: ["traefik.containo.us"]
resources: ["ingressroutes", "ingressroutestcps", "ingressroutesudps"]
verbs: ["get","watch","list"]
{{- end }}
{{- if has "openshift-route" .Values.sources }}
- apiGroups: ["route.openshift.io"]
resources: ["routes"]

View File

@ -130,9 +130,24 @@ func (suite *ByNamesTestSuite) TestAllInitialized() {
Version: "v1",
Resource: "virtualservers",
}: "VirtualServersList",
{
Group: "traefik.containo.us",
Version: "v1alpha1",
Resource: "ingressroutes",
}: "IngressRouteList",
{
Group: "traefik.containo.us",
Version: "v1alpha1",
Resource: "ingressroutetcps",
}: "IngressRouteTCPList",
{
Group: "traefik.containo.us",
Version: "v1alpha1",
Resource: "ingressrouteudps",
}: "IngressRouteUDPList",
}), nil)
sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"service", "ingress", "istio-gateway", "contour-httpproxy", "kong-tcpingress", "f5-virtualserver", "fake"}, minimalConfig)
sources, err := ByNames(context.TODO(), mockClientGenerator, []string{"service", "ingress", "istio-gateway", "contour-httpproxy", "kong-tcpingress", "f5-virtualserver", "traefik-proxy", "fake"}, minimalConfig)
suite.NoError(err, "should not generate errors")
suite.Len(sources, 7, "should generate all seven sources")
}
@ -171,9 +186,6 @@ func (suite *ByNamesTestSuite) TestKubeClientFails() {
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"kong-tcpingress"}, minimalConfig)
suite.Error(err, "should return an error if kubernetes client cannot be created")
_, err = ByNames(context.TODO(), mockClientGenerator, []string{"f5-virtualserver"}, minimalConfig)
suite.Error(err, "should return an error if kubernetes client cannot be created")
}
func (suite *ByNamesTestSuite) TestIstioClientFails() {

View File

@ -144,6 +144,7 @@ func (ts *traefikSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, e
return endpoints, nil
}
// ingressRouteEndpoints extracts endpoints from all IngressRoute objects
func (ts *traefikSource) ingressRouteEndpoints() ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint
@ -196,6 +197,8 @@ func (ts *traefikSource) ingressRouteEndpoints() ([]*endpoint.Endpoint, error) {
return endpoints, nil
}
// ingressRouteTCPEndpoints extracts endpoints from all IngressRouteTCP objects
func (ts *traefikSource) ingressRouteTCPEndpoints() ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint
@ -248,6 +251,8 @@ func (ts *traefikSource) ingressRouteTCPEndpoints() ([]*endpoint.Endpoint, error
return endpoints, nil
}
// ingressRouteUDPEndpoints extracts endpoints from all IngressRouteUDP objects
func (ts *traefikSource) ingressRouteUDPEndpoints() ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint
@ -465,6 +470,8 @@ func (ts *traefikSource) endpointsFromIngressRoute(ingressRoute *traefikV1alpha1
return endpoints, nil
}
// endpointsFromIngressRouteTCP extracts the endpoints from a IngressRouteTCP object
func (ts *traefikSource) endpointsFromIngressRouteTCP(ingressRoute *traefikV1alpha1.IngressRouteTCP, targets endpoint.Targets) ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint
@ -491,6 +498,8 @@ func (ts *traefikSource) endpointsFromIngressRouteTCP(ingressRoute *traefikV1alp
return endpoints, nil
}
// endpointsFromIngressRouteUDP extracts the endpoints from a IngressRouteUDP object
func (ts *traefikSource) endpointsFromIngressRouteUDP(ingressRoute *traefikV1alpha1.IngressRouteUDP, targets endpoint.Targets) ([]*endpoint.Endpoint, error) {
var endpoints []*endpoint.Endpoint