argoutil

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStringMap

func AppendStringMap(src map[string]string, add map[string]string) map[string]string

AppendStringMap will append the map `add` to the given map `src` and return the result.

func CombineImageTag added in v0.0.6

func CombineImageTag(img string, tag string) string

CombineImageTag will return the combined image and tag in the proper format for tags and digests.

func CreateEvent

func CreateEvent(client client.Client, action string, message string, reason string, meta metav1.ObjectMeta) error

CreateEvent will create a new Kubernetes Event with the given action, message, reason and involved uid.

func DefaultAnnotations added in v0.0.15

func DefaultAnnotations(cr *argoprojv1a1.ArgoCD) map[string]string

DefaultAnnotations returns the default set of annotations for child resources of ArgoCD

func DefaultLabels

func DefaultLabels(name string) map[string]string

DefaultLabels returns the default set of labels for controllers.

func DefaultPVCResources

func DefaultPVCResources() corev1.ResourceRequirements

DefaultPVCResources will return the default PVC resources.

func EncodeCertificatePEM added in v0.0.6

func EncodeCertificatePEM(cert *x509.Certificate) []byte

EncodeCertificatePEM encodes the given certificate pem and returns bytes (base64).

func EncodePrivateKeyPEM added in v0.0.6

func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte

EncodePrivateKeyPEM encodes the given private key pem and returns bytes (base64).

func FetchObject

func FetchObject(client client.Client, namespace string, name string, obj runtime.Object) error

FetchObject will retrieve the object with the given namespace and name using the Kubernetes API. The result will be stored in the given object.

func FetchPersistentVolumes

func FetchPersistentVolumes(cli client.Client, labelz map[string]string, volumes *[]corev1.PersistentVolume) error

FetchPersistentVolumes will return the list of PersistentVolumes that match the given labels.

func FetchSecret added in v0.0.6

func FetchSecret(client client.Client, meta metav1.ObjectMeta, name string) (*corev1.Secret, error)

FetchSecret will retrieve the object with the given Name using the provided client. The result will be returned.

func FetchStorageSecretName added in v0.0.6

func FetchStorageSecretName(export *argoprojv1a1.ArgoCDExport) string

FetchStorageSecretName will return the name of the Secret to use for the export process.

func IsObjectFound

func IsObjectFound(client client.Client, namespace string, name string, obj runtime.Object) bool

IsObjectFound will perform a basic check that the given object exists via the Kubernetes API. If an error occurs as part of the check, the function will return false.

func NameWithSuffix added in v0.0.6

func NameWithSuffix(meta metav1.ObjectMeta, suffix string) string

NameWithSuffix will return a string using the Name from the given ObjectMeta with the provded suffix appended. Example: If ObjectMeta.Name is "test" and suffix is "object", the value of "test-object" will be returned.

func NewPersistentVolumeClaim

func NewPersistentVolumeClaim(meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim

NewPersistentVolumeClaim returns a new PersistentVolumeClaim instance for the ObjectMeta resource.

func NewPersistentVolumeClaimWithName

func NewPersistentVolumeClaimWithName(name string, meta metav1.ObjectMeta) *corev1.PersistentVolumeClaim

NewPersistentVolumeClaimWithName returns a new PersistentVolumeClaim instance with the given name.

func NewPrivateKey added in v0.0.6

func NewPrivateKey() (*rsa.PrivateKey, error)

NewPrivateKey returns randomly generated RSA private key.

func NewSecret added in v0.0.6

func NewSecret(meta metav1.ObjectMeta) *corev1.Secret

NewSecret returns a new Secret based on the given metadata.

func NewSecretWithName added in v0.0.6

func NewSecretWithName(meta metav1.ObjectMeta, name string) *corev1.Secret

NewSecretWithName returns a new Secret based on the given metadata with the provided Name.

func NewSecretWithSuffix added in v0.0.6

func NewSecretWithSuffix(meta metav1.ObjectMeta, suffix string) *corev1.Secret

NewSecretWithSuffix returns a new Secret based on the given metadata with the provided suffix on the Name.

func NewSelfSignedCACertificate added in v0.0.6

func NewSelfSignedCACertificate(key *rsa.PrivateKey) (*x509.Certificate, error)

NewSelfSignedCACertificate returns a self-signed CA certificate based on given configuration and private key. The certificate has one-year lease.

func NewSignedCertificate added in v0.0.6

func NewSignedCertificate(cfg *tlsutil.CertConfig, dnsNames []string, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)

NewSignedCertificate signs a certificate using the given private key, CA and returns a signed certificate. The certificate could be used for both client and server auth. The certificate has one-year lease.

func NewTLSSecret added in v0.0.6

func NewTLSSecret(meta metav1.ObjectMeta, suffix string) *corev1.Secret

NewTLSSecret returns a new TLS Secret based on the given metadata with the provided suffix on the Name.

func ParsePEMEncodedCert added in v0.0.6

func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)

ParsePEMEncodedCert parses a certificate from the given pemdata

func ParsePEMEncodedPrivateKey added in v0.0.6

func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)

ParsePEMEncodedPrivateKey parses a private key from given pemdata

func VerifyAPI

func VerifyAPI(group string, version string) (bool, error)

VerifyAPI will verify that the given group/version is present in the cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

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