Commit 0bbdd65b authored by Edmund Ochieng's avatar Edmund Ochieng

add spec and status descriptors

parent 5cbe958f
......@@ -23,8 +23,16 @@ import (
// GitLabSpec defines the desired state of GitLab
type GitLabSpec struct {
Release string `json:"release,omitempty"`
URL string `json:"url,omitempty"`
// The GitLab version to deploy
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Release",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Release string `json:"release,omitempty"`
// The URL through which to access GitLab instance
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="GitLab URL",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
URL string `json:"url,omitempty"`
// Name of tls secret used to secure the GitLab instance
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS Certificate",xDescriptors="urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Secret"
TLS string `json:"tls,omitempty"`
SMTP SMTPConfiguration `json:"smtp,omitempty"`
Registry RegistrySpec `json:"registry,omitempty"`
......@@ -111,11 +119,14 @@ type SMTPConfiguration struct {
// AutoScalingSpec are the parameters to configure autoscaling
type AutoScalingSpec struct {
// MinReplicas is the lower limit to scale down to
// Minimum number of replicas to scale to
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Minimum Replicas",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
MinReplicas *int32 `json:"minReplicas,omitempty"`
// MaxReplicas is the upper limit to scale up to
// Maximum number of replicas to scale to
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Maxiumum Replicas",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
MaxReplicas int32 `json:"maxReplicas,omitempty"`
// TargetCPU is the CPU utilization threshold percentage
// Percentage CPU mark at which autoscaling triggers
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CPU Percentage Threshold",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
TargetCPU *int32 `json:"targetCPU,omitempty"`
}
......@@ -149,8 +160,10 @@ type ACMEOptions struct {
// VolumeSpec defines volume specifications
type VolumeSpec struct {
// Capacity of the volume
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Storage capacity",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Capacity string `json:"capacity,omitempty"`
// StorageClass from which volume should originate
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Storage class",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
StorageClass string `json:"storageClass,omitempty"`
}
......@@ -174,6 +187,9 @@ type GitLabStatus struct {
// +kubebuilder:resource:shortName=gl
// +kubebuilder:subresource:status
// +operator-sdk:csv:customresourcedefinitions:displayName="GitLab"
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,""},{Secret,v1,""},{Service,v1,""},{Pod,v1,""},{Deployment,v1,""},{StatefulSet,v1,""},{PersistentVolumeClaim,v1,""},{Runner,v1beta1,""},{GLBackup,v1beta1,""}}
// GitLab is the Schema for the gitlabs API
type GitLab struct {
metav1.TypeMeta `json:",inline"`
......
......@@ -22,24 +22,30 @@ import (
// GLBackupSpec defines the desired state of GLBackup
type GLBackupSpec struct {
// Instance represents the GitLab instance to backup
// Name of GitLab instance to backup
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="GitLab Name",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Instance string `json:"instance"`
// Schedule defines the time and day to run backup
// It takes cron time format
// Backup schedule in cron format.
// Leave blank for one time on-demand backup
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Backup Schedule",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Schedule string `json:"schedule,omitempty"`
// Exclusions allows user to exclude components to backup
// Comma separated list of components to omit from backup
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Backup Exclusions",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Exclusions string `json:"skip,omitempty"`
// Timestamp defines the prefix of the backup job
// Prefix for the backup job
// Can be used when restoring backup
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Backup Timestamp",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Timestamp string `json:"timestamp,omitempty"`
// URL defines the address of the backup job
// The URL of the backup resource to be restored
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Backup URL",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
URL string `json:"url,omitempty"`
// Restore when set to true the backup defined by
// ID: will be restored to the gitlab instance
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Backup Restore",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Restore bool `json:"restore,omitempty"`
}
......@@ -62,13 +68,17 @@ const (
// GLBackupStatus defines the observed state of GLBackup
type GLBackupStatus struct {
// Reports status of backup task
// +kubebuilder:validation:Enum=Running;Completed;Scheduled;Failed
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Backup Status",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Phase BackupState `json:"phase,omitempty"`
// StartedAt returns time when backup was initiated
// Displays time the backup started
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Start Time",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
StartedAt string `json:"startedAt,omitempty"`
// Completed returns time backup terminated or completed
// Displays time the backup completed
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Completion Time",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
CompletedAt string `json:"completedAt,omitempty"`
}
......@@ -76,6 +86,9 @@ type GLBackupStatus struct {
// +kubebuilder:resource:shortName=gbk
// +kubebuilder:subresource:status
// +operator-sdk:csv:customresourcedefinitions:displayName="GitLab Backup"
// +operator-sdk:csv:customresourcedefinitions:resources={{Job,v1,""},{CronJob,v1beta1,""},{ConfigMap,v1,""}}
// GLBackup is the Schema for the glbackups API
type GLBackup struct {
metav1.TypeMeta `json:",inline"`
......
......@@ -25,10 +25,12 @@ type RunnerSpec struct {
// GitlabResource represents a Gitlab custom resource. Should
// only be used to reference Gitlab instance created by the operator
Gitlab GitlabInstanceSpec `json:"gitlab,omitempty"`
// RegistrationToken is name of secret with the
// runner-registration-token key used to register the runner
//Name of secret containing the runner-registration-token key used to register the runner
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Registration Token",xDescriptors="urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Secret"
RegistrationToken string `json:"token,omitempty"`
// Tags passes the runner tags
// List of comma separated tags to be applied to the runner
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Tags",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Tags string `json:"tags,omitempty"`
// Cache defines an S3 compatible object store
......@@ -38,9 +40,11 @@ type RunnerSpec struct {
// GitlabInstanceSpec defines the Gitlab custom
// resource in the kubernetes
type GitlabInstanceSpec struct {
// Name of gitlab resource in kubernetes / openshift
// Name of GitLab instance created by the operator
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Instance Name",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Name string `json:"name,omitempty"`
// Gitlab or Continuous Integration URL
// URL of GitLab instance
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Instance URL",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
URL string `json:"url,omitempty"`
}
......@@ -68,13 +72,21 @@ type RunnerCacheSpec struct {
// RunnerStatus defines the observed state of Runner
type RunnerStatus struct {
Phase string `json:"phase,omitempty"`
// Reports status of the GitLab Runner instance
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Phase",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Phase string `json:"phase,omitempty"`
// Reports status of GitLab Runner registration
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Registration",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Registration string `json:"registration,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +operator-sdk:csv:customresourcedefinitions:displayName="GitLab Runner"
// +operator-sdk:csv:customresourcedefinitions:resources={{ConfigMap,v1,""},{Secret,v1,""},{Service,v1,""},{Replicasets,v1,""},{Pod,v1,""},{Deployment,v1,""},{PersistentVolumeClaim,v1,""}}
// Runner is the Schema for the runners API
type Runner struct {
metav1.TypeMeta `json:",inline"`
......
......@@ -11,12 +11,8 @@ spec:
kind: GitLab
listKind: GitLabList
plural: gitlabs
shortNames:
- gl
singular: gitlab
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: GitLab is the Schema for the gitlabs API
......@@ -792,15 +788,15 @@ spec:
description: AutoScalingSpec are the parameters to configure autoscaling
properties:
maxReplicas:
description: MaxReplicas is the upper limit to scale up to
description: Maximum number of replicas to scale to
format: int32
type: integer
minReplicas:
description: MinReplicas is the lower limit to scale down to
description: Minimum number of replicas to scale to
format: int32
type: integer
targetCPU:
description: TargetCPU is the CPU utilization threshold percentage
description: Percentage CPU mark at which autoscaling triggers
format: int32
type: integer
type: object
......@@ -865,6 +861,7 @@ spec:
type: string
type: object
release:
description: The GitLab version to deploy
type: string
smtp:
description: 'SMTPConfiguration defines options for Gitlab registry More on configuration options available below: https://docs.gitlab.com/omnibus/settings/smtp.html'
......@@ -908,8 +905,10 @@ spec:
type: string
type: object
tls:
description: Name of tls secret used to secure the GitLab instance
type: string
url:
description: The URL through which to access GitLab instance
type: string
volume:
description: Volume for Gitaly statefulset
......
......@@ -11,12 +11,8 @@ spec:
kind: GLBackup
listKind: GLBackupList
plural: glbackups
shortNames:
- gbk
singular: glbackup
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: GLBackup is the Schema for the glbackups API
......@@ -33,22 +29,22 @@ spec:
description: GLBackupSpec defines the desired state of GLBackup
properties:
instance:
description: Instance represents the GitLab instance to backup
description: Name of GitLab instance to backup
type: string
restore:
description: 'Restore when set to true the backup defined by ID: will be restored to the gitlab instance'
description: Restore when set to true the backup defined by
type: boolean
schedule:
description: Schedule defines the time and day to run backup It takes cron time format
description: Backup schedule in cron format. Leave blank for one time on-demand backup
type: string
skip:
description: Exclusions allows user to exclude components to backup
description: Comma separated list of components to omit from backup
type: string
timestamp:
description: Timestamp defines the prefix of the backup job
description: Prefix for the backup job Can be used when restoring backup
type: string
url:
description: URL defines the address of the backup job
description: The URL of the backup resource to be restored
type: string
required:
- instance
......@@ -57,10 +53,10 @@ spec:
description: GLBackupStatus defines the observed state of GLBackup
properties:
completedAt:
description: Completed returns time backup terminated or completed
description: Displays time the backup completed
type: string
phase:
description: BackupState informs of current backup state
description: Reports status of backup task
enum:
- Running
- Completed
......@@ -68,7 +64,7 @@ spec:
- Failed
type: string
startedAt:
description: StartedAt returns time when backup was initiated
description: Displays time the backup started
type: string
type: object
type: object
......
......@@ -13,8 +13,6 @@ spec:
plural: runners
singular: runner
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Runner is the Schema for the runners API
......@@ -56,25 +54,27 @@ spec:
description: GitlabResource represents a Gitlab custom resource. Should only be used to reference Gitlab instance created by the operator
properties:
name:
description: Name of gitlab resource in kubernetes / openshift
description: Name of GitLab instance created by the operator
type: string
url:
description: Gitlab or Continuous Integration URL
description: URL of GitLab instance
type: string
type: object
tags:
description: Tags passes the runner tags
description: List of comma separated tags to be applied to the runner
type: string
token:
description: RegistrationToken is name of secret with the runner-registration-token key used to register the runner
description: Name of secret containing the runner-registration-token key used to register the runner
type: string
type: object
status:
description: RunnerStatus defines the observed state of Runner
properties:
phase:
description: Reports status of the GitLab Runner instance
type: string
registration:
description: Reports status of GitLab Runner registration
type: string
type: object
type: object
......
......@@ -79,19 +79,219 @@ spec:
customresourcedefinitions:
owned:
- description: GitLab is the Schema for the gitlabs API
displayName: Git Lab
displayName: GitLab
kind: GitLab
name: gitlabs.apps.gitlab.com
resources:
- kind: ConfigMap
name: ""
version: v1
- kind: Deployment
name: ""
version: v1
- kind: GLBackup
name: ""
version: v1beta1
- kind: PersistentVolumeClaim
name: ""
version: v1
- kind: Pod
name: ""
version: v1
- kind: Runner
name: ""
version: v1beta1
- kind: Secret
name: ""
version: v1
- kind: Service
name: ""
version: v1
- kind: StatefulSet
name: ""
version: v1
specDescriptors:
- description: Maximum number of replicas to scale to
displayName: Maxiumum Replicas
path: autoscaling.maxReplicas
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Minimum number of replicas to scale to
displayName: Minimum Replicas
path: autoscaling.minReplicas
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Percentage CPU mark at which autoscaling triggers
displayName: CPU Percentage Threshold
path: autoscaling.targetCPU
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Capacity of the volume
displayName: Storage capacity
path: postgres.volume.capacity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: StorageClass from which volume should originate
displayName: Storage class
path: postgres.volume.storageClass
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Capacity of the volume
displayName: Storage capacity
path: redis.volume.capacity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: StorageClass from which volume should originate
displayName: Storage class
path: redis.volume.storageClass
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: The GitLab version to deploy
displayName: Release
path: release
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Name of tls secret used to secure the GitLab instance
displayName: TLS Certificate
path: tls
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Secret
- description: The URL through which to access GitLab instance
displayName: GitLab URL
path: url
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Capacity of the volume
displayName: Storage capacity
path: volume.capacity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: StorageClass from which volume should originate
displayName: Storage class
path: volume.storageClass
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
version: v1beta1
- description: GLBackup is the Schema for the glbackups API
displayName: GLBackup
displayName: GitLab Backup
kind: GLBackup
name: glbackups.apps.gitlab.com
resources:
- kind: ConfigMap
name: ""
version: v1
- kind: CronJob
name: ""
version: v1beta1
- kind: Job
name: ""
version: v1
specDescriptors:
- description: Name of GitLab instance to backup
displayName: GitLab Name
path: instance
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Restore when set to true the backup defined by
displayName: Backup Restore
path: restore
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Backup schedule in cron format. Leave blank for one time on-demand backup
displayName: Backup Schedule
path: schedule
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Comma separated list of components to omit from backup
displayName: Backup Exclusions
path: skip
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Prefix for the backup job Can be used when restoring backup
displayName: Backup Timestamp
path: timestamp
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: The URL of the backup resource to be restored
displayName: Backup URL
path: url
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
statusDescriptors:
- description: Displays time the backup completed
displayName: Completion Time
path: completedAt
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Reports status of backup task
displayName: Backup Status
path: phase
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Displays time the backup started
displayName: Start Time
path: startedAt
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
version: v1beta1
- description: Runner is the Schema for the runners API
displayName: Runner
displayName: GitLab Runner
kind: Runner
name: runners.apps.gitlab.com
resources:
- kind: ConfigMap
name: ""
version: v1
- kind: Deployment
name: ""
version: v1
- kind: PersistentVolumeClaim
name: ""
version: v1
- kind: Pod
name: ""
version: v1
- kind: Replicasets
name: ""
version: v1
- kind: Secret
name: ""
version: v1
- kind: Service
name: ""
version: v1
specDescriptors:
- description: Name of GitLab instance created by the operator
displayName: Instance Name
path: gitlab.name
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: URL of GitLab instance
displayName: Instance URL
path: gitlab.url
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: List of comma separated tags to be applied to the runner
displayName: Tags
path: tags
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Name of secret containing the runner-registration-token key used to register the runner
displayName: Registration Token
path: token
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Secret
statusDescriptors:
- description: Reports status of the GitLab Runner instance
displayName: Phase
path: phase
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: Reports status of GitLab Runner registration
displayName: Registration
path: registration
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
version: v1beta1
description: The GitLab operator allows the user to deploy and manage the lifecycle of both GitLab and GitLab Runner in both Openshift and Kubernetes environments
displayName: GitLab
......
......@@ -13,12 +13,8 @@ spec:
kind: GitLab
listKind: GitLabList
plural: gitlabs
shortNames:
- gl
singular: gitlab
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: GitLab is the Schema for the gitlabs API
......@@ -1542,15 +1538,15 @@ spec:
description: AutoScalingSpec are the parameters to configure autoscaling
properties:
maxReplicas:
description: MaxReplicas is the upper limit to scale up to
description: Maximum number of replicas to scale to
format: int32
type: integer
minReplicas:
description: MinReplicas is the lower limit to scale down to
description: Minimum number of replicas to scale to
format: int32
type: integer
targetCPU:
description: TargetCPU is the CPU utilization threshold percentage
description: Percentage CPU mark at which autoscaling triggers
format: int32
type: integer
type: object
......@@ -1621,6 +1617,7 @@ spec:
type: string
type: object
release:
description: The GitLab version to deploy
type: string
smtp:
description: 'SMTPConfiguration defines options for Gitlab registry
......@@ -1668,8 +1665,10 @@ spec:
type: string
type: object
tls:
description: Name of tls secret used to secure the GitLab instance
type: string
url:
description: The URL through which to access GitLab instance
type: string
volume:
description: Volume for Gitaly statefulset
......