Documentation ¶
Index ¶
- Constants
- func CreateOrUpdate(ctx context.Context, client *k8s.Client, req k8s.Resource, ...) error
- func EnvVarSourceFieldRef(fieldPath string) *corev1.EnvVarSource
- func IntOrStringI(i int32) *intstr.IntOrString
- func IntOrStringS(s string) *intstr.IntOrString
- func IsK8sAlreadyExists(err error) bool
- func IsK8sConflict(err error) bool
- func IsK8sNotFound(err error) bool
- func NewServiceAccountCertificate(saPubPath, saKeyPath string) (string, string, error)
- func RenderToString(log zerolog.Logger, templateData string, options interface{}, ...) (string, error)
- type CA
- func (ca *CA) Cert() string
- func (ca *CA) CreateTLSClientAuthCertificate(commonName, orgName string, client SSHClient, additionalHosts ...string) (string, string, error)
- func (ca *CA) CreateTLSServerCertificate(commonName, orgName string, client SSHClient, additionalHosts ...string) (string, string, error)
- func (ca *CA) Key() string
- type SSHClient
- type TemplateConfigurator
Constants ¶
const ( CertFileMode = os.FileMode(0644) KeyFileMode = os.FileMode(0600) )
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdate ¶
func CreateOrUpdate(ctx context.Context, client *k8s.Client, req k8s.Resource, options ...k8s.Option) error
CreateOrUpdate creates or updates a given resource.
func EnvVarSourceFieldRef ¶
func EnvVarSourceFieldRef(fieldPath string) *corev1.EnvVarSource
EnvVarSourceFieldRef creates a new envvar source with field reference to given field path.
func IntOrStringI ¶
func IntOrStringI(i int32) *intstr.IntOrString
IntOrStringI returns an IntOrString filled with an int.
func IntOrStringS ¶
func IntOrStringS(s string) *intstr.IntOrString
IntOrStringS returns an IntOrString filled with a string.
func IsK8sAlreadyExists ¶
IsK8sAlreadyExists returns true if the given error is or is caused by a kubernetes not-found error.
func IsK8sConflict ¶
IsK8sConflict returns true if the given error is or is caused by a kubernetes conflict error.
func IsK8sNotFound ¶
IsK8sNotFound returns true if the given error is or is caused by a kubernetes not-found error.
func NewServiceAccountCertificate ¶
NewServiceAccountCertificate tries to create a service account certificate pair. Returns cert, key, error
func RenderToString ¶
func RenderToString(log zerolog.Logger, templateData string, options interface{}, config ...TemplateConfigurator) (string, error)
RenderToString renders the given template data using given options to string.
Types ¶
type CA ¶
type CA struct {
// contains filtered or unexported fields
}
CA is a Certificate Authority.
func (*CA) CreateTLSClientAuthCertificate ¶
func (ca *CA) CreateTLSClientAuthCertificate(commonName, orgName string, client SSHClient, additionalHosts ...string) (string, string, error)
CreateTLSClientAuthCertificate creates a TLS client authentication for the given client. Returns certificate, key, error.
type SSHClient ¶
type SSHClient interface { io.Closer GetAddress() string GetHostName() string Run(log zerolog.Logger, command, stdin string, quiet bool) (string, error) // EnsureDirectoryOf checks if the directory of the given file path exists and if not creates it. // If such a path does exist, it checks if it is a directory, if not an error is returned. EnsureDirectoryOf(log zerolog.Logger, filePath string, perm os.FileMode) error // EnsureDirectory checks if a directory with given path exists and if not creates it. // If such a path does exist, it checks if it is a directory, if not an error is returned. EnsureDirectory(log zerolog.Logger, dirPath string, perm os.FileMode) error // UpdateFile compares the given content with the context of the file at the given filePath and // if the content is different, the file is updated. // If the file does not exist, it is created. UpdateFile(log zerolog.Logger, filePath string, content []byte, perm os.FileMode) error // RemoveFile removes the given file. // If no such file exists, the request is ignored. RemoveFile(log zerolog.Logger, filePath string) error // RemoveDirectory removes the given directory with its content. // If no such directory exists, the request is ignored. RemoveDirectory(log zerolog.Logger, dirPath string) error // Render updates the given destinationPath according to the given template and options. Render(log zerolog.Logger, templateData, destinationPath string, options interface{}, destinationFileMode os.FileMode, config ...TemplateConfigurator) error }