Documentation ¶
Index ¶
- Constants
- func ControlPlaneSecretDataKeyCertificatePEM(name string) string
- func ControlPlaneSecretDataKeyPrivateKey(name string) string
- func GenerateCertificateAuthorities(ctx context.Context, k8sClusterClient kubernetes.Interface, ...) (map[string]*corev1.Secret, map[string]*Certificate, error)
- func GenerateClusterSecrets(ctx context.Context, k8sClusterClient kubernetes.Interface, ...) (map[string]*corev1.Secret, error)
- func GenerateClusterSecretsWithFunc(ctx context.Context, k8sClusterClient client.Client, ...) (map[string]*corev1.Secret, error)
- func NewBasicAuthInfoData(password string) infodata.InfoData
- func SelfGenerateTLSServerCertificate(name string, dnsNames []string, ips []net.IP) (cert *Certificate, ca *Certificate, dir string, rErr error)
- func UnmarshalBasicAuth(bytes []byte) (infodata.InfoData, error)
- func UnmarshalCert(bytes []byte) (infodata.InfoData, error)
- func UnmarshalPrivateKey(bytes []byte) (infodata.InfoData, error)
- func UnmarshalStaticToken(bytes []byte) (infodata.InfoData, error)
- type BasicAuth
- type BasicAuthInfoData
- type BasicAuthJSONData
- type BasicAuthSecretConfig
- func (s *BasicAuthSecretConfig) Generate() (DataInterface, error)
- func (s *BasicAuthSecretConfig) GenerateBasicAuth() (*BasicAuth, error)
- func (s *BasicAuthSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *BasicAuthSecretConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *BasicAuthSecretConfig) GetName() string
- func (s *BasicAuthSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
- type Certificate
- type CertificateInfoData
- type CertificateJSONData
- type CertificateSecretConfig
- func (s *CertificateSecretConfig) Generate() (DataInterface, error)
- func (s *CertificateSecretConfig) GenerateCertificate() (*Certificate, error)
- func (s *CertificateSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *CertificateSecretConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *CertificateSecretConfig) GetName() string
- func (s *CertificateSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
- type ConfigInterface
- type ControlPlane
- type ControlPlaneSecretConfig
- func (s *ControlPlaneSecretConfig) Generate() (DataInterface, error)
- func (s *ControlPlaneSecretConfig) GenerateControlPlane() (*ControlPlane, error)
- func (s *ControlPlaneSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *ControlPlaneSecretConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *ControlPlaneSecretConfig) GetName() string
- func (s *ControlPlaneSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
- type DataInterface
- type Interface
- type KubeConfigRequest
- type PrivateKeyInfoData
- type PrivateKeyJSONData
- type RSAKeys
- type RSASecretConfig
- func (s *RSASecretConfig) Generate() (DataInterface, error)
- func (s *RSASecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *RSASecretConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *RSASecretConfig) GenerateRSAKeys() (*RSAKeys, error)
- func (s *RSASecretConfig) GetName() string
- func (s *RSASecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
- type Secrets
- type StaticToken
- type StaticTokenInfoData
- type StaticTokenJSONData
- type StaticTokenSecretConfig
- func (s *StaticTokenSecretConfig) Generate() (DataInterface, error)
- func (s *StaticTokenSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *StaticTokenSecretConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *StaticTokenSecretConfig) GenerateStaticToken() (*StaticToken, error)
- func (s *StaticTokenSecretConfig) GetName() string
- func (s *StaticTokenSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
- type Token
- type TokenConfig
- type VPNTLSAuth
- type VPNTLSAuthConfig
- func (s *VPNTLSAuthConfig) Generate() (DataInterface, error)
- func (s *VPNTLSAuthConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
- func (s *VPNTLSAuthConfig) GenerateInfoData() (infodata.InfoData, error)
- func (s *VPNTLSAuthConfig) GetName() string
- func (s *VPNTLSAuthConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
Constants ¶
const ( // BasicAuthFormatNormal indicates that the data map should be rendered the normal way (dedicated keys for // username and password. BasicAuthFormatNormal formatType = "normal" // BasicAuthFormatCSV indicates that the data map should be rendered in the CSV-format. BasicAuthFormatCSV formatType = "csv" // DataKeyCSV is the key in a secret data holding the CSV format of a secret. DataKeyCSV = "basic_auth.csv" // DataKeyUserName is the key in a secret data holding the username. DataKeyUserName = "username" // DataKeyPassword is the key in a secret data holding the password. DataKeyPassword = "password" )
const ( // CACert indicates that the certificate should be a certificate authority. CACert certType = "ca" // ServerCert indicates that the certificate should have the ExtKeyUsageServerAuth usage. ServerCert certType = "server" // ClientCert indicates that the certificate should have the ExtKeyUsageClientAuth usage. ClientCert certType = "client" // ServerClientCert indicates that the certificate should have both the ExtKeyUsageServerAuth and ExtKeyUsageClientAuth usage. ServerClientCert certType = "both" // DataKeyCertificate is the key in a secret data holding the certificate. DataKeyCertificate = "tls.crt" // DataKeyPrivateKey is the key in a secret data holding the private key. DataKeyPrivateKey = "tls.key" // DataKeyCertificateCA is the key in a secret data holding the CA certificate. DataKeyCertificateCA = "ca.crt" // DataKeyPrivateKeyCA is the key in a secret data holding the CA private key. DataKeyPrivateKeyCA = "ca.key" )
const ( // PKCS1 certificate format PKCS1 = iota // PKCS8 certificate format PKCS8 )
const ( // DataKeyRSAPrivateKey is the key in a secret data holding the RSA private key. DataKeyRSAPrivateKey = "id_rsa" // DataKeySSHAuthorizedKeys is the key in a secret data holding the OpenSSH authorized keys. DataKeySSHAuthorizedKeys = "id_rsa.pub" )
const ( // DataKeyStaticTokenCSV is the key in a secret data holding the CSV format of a secret. DataKeyStaticTokenCSV = "static_tokens.csv" // DataKeyUserID is the key in a secret data holding the userID. DataKeyUserID = "userID" // DataKeyGroups is the key in a secret data holding the groups. DataKeyGroups = "groups" // DataKeyToken is the key in a secret data holding the token. DataKeyToken = "token" )
const BasicAuthDataType = infodata.TypeVersion("basicAuth")
BasicAuthDataType is the type used to denote an BasicAuthJSONData structure in the ShootState
const CertificateDataType = infodata.TypeVersion("certificate")
CertificateDataType is the type used to denote an CertificateJSONData structure in the ShootState
const (
// DataKeyKubeconfig is the key in a secret data holding the kubeconfig.
DataKeyKubeconfig = "kubeconfig"
)
const DataKeyVPNTLSAuth = "vpn.tlsauth"
DataKeyVPNTLSAuth is the key in a secret data holding the vpn tlsauth key.
const PrivateKeyDataType = infodata.TypeVersion("privateKey")
PrivateKeyDataType is the type used to denote an PrivateKeyJSONData structure in the ShootState
const StaticTokenDataType = infodata.TypeVersion("staticToken")
StaticTokenDataType is the type used to denote an StaticTokenJSONData structure in the ShootState
const TemporaryDirectoryForSelfGeneratedTLSCertificatesPattern = "self-generated-server-certificates-"
TemporaryDirectoryForSelfGeneratedTLSCertificatesPattern is a constant for the pattern used when creating a temporary directory for self-generated certificates.
Variables ¶
This section is empty.
Functions ¶
func ControlPlaneSecretDataKeyCertificatePEM ¶
ControlPlaneSecretDataKeyCertificatePEM returns the data key inside a Secret of type ControlPlane whose value contains the certificate PEM.
func ControlPlaneSecretDataKeyPrivateKey ¶
ControlPlaneSecretDataKeyPrivateKey returns the data key inside a Secret of type ControlPlane whose value contains the private key PEM.
func GenerateCertificateAuthorities ¶
func GenerateCertificateAuthorities(ctx context.Context, k8sClusterClient kubernetes.Interface, existingSecretsMap map[string]*corev1.Secret, wantedCertificateAuthorities map[string]*CertificateSecretConfig, namespace string) (map[string]*corev1.Secret, map[string]*Certificate, error)
GenerateCertificateAuthorities get a map of wanted certificates and check If they exist in the existingSecretsMap based on the keys in the map. If they exist it get only the certificate from the corresponding existing secret and makes a certificate DataInterface from the existing secret. If there is no existing secret contaning the wanted certificate, we make one certificate and with it we deploy in K8s cluster a secret with that certificate and then return the newly existing secret. The function returns a map of secrets contaning the wanted CA, a map with the wanted CA certificate and an error.
func GenerateClusterSecrets ¶
func GenerateClusterSecrets(ctx context.Context, k8sClusterClient kubernetes.Interface, existingSecretsMap map[string]*corev1.Secret, wantedSecretsList []ConfigInterface, namespace string) (map[string]*corev1.Secret, error)
GenerateClusterSecrets try to deploy in the k8s cluster each secret in the wantedSecretsList. If the secret already exist it jumps to the next one. The function returns a map with all of the successfully deployed wanted secrets plus those already deployed (only from the wantedSecretsList).
func GenerateClusterSecretsWithFunc ¶
func GenerateClusterSecretsWithFunc(ctx context.Context, k8sClusterClient client.Client, existingSecretsMap map[string]*corev1.Secret, wantedSecretsList []ConfigInterface, namespace string, SecretsGeneratorFunc func(s ConfigInterface) (DataInterface, error)) (map[string]*corev1.Secret, error)
GenerateClusterSecretsWithFunc will try to deploy in the k8s cluster each secret in the wantedSecretsList. If the secret already exist it jumps to the next one. The function will used the SecretsGeneratorFunc to create the secret DataInterface from the wantedSecret configs.
func NewBasicAuthInfoData ¶
NewBasicAuthInfoData creates a new BasicAuthInfoData struct with the given password.
func SelfGenerateTLSServerCertificate ¶
func SelfGenerateTLSServerCertificate(name string, dnsNames []string, ips []net.IP) (cert *Certificate, ca *Certificate, dir string, rErr error)
SelfGenerateTLSServerCertificate generates a new CA certificate and signs a server certificate with it. It'll store the generated CA + server certificate bytes into a temporary directory with the default filenames, e.g. `DataKeyCertificateCA`. The function will return the *Certificate object as well as the path of the temporary directory where the certificates are stored.
func UnmarshalBasicAuth ¶
UnmarshalBasicAuth unmarshals an BasicAuthJSONData into a BasicAuthInfoData struct.
func UnmarshalCert ¶
UnmarshalCert unmarshals an CertificateJSONData into a CertificateInfoData.
func UnmarshalPrivateKey ¶
UnmarshalPrivateKey unmarshals an PrivateKeyJSONData into an PrivateKeyInfoData.
Types ¶
type BasicAuth ¶
BasicAuth contains the username, the password, optionally hash of the password and the format for serializing the basic authentication
func LoadBasicAuthFromCSV ¶
LoadBasicAuthFromCSV loads the basic auth username and the password from the given CSV-formatted <data>.
func (*BasicAuth) SecretData ¶
SecretData computes the data map which can be used in a Kubernetes secret.
type BasicAuthInfoData ¶
type BasicAuthInfoData struct {
Password string
}
BasicAuthInfoData holds the password used for basic authentication.
func (*BasicAuthInfoData) Marshal ¶
func (b *BasicAuthInfoData) Marshal() ([]byte, error)
Marshal implements InfoData
func (*BasicAuthInfoData) TypeVersion ¶
func (b *BasicAuthInfoData) TypeVersion() infodata.TypeVersion
TypeVersion implements InfoData
type BasicAuthJSONData ¶
type BasicAuthJSONData struct {
Password string `json:"password"`
}
BasicAuthJSONData is the json representation of BasicAuthInfoData used to store BasicAuth metadata in the ShootState
type BasicAuthSecretConfig ¶
type BasicAuthSecretConfig struct { Name string Format formatType Username string PasswordLength int }
BasicAuthSecretConfig contains the specification for a to-be-generated basic authentication secret.
func (*BasicAuthSecretConfig) Generate ¶
func (s *BasicAuthSecretConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*BasicAuthSecretConfig) GenerateBasicAuth ¶
func (s *BasicAuthSecretConfig) GenerateBasicAuth() (*BasicAuth, error)
GenerateBasicAuth computes a username,password and the hash of the password keypair. It uses "admin" as username and generates a random password of length 32.
func (*BasicAuthSecretConfig) GenerateFromInfoData ¶
func (s *BasicAuthSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInteface
func (*BasicAuthSecretConfig) GenerateInfoData ¶
func (s *BasicAuthSecretConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface.
func (*BasicAuthSecretConfig) GetName ¶
func (s *BasicAuthSecretConfig) GetName() string
GetName returns the name of the secret.
func (*BasicAuthSecretConfig) LoadFromSecretData ¶
func (s *BasicAuthSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader
type Certificate ¶
type Certificate struct { Name string CA *Certificate PrivateKey *rsa.PrivateKey PrivateKeyPEM []byte Certificate *x509.Certificate CertificatePEM []byte }
Certificate contains the private key, and the certificate. It does also contain the CA certificate in case it is no CA. Otherwise, the <CA> field is nil.
func LoadCAFromSecret ¶
func LoadCAFromSecret(ctx context.Context, k8sClient client.Client, namespace, name string) (*corev1.Secret, *Certificate, error)
LoadCAFromSecret loads a CA certificate from an existing Kubernetes secret object. It returns the secret, the Certificate and an error.
func LoadCertificate ¶
func LoadCertificate(name string, privateKeyPEM, certificatePEM []byte) (*Certificate, error)
LoadCertificate takes a byte slice representation of a certificate and the corresponding private key, and returns its de-serialized private key, certificate template and PEM certificate which can be used to sign other x509 certificates.
func (*Certificate) SecretData ¶
func (c *Certificate) SecretData() map[string][]byte
SecretData computes the data map which can be used in a Kubernetes secret.
type CertificateInfoData ¶
CertificateInfoData holds a certificate's private key data and certificate data.
func NewCertificateInfoData ¶
func NewCertificateInfoData(privateKey, certificate []byte) *CertificateInfoData
NewCertificateInfoData creates a new CertificateInfoData struct
func (*CertificateInfoData) Marshal ¶
func (c *CertificateInfoData) Marshal() ([]byte, error)
Marshal implements InfoData
func (*CertificateInfoData) TypeVersion ¶
func (c *CertificateInfoData) TypeVersion() infodata.TypeVersion
TypeVersion implements InfoData
type CertificateJSONData ¶
type CertificateJSONData struct { PrivateKey []byte `json:"privateKey"` Certificate []byte `json:"certificate"` }
CertificateJSONData is the json representation of CertificateInfoData used to store Certificate metadata in the ShootState
type CertificateSecretConfig ¶
type CertificateSecretConfig struct { Name string CommonName string Organization []string DNSNames []string IPAddresses []net.IP CertType certType SigningCA *Certificate PKCS int Validity *time.Duration }
CertificateSecretConfig contains the specification a to-be-generated CA, server, or client certificate. It always contains a 2048-bit RSA private key.
func (*CertificateSecretConfig) Generate ¶
func (s *CertificateSecretConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*CertificateSecretConfig) GenerateCertificate ¶
func (s *CertificateSecretConfig) GenerateCertificate() (*Certificate, error)
GenerateCertificate computes a CA, server, or client certificate based on the configuration.
func (*CertificateSecretConfig) GenerateFromInfoData ¶
func (s *CertificateSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInterface
func (*CertificateSecretConfig) GenerateInfoData ¶
func (s *CertificateSecretConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface
func (*CertificateSecretConfig) GetName ¶
func (s *CertificateSecretConfig) GetName() string
GetName returns the name of the secret.
func (*CertificateSecretConfig) LoadFromSecretData ¶
func (s *CertificateSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader
type ConfigInterface ¶
type ConfigInterface interface { // GetName returns the name of the configuration. GetName() string // Generate generates a secret interface Generate() (DataInterface, error) // GenerateInfoData generates only the InfoData (metadata) which can later be used to generate a secret. GenerateInfoData() (infodata.InfoData, error) // GenerateFromInfoData combines the configuration and the provided InfoData (metadata) and generates a secret. GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error) }
ConfigInterface define functions needed for generating a specific secret.
type ControlPlane ¶
type ControlPlane struct { Name string Certificate *Certificate BasicAuth *BasicAuth Token *Token Kubeconfig []byte }
ControlPlane contains the certificate, and optionally the basic auth. information as well as a Kubeconfig.
func (*ControlPlane) SecretData ¶
func (c *ControlPlane) SecretData() map[string][]byte
SecretData computes the data map which can be used in a Kubernetes secret.
type ControlPlaneSecretConfig ¶
type ControlPlaneSecretConfig struct { *CertificateSecretConfig BasicAuth *BasicAuth Token *Token KubeConfigRequest *KubeConfigRequest }
ControlPlaneSecretConfig is a struct which inherits from CertificateSecretConfig and is extended with a couple of additional properties. A control plane secret will always contain a server/client certificate and optionally a kubeconfig.
func (*ControlPlaneSecretConfig) Generate ¶
func (s *ControlPlaneSecretConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*ControlPlaneSecretConfig) GenerateControlPlane ¶
func (s *ControlPlaneSecretConfig) GenerateControlPlane() (*ControlPlane, error)
GenerateControlPlane computes a secret for a control plane component of the clusters managed by Gardener. It may include a Kubeconfig.
func (*ControlPlaneSecretConfig) GenerateFromInfoData ¶
func (s *ControlPlaneSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInterface
func (*ControlPlaneSecretConfig) GenerateInfoData ¶
func (s *ControlPlaneSecretConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface
func (*ControlPlaneSecretConfig) GetName ¶
func (s *ControlPlaneSecretConfig) GetName() string
GetName returns the name of the secret.
func (*ControlPlaneSecretConfig) LoadFromSecretData ¶
func (s *ControlPlaneSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader
type DataInterface ¶
type DataInterface interface { // SecretData computes the data map which can be used in a Kubernetes secret. SecretData() map[string][]byte }
DataInterface defines functions needed for defining the data map of a Kubernetes secret.
type Interface ¶
type Interface interface { // Deploy generates and deploys the secrets into the given namespace, taking into account existing secrets. Deploy(context.Context, kubernetes.Interface, gardenerkubernetes.Interface, string) (map[string]*corev1.Secret, error) // Delete deletes the secrets from the given namespace. Delete(context.Context, kubernetes.Interface, string) error }
Interface represents a set of secrets that can be deployed and deleted.
type KubeConfigRequest ¶
KubeConfigRequest is a struct which holds information about a Kubeconfig to be generated.
type PrivateKeyInfoData ¶
type PrivateKeyInfoData struct {
PrivateKey []byte
}
PrivateKeyInfoData holds the data of a private key.
func NewPrivateKeyInfoData ¶
func NewPrivateKeyInfoData(privateKey []byte) *PrivateKeyInfoData
NewPrivateKeyInfoData creates a new PrivateKeyInfoData struct
func (*PrivateKeyInfoData) Marshal ¶
func (r *PrivateKeyInfoData) Marshal() ([]byte, error)
Marshal implements InfoData
func (*PrivateKeyInfoData) TypeVersion ¶
func (r *PrivateKeyInfoData) TypeVersion() infodata.TypeVersion
TypeVersion implements InfoData
type PrivateKeyJSONData ¶
type PrivateKeyJSONData struct {
PrivateKey []byte `json:"privateKey"`
}
PrivateKeyJSONData is the json representation of PrivateKeyInfoData used to store private key in the ShootState
type RSAKeys ¶
type RSAKeys struct { Name string PrivateKey *rsa.PrivateKey PublicKey *rsa.PublicKey OpenSSHAuthorizedKey []byte }
RSAKeys contains the private key, the public key, and optionally the OpenSSH-formatted authorized keys file data.
func (*RSAKeys) SecretData ¶
SecretData computes the data map which can be used in a Kubernetes secret.
type RSASecretConfig ¶
RSASecretConfig containing information about the number of bits which should be used for the to-be-created RSA private key.
func (*RSASecretConfig) Generate ¶
func (s *RSASecretConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*RSASecretConfig) GenerateFromInfoData ¶
func (s *RSASecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInterface
func (*RSASecretConfig) GenerateInfoData ¶
func (s *RSASecretConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface.
func (*RSASecretConfig) GenerateRSAKeys ¶
func (s *RSASecretConfig) GenerateRSAKeys() (*RSAKeys, error)
GenerateRSAKeys computes a RSA private key based on the configured number of bits.
func (*RSASecretConfig) GetName ¶
func (s *RSASecretConfig) GetName() string
GetName returns the name of the secret.
func (*RSASecretConfig) LoadFromSecretData ¶
func (s *RSASecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader
type Secrets ¶
type Secrets struct { CertificateSecretConfigs map[string]*CertificateSecretConfig SecretConfigsFunc func(map[string]*Certificate, string) []ConfigInterface }
Secrets represents a set of secrets that can be deployed and deleted.
type StaticToken ¶
StaticToken contains the username, the password, optionally hash of the password and the format for serializing the static token
func LoadStaticTokenFromCSV ¶
func LoadStaticTokenFromCSV(name string, data []byte) (*StaticToken, error)
LoadStaticTokenFromCSV loads the static token data from the given CSV-formatted <data>.
func (*StaticToken) GetTokenForUsername ¶
func (b *StaticToken) GetTokenForUsername(username string) (*Token, error)
GetTokenForUsername returns the token for the given username.
func (*StaticToken) SecretData ¶
func (b *StaticToken) SecretData() map[string][]byte
SecretData computes the data map which can be used in a Kubernetes secret.
type StaticTokenInfoData ¶
StaticTokenInfoData holds an array of TokenInfoData.
func NewStaticTokenInfoData ¶
func NewStaticTokenInfoData(tokens map[string]string) *StaticTokenInfoData
NewStaticTokenInfoData creates a new StaticTokenInfoData with the provided tokens.
func (*StaticTokenInfoData) Append ¶
func (s *StaticTokenInfoData) Append(staticTokenInfoData *StaticTokenInfoData)
Append appends the tokens from the provided StaticTokenInfoData to this StaticTokenInfoData.
func (*StaticTokenInfoData) Marshal ¶
func (s *StaticTokenInfoData) Marshal() ([]byte, error)
Marshal implements InfoData
func (*StaticTokenInfoData) RemoveTokens ¶
func (s *StaticTokenInfoData) RemoveTokens(usernames ...string)
RemoveTokens removes tokens with the provided usernames from this StaticTokenInfoData.
func (*StaticTokenInfoData) TypeVersion ¶
func (s *StaticTokenInfoData) TypeVersion() infodata.TypeVersion
TypeVersion implements InfoData.
type StaticTokenJSONData ¶
StaticTokenJSONData is the json representation of a StaticTokenInfoData
type StaticTokenSecretConfig ¶
type StaticTokenSecretConfig struct { Name string Tokens map[string]TokenConfig }
StaticTokenSecretConfig contains the specification a to-be-generated static token secret.
func (*StaticTokenSecretConfig) Generate ¶
func (s *StaticTokenSecretConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*StaticTokenSecretConfig) GenerateFromInfoData ¶
func (s *StaticTokenSecretConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInterface.
func (*StaticTokenSecretConfig) GenerateInfoData ¶
func (s *StaticTokenSecretConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface.
func (*StaticTokenSecretConfig) GenerateStaticToken ¶
func (s *StaticTokenSecretConfig) GenerateStaticToken() (*StaticToken, error)
GenerateStaticToken computes a random token of length 128.
func (*StaticTokenSecretConfig) GetName ¶
func (s *StaticTokenSecretConfig) GetName() string
GetName returns the name of the secret.
func (*StaticTokenSecretConfig) LoadFromSecretData ¶
func (s *StaticTokenSecretConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader.
type TokenConfig ¶
TokenConfig contains configuration for a token.
type VPNTLSAuth ¶
VPNTLSAuth contains the name and the generated vpn tls authentication key.
func (*VPNTLSAuth) SecretData ¶
func (v *VPNTLSAuth) SecretData() map[string][]byte
SecretData computes the data map which can be used in a Kubernetes secret.
type VPNTLSAuthConfig ¶
VPNTLSAuthConfig contains the specification for a to-be-generated vpn tls authentication secret. The key will be generated by the provided VPNTLSAuthKeyGenerator. By default the openvpn command is used to generate the key if no generator function is specified.
func (*VPNTLSAuthConfig) Generate ¶
func (s *VPNTLSAuthConfig) Generate() (DataInterface, error)
Generate implements ConfigInterface.
func (*VPNTLSAuthConfig) GenerateFromInfoData ¶
func (s *VPNTLSAuthConfig) GenerateFromInfoData(infoData infodata.InfoData) (DataInterface, error)
GenerateFromInfoData implements ConfigInteface
func (*VPNTLSAuthConfig) GenerateInfoData ¶
func (s *VPNTLSAuthConfig) GenerateInfoData() (infodata.InfoData, error)
GenerateInfoData implements ConfigInterface.
func (*VPNTLSAuthConfig) GetName ¶
func (s *VPNTLSAuthConfig) GetName() string
GetName returns the name of the secret.
func (*VPNTLSAuthConfig) LoadFromSecretData ¶
func (s *VPNTLSAuthConfig) LoadFromSecretData(secretData map[string][]byte) (infodata.InfoData, error)
LoadFromSecretData implements infodata.Loader