v1

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the site v1 API group +kubebuilder:object:generate=true +groupName=site.operator.kube-stager.io

Index

Constants

View Source
const (
	StatePending             StagingSiteState = "Pending"
	StateComplete            StagingSiteState = "Complete"
	StateFailed              StagingSiteState = "Failed"
	WorkloadHealthHealthy    WorkloadHealth   = "Healthy"
	WorkloadHealthUnhealthy  WorkloadHealth   = "Unhealthy"
	WorkloadHealthIncomplete WorkloadHealth   = "Incomplete"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "site.operator.kube-stager.io", Version: "v1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type StagingSite

type StagingSite struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   StagingSiteSpec   `json:"spec,omitempty"`
	Status StagingSiteStatus `json:"status,omitempty"`
}

StagingSite is the Schema for the stagingsites API

func GetDummySite

func GetDummySite(serviceName string, namespace string) StagingSite

func (*StagingSite) DeepCopy

func (in *StagingSite) DeepCopy() *StagingSite

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSite.

func (*StagingSite) DeepCopyInto

func (in *StagingSite) DeepCopyInto(out *StagingSite)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*StagingSite) DeepCopyObject

func (in *StagingSite) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*StagingSite) Default

func (r *StagingSite) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (StagingSite) GetMongoConfigForService

func (r StagingSite) GetMongoConfigForService(serviceConfig configv1.ServiceConfig) string

func (StagingSite) GetMysqlConfigForService

func (r StagingSite) GetMysqlConfigForService(serviceConfig configv1.ServiceConfig) string

func (StagingSite) GetRedisConfigForService

func (r StagingSite) GetRedisConfigForService(serviceConfig configv1.ServiceConfig) string

func (*StagingSite) GetServiceStatus

func (r *StagingSite) GetServiceStatus(serviceName string) *StagingSiteServiceStatus

func (*StagingSite) SetupWebhookWithManager

func (r *StagingSite) SetupWebhookWithManager(mgr ctrl.Manager) error

type StagingSiteList

type StagingSiteList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []StagingSite `json:"items"`
}

StagingSiteList contains a list of StagingSite

func (*StagingSiteList) DeepCopy

func (in *StagingSiteList) DeepCopy() *StagingSiteList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSiteList.

func (*StagingSiteList) DeepCopyInto

func (in *StagingSiteList) DeepCopyInto(out *StagingSiteList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*StagingSiteList) DeepCopyObject

func (in *StagingSiteList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type StagingSiteService

type StagingSiteService struct {
	//+kubebuilder:default:=latest
	// Tag of the image to deploy the file from. Will default to latest if not set.
	//+optional
	ImageTag string `json:"imageTag"`

	//+kubebuilder:validation:Min=1
	//+kubebuilder:validation:Max=3
	//+kubebuilder:default:1
	// The replica count for this services deployment
	//+optional
	Replicas int32 `json:"replicas"`

	// Override resource requirements for the containers in the service pods
	//+optional
	ResourceOverrides map[string]corev1.ResourceRequirements `json:"resourceOverrides,omitempty"`

	//+kubebuilder:validation:MinLength=1
	// Name of the mysql environment to use for this service
	MysqlEnvironment string `json:"mysqlEnvironment,omitempty"`

	//+kubebuilder:validation:MinLength=1
	// Name of the mongodb environment to use for this service
	MongoEnvironment string `json:"mongoEnvironment,omitempty"`

	//+kubebuilder:validation:MinLength=1
	// Name of the redis environment to use for this service
	RedisEnvironment string `json:"redisEnvironment,omitempty"`

	//+kubebuilder:default:=false
	// Whether to include the service in backups. Defaults to FALSE
	//+optional
	IncludeInBackups bool `json:"includeInBackups,omitempty"`

	//+kubebuilder:validation:MinLength=0
	// The name of the environment to initialise the database from. Defaults to "master"
	//+optional
	DbInitSourceEnvironmentName string `json:"dumpSourceEnvironmentName,omitempty"`

	// Any extra environment variables to set for the staging site.
	//+optional
	ExtraEnvs map[string]string `json:"extraEnvs,omitempty"`

	// Any additional custom template value overrides
	//+optional
	CustomTemplateValues map[string]string `json:"customTemplateValues,omitempty"`
}

func (*StagingSiteService) DeepCopy

func (in *StagingSiteService) DeepCopy() *StagingSiteService

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSiteService.

func (*StagingSiteService) DeepCopyInto

func (in *StagingSiteService) DeepCopyInto(out *StagingSiteService)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StagingSiteServiceStatus

type StagingSiteServiceStatus struct {
	// The username to use for database connections
	Username string `json:"username,omitempty"`

	// The database name to use for database connections
	DbName string `json:"databaseName"`

	// The database number to use for redis connections
	RedisDatabaseNumber uint32 `json:"redisDatabaseNumber"`

	// The status subentity of the created deployment
	DeploymentStatus appsv1.DeploymentStatus `json:"deploymentStatus,omitempty"`
}

func (*StagingSiteServiceStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSiteServiceStatus.

func (*StagingSiteServiceStatus) DeepCopyInto

func (in *StagingSiteServiceStatus) DeepCopyInto(out *StagingSiteServiceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StagingSiteSpec

type StagingSiteSpec struct {
	//+kubebuilder:validation:MinLength=0
	// The domain prefix for the staging environment. Defaults to the name of the staging site
	//+optional
	DomainPrefix string `json:"domainPrefix,omitempty"`

	//+kubebuilder:validation:Pattern=[_a-zA-Z0-9]*
	//+kubebuilder:validation:MinLength=0
	//+kubebuilder:validation:MaxLength=63
	// The name of the databases to create (applies both to mysql and mongo). Defaults to the name of the staging site
	//+optional
	DbName string `json:"dbName,omitempty"`

	//+kubebuilder:validation:Pattern=[_a-zA-Z0-9]*
	//+kubebuilder:validation:MinLength=0
	//+kubebuilder:validation:MaxLength=16
	// The username to use for authentication (applies both to mysql and mongo). Defaults to the db name
	//+optional
	Username string `json:"username,omitempty"`

	//+kubebuilder:validation:Pattern=[_a-zA-Z0-9]*
	//+kubebuilder:validation:MinLength=0
	//+kubebuilder:validation:MaxLength=32
	// The password to use for authentication (applies both to mysql and mongo). Defaults to a randomly generated password
	//+optional
	Password string `json:"password,omitempty"`

	//+kubebuilder:default:=true
	// Whether to enable the staging site (run it's pods). Defaults to TRUE
	//+optional
	Enabled bool `json:"enabled"`

	// The period after which the staging site will be automatically disabled (data left intact). Defaults to 2 days
	//+optional
	DisableAfter TimeInterval `json:"disableAfter,omitempty"`

	// The period after which the staging site will be automatically deleted (including it's database). Defaults to 7 days
	//+optional
	DeleteAfter TimeInterval `json:"deleteAfter,omitempty"`

	//+kubebuilder:default:=false
	// Whether to perform a database backup before deleting the site. Defaults to FALSE
	//+optional
	BackupBeforeDelete bool `json:"backupBeforeDelete,omitempty"`

	//+kubebuilder:validation:Min=-1
	//+kubebuilder:validation:Max=23
	// The hour for the daily backup window in UTC 24 hour time (0-23).
	//+optional
	DailyBackupWindowHour *int32 `json:"dailyBackupWindowHour,omitempty"`

	// The services used by the staging site
	//+optional
	Services map[string]StagingSiteService `json:"services,omitempty"`

	//+kubebuilder:default:=false
	// If set to TRUE, all services will be included and deployed with this staging site. Defaults to FALSE
	//+optional
	IncludeAllServices bool `json:"includeAllServices,omitempty"`
}

StagingSiteSpec defines the desired state of StagingSite

func (*StagingSiteSpec) DeepCopy

func (in *StagingSiteSpec) DeepCopy() *StagingSiteSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSiteSpec.

func (*StagingSiteSpec) DeepCopyInto

func (in *StagingSiteSpec) DeepCopyInto(out *StagingSiteSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StagingSiteState

type StagingSiteState string

+kubebuilder:validation:Enum=Pending;Complete;Failed

type StagingSiteStatus

type StagingSiteStatus struct {
	// Whether the database creation is complete
	DatabaseCreationComplete bool `json:"databaseCreationComplete"`

	// Whether the database initialisation is complete
	DatabaseInitialisationComplete bool `json:"databaseInitialisationComplete"`

	// Whether the database migrations have finished running everywhere
	DatabaseMigrationsComplete bool `json:"databaseMigrationsComplete"`

	// Whether configuration type objects are created/updated (configmaps, secrets)
	ConfigsAreCreated bool `json:"configsAreCreated"`

	// Whether networking type objects are created/updated (services, ingresses)
	NetworkingObjectsAreCreated bool `json:"networkingObjectsAreCreated"`

	// Whether the workload objects are created and up to date (deployments)
	WorkloadsAreCreated bool `json:"workloadsAreCreated"`

	// The timestamp of the last applied configuration
	LastAppliedConfiguration *metav1.Time `json:"lastAppliedConfiguration,omitempty"`

	// The timestamp when the site will be automatically disabled at
	//+optional
	DisableAt *metav1.Time `json:"disableAt,omitempty"`

	// The timestamp when the site will be automatically deleted at
	//+optional
	DeleteAt *metav1.Time `json:"deleteAt,omitempty"`

	// Whether the site is enabled or not. The automatic disabling sets this flag to false, but doesn't touch the spec one
	Enabled bool `json:"enabled"`

	// The global state of the site
	State StagingSiteState `json:"state"`

	// The combined health of the workloads related to this instance
	WorkloadHealth WorkloadHealth `json:"workloadHealth"`

	// The error message associated with the Failed status
	ErrorMessage string `json:"errorMessage"`

	// The status for the services
	Services map[string]StagingSiteServiceStatus `json:"services,omitempty"`

	// The time of the latest successful backup of the whole site
	//+optional
	LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"`

	// The time the next backup is scheduled for
	//+optional
	NextBackupTime *metav1.Time `json:"nextBackupTime,omitempty"`
}

StagingSiteStatus defines the observed state of StagingSite

func (*StagingSiteStatus) DeepCopy

func (in *StagingSiteStatus) DeepCopy() *StagingSiteStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StagingSiteStatus.

func (*StagingSiteStatus) DeepCopyInto

func (in *StagingSiteStatus) DeepCopyInto(out *StagingSiteStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TimeInterval

type TimeInterval struct {
	// If TRUE the time range will never apply
	Never bool `json:"never,omitempty"`
	// Number of days. All amounts are additive, so 1 day 25 hours 90 minutes == 2 days 2 hour 30 minutes
	Days int `json:"days,omitempty"`
	// Number of hours. All amounts are additive, so 1 day 25 hours 90 minutes == 2 days 2 hour 30 minutes
	Hours int `json:"hours,omitempty"`
	// Number of minutes. All amounts are additive, so 1 day 25 hours 90 minutes == 2 days 2 hour 30 minutes
	Minutes int `json:"minutes,omitempty"`
}

func (*TimeInterval) DeepCopy

func (in *TimeInterval) DeepCopy() *TimeInterval

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeInterval.

func (*TimeInterval) DeepCopyInto

func (in *TimeInterval) DeepCopyInto(out *TimeInterval)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (TimeInterval) ToDuration

func (r TimeInterval) ToDuration() time.Duration

type WorkloadHealth

type WorkloadHealth string

+kubebuilder:validation:Enum=Healthy;Unhealthy;Incomplete

Jump to

Keyboard shortcuts

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