argoutil

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotationsForCluster

func AnnotationsForCluster(cr *argoproj.ArgoCD) map[string]string

annotationsForCluster returns the annotations for all cluster resources.

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

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, eventType, action, message, reason string, objectMeta metav1.ObjectMeta, typeMeta metav1.TypeMeta) error

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

func CreateSecret added in v0.13.0

func CreateSecret(client client.Client, name string, namespace string, data map[string][]byte) error

func CreateTLSSecret added in v0.13.0

func CreateTLSSecret(client client.Client, name string, namespace string, data map[string][]byte) error

func DefaultPVCResources

func DefaultPVCResources() corev1.ResourceRequirements

DefaultPVCResources will return the default PVC resources.

func EncodeCertificatePEM

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

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

func EncodePrivateKeyPEM

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

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

func EnvMerge

func EnvMerge(existing []corev1.EnvVar, merge []corev1.EnvVar, override bool) []corev1.EnvVar

EnvMerge merges two slices of EnvVar entries into a single one. If existing has an EnvVar with same Name attribute as one in merge, the EnvVar is not merged unless override is set to true.

func FetchObject

func FetchObject(client client.Client, namespace string, name string, obj client.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 FetchSecret

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

func FetchStorageSecretName(export *argoprojv1alpha1.ArgoCDExport) string

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

func IsAPIRegistered added in v0.10.2

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

IsAPIRegistered returns true if the API is registered irrespective of whether the API status is available or not.

func IsObjectFound

func IsObjectFound(client client.Client, namespace string, name string, obj client.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 LabelsForCluster

func LabelsForCluster(cr *argoproj.ArgoCD) map[string]string

LabelsForCluster returns the labels for all cluster resources.

func NameWithSuffix

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

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

NewPrivateKey returns randomly generated RSA private key.

func NewSecret

func NewSecret(cr *argoproj.ArgoCD) *corev1.Secret

NewSecret returns a new Secret based on the given metadata.

func NewSecretWithName

func NewSecretWithName(cr *argoproj.ArgoCD, name string) *corev1.Secret

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

func NewSecretWithSuffix

func NewSecretWithSuffix(cr *argoproj.ArgoCD, suffix string) *corev1.Secret

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

func NewSelfSignedCACertificate

func NewSelfSignedCACertificate(name string, 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

func NewSignedCertificate(cfg *certmanagerv1.CertificateSpec, 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

func NewTLSSecret(cr *argoproj.ArgoCD, suffix string) *corev1.Secret

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

func ParsePEMEncodedCert

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

ParsePEMEncodedCert parses a certificate from the given pemdata

func ParsePEMEncodedPrivateKey

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