secret

package
v1.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToNamespace

func CopyToNamespace(ns string, oSecrets ...*corev1.Secret) []*corev1.Secret

CopyToNamespace returns a new list of secrets generated from the ones given but with the namespace changed to the given one.

func CreateTLSSecret

func CreateTLSSecret(
	ca *crypto.CA,
	secretName, secretNamespace, secretKeyName, secretCertName string,
	dur time.Duration,
	cef []crypto.CertificateExtensionFunc,
	hostnames ...string,
) (*corev1.Secret, error)

CreateTLSSecret Creates a new TLS secret with the information passed

ca: The ca to use for creating the Cert/Key pair. This is required.
secretName: The name of the secret.
secretKeyName: The name of the data field that will contain the key.
secretCertName: The name of the data field that will contain the cert.
dur: How long the certificate will be valid.
hostnames: The first will be used as the CN, and the rest as SANs. If
  no hostnames are provided then "localhost" will be used.

The first hostname provided is used as the common name for the certificate. If hostnames are not provided, localhost is used. This code came from: https://github.com/openshift/library-go/blob/84f02c4b7d6ab9d67f63b13586693600051de401/pkg/controller/controllercmd/cmd.go#L153

func GetEnvVarSource

func GetEnvVarSource(secretName, key string, optional bool) *corev1.EnvVarSource

GetEnvVarSource returns an EnvVarSource using the given secret name and key.

func GetReferenceList

func GetReferenceList(secrets []*corev1.Secret) []corev1.LocalObjectReference

GetReferenceList retrieves the object references from the secrets and returns that list.

func ToRuntimeObjects

func ToRuntimeObjects(secrets ...*corev1.Secret) []client.Object

ToRuntimeObjects converts the given list of secrets to a list of client.Objects

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL