Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigMapData(name, namespace string) (map[string]string, error)
- func ConfigMapWithHash(cm *corev1.ConfigMap)
- func DeploymentConfigMaps(deploy *appsv1.Deployment) []string
- func EncodeString(message string) string
- func GenericConfigMap(name, namespace string, labels map[string]string) *corev1.ConfigMap
- func GenericDeployment(component Component) *appsv1.Deployment
- func GenericSecret(name, namespace string, labels map[string]string) *corev1.Secret
- func GetSecretValue(client client.Client, namespace, secret, key string) (string, error)
- func IsConfigMapChanged(old, new *corev1.ConfigMap) (*corev1.ConfigMap, bool)
- func IsDeploymentChanged(old, new *appsv1.Deployment) (*appsv1.Deployment, bool)
- func IsOpenshift() bool
- func IsPrometheusSupported() bool
- func Label(cr *gitlabv1beta2.Runner, component, resourceType string) map[string]string
- func ReadConfig(filename string) string
- func ResourceQuantity(request string) resource.Quantity
- func SecretData(name, namespace string) (map[string]string, error)
- func ServiceAccount(name, namespace string) *corev1.ServiceAccount
- type Component
- type KubeConfig
- type PasswordOptions
Constants ¶
const ( // RunnerType represents resource of type Runner RunnerType = "runner" // GitlabType represents resource of type Gitlab GitlabType = "gitlab" // BackupType represents the Backup resource BackupType = "backup" )
Variables ¶
var ( // ConfigMapDefaultMode for configmap projected volume ConfigMapDefaultMode int32 = 420 // ExecutableDefaultMode for configmap projected volume ExecutableDefaultMode int32 = 493 // ProjectedVolumeDefaultMode for projected volume ProjectedVolumeDefaultMode int32 = 256 // SecretDefaultMode for secret projected volume SecretDefaultMode int32 = 288 )
Functions ¶
func ConfigMapData ¶
ConfigMapData returns data contained in a configmap
func ConfigMapWithHash ¶
ConfigMapWithHash updates configmap with annotation containing a SHA256 hash of its data
func DeploymentConfigMaps ¶
func DeploymentConfigMaps(deploy *appsv1.Deployment) []string
DeploymentConfigMaps returns a list of configmaps used in a deployment
func EncodeString ¶
EncodeString accepts strings and returns a base64 encoded string
func GenericConfigMap ¶
GenericConfigMap returns empty configmap
func GenericDeployment ¶
func GenericDeployment(component Component) *appsv1.Deployment
GenericDeployment returns a generic deployment
func GenericSecret ¶
GenericSecret returns empty secret
func GetSecretValue ¶
GetSecretValue returns the value for a key from an existing secret
func IsConfigMapChanged ¶
IsConfigMapChanged returns an updated configmap object and true if the configmap has changed
func IsDeploymentChanged ¶
func IsDeploymentChanged(old, new *appsv1.Deployment) (*appsv1.Deployment, bool)
IsDeploymentChanged compares two deployments and returns a merged deployment object and true if they are different
func IsOpenshift ¶
func IsOpenshift() bool
IsOpenshift check if API has the API route.openshift.io/v1, then it is considered an openshift environment
func IsPrometheusSupported ¶
func IsPrometheusSupported() bool
IsPrometheusSupported checks for Prometheus API endpoint
func Label ¶
func Label(cr *gitlabv1beta2.Runner, component, resourceType string) map[string]string
Label function returns uniform labels for resources
func ReadConfig ¶
ReadConfig returns contents of file as string
func ResourceQuantity ¶
ResourceQuantity returns quantity requested for resource
func SecretData ¶
SecretData gets a secret by name and returns its data
func ServiceAccount ¶
func ServiceAccount(name, namespace string) *corev1.ServiceAccount
ServiceAccount returns service account to be used by pods
Types ¶
type Component ¶
type Component struct { // Namespace of the component Namespace string // Defines the number of pods for the // component to be created Replicas int32 // Labels for the component Labels map[string]string // InitContainers contains a list of containers that may // need to run before the main application container starts up InitContainers []corev1.Container // Containers containers a list of containers that make up a pod Containers []corev1.Container // Contains a list of volumes used by the containers Volumes []corev1.Volume // Defines volume claims to be used by a statefulset VolumeClaimTemplates []corev1.PersistentVolumeClaim }
Component represents an application / micro-service that makes part of a larger application
type KubeConfig ¶
KubeConfig returns kubernetes client configuration
func KubernetesConfig ¶
func KubernetesConfig() KubeConfig
KubernetesConfig returns kubernetes client config
func (KubeConfig) NewKubernetesClient ¶
func (k KubeConfig) NewKubernetesClient() (*kubernetes.Clientset, error)
NewKubernetesClient returns a client that can be used to interact with the kubernetes api
type PasswordOptions ¶
type PasswordOptions struct { // Length defines desired password length Length int // EnableSpecialCharacters adds special characters // to generated passwords EnableSpecialChars bool }
PasswordOptions provides parameters to be used when generating passwords