internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GitlabType represents resource of type Gitlab
	GitlabType = "gitlab"
)

Variables

View Source
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 AdminRoute

func AdminRoute(adapter gitlab.CustomResourceAdapter) *routev1.Route

AdminRoute returns GitLab admin route

func AppConfigConnectionSecret

func AppConfigConnectionSecret(adapter gitlab.CustomResourceAdapter, minioSecret corev1.Secret) (*corev1.Secret, error)

AppConfigConnectionSecret returns secret containing MinIO connection config for `global.appConfig.object_store.connection.secret`.

func BucketCreationJob

func BucketCreationJob(adapter gitlab.CustomResourceAdapter) *batchv1.Job

BucketCreationJob creates the buckets used by GitLab

func CertificateIssuer

func CertificateIssuer(adapter gitlab.CustomResourceAdapter) *certmanagerv1alpha2.Issuer

CertificateIssuer create a certificate generator

func ConfigMapData

func ConfigMapData(name, namespace string) (map[string]string, error)

ConfigMapData returns data contained in a configmap

func ConfigMapWithHash

func ConfigMapWithHash(cm *corev1.ConfigMap)

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

func EncodeString(message string) string

EncodeString accepts strings and returns a base64 encoded string

func EndpointAnnotations

func EndpointAnnotations(adapter gitlab.CustomResourceAdapter, annotate bool) map[string]string

EndpointAnnotations generates annotation for ingresses

func ExporterServiceMonitor

func ExporterServiceMonitor(cr *gitlabv1beta1.GitLab) *monitoringv1.ServiceMonitor

ExporterServiceMonitor returns the GitLab exporter service monitor

func ExposePrometheusCluster

func ExposePrometheusCluster(cr *gitlabv1beta1.GitLab) *corev1.Service

ExposePrometheusCluster creates a service for Prometheus

func GenericConfigMap

func GenericConfigMap(name, namespace string, labels map[string]string) *corev1.ConfigMap

GenericConfigMap returns empty configmap

func GenericCronJob

func GenericCronJob(component Component) *batchv1beta1.CronJob

GenericCronJob returns a kubernetes CronJob

func GenericDeployment

func GenericDeployment(component Component) *appsv1.Deployment

GenericDeployment returns a generic deployment

func GenericJob

func GenericJob(component Component) *batchv1.Job

GenericJob returns a Kubernetes Job

func GenericSecret

func GenericSecret(name, namespace string, labels map[string]string) *corev1.Secret

GenericSecret returns empty secret

func GenericStatefulSet

func GenericStatefulSet(component Component) *appsv1.StatefulSet

GenericStatefulSet returns a generic k8s statefulset

func GetDeploymentPods

func GetDeploymentPods(kclient client.Client, name, namespace string) (result []corev1.Pod, err error)

GetDeploymentPods returns the pods that belong to a given deployment

func GetIssuerConfig

GetIssuerConfig gets the ACME issuer to use from GitLab resource

func GetLabelSet

func GetLabelSet(cr *gitlabv1beta1.GitLab) labels.Set

func GetSecretValue

func GetSecretValue(client client.Client, namespace, secret, key string) (string, error)

GetSecretValue returns the value for a key from an existing secret

func GitalyServiceMonitor

func GitalyServiceMonitor(cr *gitlabv1beta1.GitLab) *monitoringv1.ServiceMonitor

GitalyServiceMonitor returns the Gitaly service monitor

func HorizontalAutoscaler

func HorizontalAutoscaler(deployment *appsv1.Deployment, cr *gitlabv1beta1.GitLab) *autoscalingv1.HorizontalPodAutoscaler

HorizontalAutoscaler return HPA for deployment passed

func IsEmailAddress

func IsEmailAddress(email string) bool

IsEmailAddress evaluates a string and returns true if a valid email address. False is otherwise returned

func IsMinioAvailable

func IsMinioAvailable() bool

IsMinioAvailable checks if Minio API provided by minio operator is present

func IsOpenshift

func IsOpenshift() bool

IsOpenshift check if API has the API route.openshift.io/v1, then it is considered an openshift environment

func IsPodRunning

func IsPodRunning(pod *corev1.Pod) bool

IsPodRunning function tells user if pod is running

func IsPrometheusSupported

func IsPrometheusSupported() bool

IsPrometheusSupported checks for Prometheus API endpoint

func Label

func Label(resource, component, resourceType string) map[string]string

Label function returns uniform labels for resources

func MainRoute

func MainRoute(adapter gitlab.CustomResourceAdapter) *routev1.Route

MainRoute returns main GitLab application route

func MinioIngress

MinioIngress returns the Ingress that exposes MinIO.

func MinioScriptConfigMap

func MinioScriptConfigMap(adapter gitlab.CustomResourceAdapter) *corev1.ConfigMap

MinioScriptConfigMap returns scripts used to configure Minio

func MinioSecret

func MinioSecret(adapter gitlab.CustomResourceAdapter) *corev1.Secret

MinioSecret returns secret containing Minio accesskey and secretkey

func MinioService

func MinioService(adapter gitlab.CustomResourceAdapter) *corev1.Service

MinioService returns service that exposes Minio

func MinioStatefulSet

func MinioStatefulSet(adapter gitlab.CustomResourceAdapter) *appsv1.StatefulSet

MinioStatefulSet return Minio statefulset

func Password

func Password(options PasswordOptions) string

Password creates an password string based on the password options provided

func PostgresqlServiceMonitor

func PostgresqlServiceMonitor(cr *gitlabv1beta1.GitLab) *monitoringv1.ServiceMonitor

PostgresqlServiceMonitor returns the Postgres service monitor

func PrometheusCluster

func PrometheusCluster(cr *gitlabv1beta1.GitLab) *monitoringv1.Prometheus

PrometheusCluster returns a prometheus cluster object TODO: receive replicas from user input

func ReadConfig

func ReadConfig(filename string) string

ReadConfig returns contents of file as string

func RedisServiceMonitor

func RedisServiceMonitor(cr *gitlabv1beta1.GitLab) *monitoringv1.ServiceMonitor

RedisServiceMonitor returns the Redis service monitor

func RegistryConnectionSecret

func RegistryConnectionSecret(adapter gitlab.CustomResourceAdapter, minioSecret corev1.Secret) (*corev1.Secret, error)

RegistryConnectionSecret returns secret containing MinIO connection config for `registry.storage.secret`.

func RegistryRoute

func RegistryRoute(adapter gitlab.CustomResourceAdapter) *routev1.Route

RegistryRoute returns GitLab registry route

func RemoveEmptyLines

func RemoveEmptyLines(block string) string

RemoveEmptyLines removes empty lines from block string

func ResourceQuantity

func ResourceQuantity(request string) resource.Quantity

ResourceQuantity returns quantity requested for resource

func SecretData

func SecretData(name, namespace string) (map[string]string, error)

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

func TaskRunnerConnectionSecret

func TaskRunnerConnectionSecret(adapter gitlab.CustomResourceAdapter, minioSecret corev1.Secret) *corev1.Secret

TaskRunnerConnectionSecret returns secret containing MinIO connection config for `global.task-runner.backups.objectStorage.config.secret`.

func WebserviceServiceMonitor

func WebserviceServiceMonitor(cr *gitlabv1beta1.GitLab) *monitoringv1.ServiceMonitor

WebserviceServiceMonitor returns the Webservice service monitor

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 ConfigurationOptions

type ConfigurationOptions struct {
	// ObjectStore defines object that describes values
	// for the S3 compatible storage service
	ObjectStore ObjectStoreOptions
}

ConfigurationOptions holds options used to configure the different GitLab components

func SystemBuildOptions

func SystemBuildOptions(adapter gitlab.CustomResourceAdapter) ConfigurationOptions

SystemBuildOptions retrieves options from the Gitlab custom resource and uses them to build configuration options used to deploy the Gitlab instance

type EndpointTLS

type EndpointTLS struct {
	// contains filtered or unexported fields
}

EndpointTLS informs which services require to be secured using generated TLS certificates

func RequiresCertManagerCertificate

func RequiresCertManagerCertificate(adapter gitlab.CustomResourceAdapter) EndpointTLS

RequiresCertManagerCertificate function returns true an administrator did not provide a TLS ceritificate for an endpoint

func (EndpointTLS) Any

func (ep EndpointTLS) Any() bool

Any returns true if any ingress requires a cert-manager certificate

func (EndpointTLS) GitLab

func (ep EndpointTLS) GitLab() bool

GitLab returns true if GitLab endpoint requires a cert-manager provisioned certificate

func (EndpointTLS) Minio

func (ep EndpointTLS) Minio() bool

Minio returns true if Minio endpoint requires a cert-manager provisioned certificate

func (EndpointTLS) Registry

func (ep EndpointTLS) Registry() bool

Registry returns true if Registry endpoint requires a cert-manager provisioned certificate

type Image

type Image struct {
	Name  string `yaml:"name"`
	Image string `yaml:"image"`
}

Image represents a single microservice image

type KubeConfig

type KubeConfig struct {
	Config *rest.Config
	Error  error
}

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 ObjectStoreOptions

type ObjectStoreOptions struct {
	// URL defines address for development
	// S3 storage service
	URL string

	// Endpoint defines the URL the API endpoint
	// including the protocol
	Endpoint string

	// Credentials is the name of the secret
	// that contains the 'accesskey' and 'secretkey'
	Credentials string

	// Capacity of the volume to be used by the development
	// minio instance
	Capacity string
}

ObjectStoreOptions defines properties for the S3 storage used by GitLab

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

type Release

type Release struct {
	Version string  `json:"version" yaml:"version"`
	Default bool    `json:"default,omitempty" yaml:"default,omitempty"`
	Images  []Image `json:"images" yaml:"images"`
}

Release defines a GitLab release

func (*Release) Busybox

func (r *Release) Busybox() string

Busybox return busybox container image

func (*Release) Certificates

func (r *Release) Certificates() string

Certificates return certificates container image

func (*Release) GitLabExporter

func (r *Release) GitLabExporter() string

GitLabExporter return GitLab exporter container image

func (*Release) Gitaly

func (r *Release) Gitaly() string

Gitaly return gitaly container image

func (*Release) IsDefault

func (r *Release) IsDefault() bool

IsDefault returns true if release is set to default

func (*Release) MiniDebian

func (r *Release) MiniDebian() string

MiniDebian return mini debian container image

func (*Release) Minio

func (r *Release) Minio() string

Minio return minio container image

func (*Release) MinioClient

func (r *Release) MinioClient() string

MinioClient return minio client container image

func (*Release) Postgresql

func (r *Release) Postgresql() string

Postgresql return postgresql container image

func (*Release) PostgresqlExporter

func (r *Release) PostgresqlExporter() string

PostgresqlExporter return postgres exporter container image

func (*Release) Redis

func (r *Release) Redis() string

Redis return redis container image

func (*Release) RedisExporter

func (r *Release) RedisExporter() string

RedisExporter return redis exporter container image

func (*Release) Registry

func (r *Release) Registry() string

Registry return registry container image

func (*Release) Shell

func (r *Release) Shell() string

Shell return shell container image

func (*Release) Sidekiq

func (r *Release) Sidekiq() string

Sidekiq return sidekiq container image

func (*Release) TaskRunner

func (r *Release) TaskRunner() string

TaskRunner return task runner container image

func (*Release) Webservice

func (r *Release) Webservice() string

Webservice return webservice container image

func (*Release) Workhorse

func (r *Release) Workhorse() string

Workhorse return workhorse container image

type ResourceLabels

type ResourceLabels map[string]string

ResourceLabels type encapsulates map[string]string

func (ResourceLabels) GetName

func (l ResourceLabels) GetName() string

GetName returns the name of resource based on instance label

Jump to

Keyboard shortcuts

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