Documentation ¶
Overview ¶
Package common holds code needed by multiple commands.
Index ¶
- Constants
- func ConsulLogin(client *api.Client, ...) error
- func GenerateServerCerts(t *testing.T) (string, string, string)
- func Logger(level string) (hclog.Logger, error)
- func ValidateUnprivilegedPort(flagName, flagValue string) error
- func WriteFileWithPerms(outputFile, payload string, mode os.FileMode) error
- func WriteTempFile(t *testing.T, contents string) string
Constants ¶
const ( // ACLReplicationTokenName is the name used for the ACL replication policy and // Kubernetes secret. It is consumed in both the server-acl-init and // create-federation-secret commands and so lives in this common package. ACLReplicationTokenName = "acl-replication" // ACLTokenSecretKey is the key that we store the ACL tokens in when we // create Kubernetes secrets. ACLTokenSecretKey = "token" )
Variables ¶
This section is empty.
Functions ¶
func ConsulLogin ¶ added in v0.26.0
func ConsulLogin(client *api.Client, bearerTokenFile, authMethodName, tokenSinkFile, namespace string, meta map[string]string) error
ConsulLogin issues an ACL().Login to Consul and writes out the token to tokenSinkFile. The logic of this is taken from the `consul login` command.
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 ValidateUnprivilegedPort ¶ added in v0.25.0
ValidateUnprivilegedPort converts flags representing ports into integer and validates that it's in the unprivileged port range.
func WriteFileWithPerms ¶ added in v0.26.0
WriteFileWithPerms will write payload as the contents of the outputFile and set permissions after writing the contents. This function is necessary since using ioutil.WriteFile() alone will create the new file with the requested permissions prior to actually writing the file, so you can't set read-only permissions.
Types ¶
This section is empty.