Documentation
¶
Index ¶
- Constants
- func CmpProtoIgnoreOrder() []cmp.Option
- func GenerateServerCerts(t *testing.T) (string, string, string)
- func MockConnMgrForIPAndPort(t *testing.T, ip string, port int, enableGRPCConn bool) *consul.MockServerConnectionManager
- func ServiceAccountGetResponse(name, ns string) string
- func SetupK8sAuthMethod(t *testing.T, consulClient *api.Client, serviceName, k8sServiceNS string)
- func SetupK8sAuthMethodV2(t *testing.T, consulClient *api.Client, serviceName, k8sServiceNS string)
- func SetupK8sAuthMethodWithNamespaces(t *testing.T, consulClient *api.Client, ...)
- func SetupK8sComponentAuthMethod(t *testing.T, consulClient *api.Client, ...)
- func TokenReviewsResponse(name, ns string) string
- type TestServerClient
Constants ¶
const AuthMethod = "consul-k8s-auth-method"
const ServiceAccountJWTToken = `` /* 1044-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func CmpProtoIgnoreOrder ¶
CmpProtoIgnoreOrder returns a slice of cmp.Option useful for comparing proto messages independent of the order of their repeated fields.
func GenerateServerCerts ¶
GenerateServerCerts generates Consul CA and a server certificate and saves them to temp files. It returns file names in this order: CA certificate, server certificate, and server key.
func MockConnMgrForIPAndPort ¶
func SetupK8sAuthMethod ¶
SetupK8sAuthMethod create a k8s auth method and a binding rule in Consul for the given k8s service and namespace.
func SetupK8sAuthMethodV2 ¶
SetupK8sAuthMethodV2 create a k8s auth method and a binding rule in Consul for the given k8s service and namespace.
func SetupK8sAuthMethodWithNamespaces ¶
func SetupK8sAuthMethodWithNamespaces(t *testing.T, consulClient *api.Client, serviceName, k8sServiceNS, consulNS string, mirrorNS bool, nsPrefix string, useV2 bool)
SetupK8sAuthMethodWithNamespaces creates a k8s auth method and binding rule in Consul for the k8s service name and namespace. It sets up the auth method and the binding rule so that it works with consul namespaces.
func SetupK8sComponentAuthMethod ¶
func SetupK8sComponentAuthMethod(t *testing.T, consulClient *api.Client, serviceAccountName, k8sComponentNS string)
SetupK8sComponentAuthMethod creates a k8s auth method, sample "acl:write" ACL policy, Role and BindingRule that allows a client using serviceAccount's JWT token to call "consul login".
func TokenReviewsResponse ¶
Types ¶
type TestServerClient ¶
type TestServerClient struct { TestServer *testutil.TestServer APIClient *api.Client Cfg *consul.Config Watcher consul.ServerConnectionManager }
func TestServerWithMockConnMgrWatcher ¶
func TestServerWithMockConnMgrWatcher(t *testing.T, callback testutil.ServerConfigCallback) *TestServerClient