Skip to content

Commit

Permalink
Merge pull request #173 from zzzeek/remove_standalone_mariadb
Browse files Browse the repository at this point in the history
Remove MariaDB CRD
  • Loading branch information
openshift-merge-bot[bot] authored Jan 16, 2024
2 parents d5c0d27 + 8af0ab9 commit 6fb96fd
Show file tree
Hide file tree
Showing 37 changed files with 97 additions and 1,580 deletions.
13 changes: 0 additions & 13 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ plugins:
projectName: mariadb-operator
repo: github.com/openstack-k8s-operators/mariadb-operator
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: openstack.org
group: mariadb
kind: MariaDB
path: github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1
version: v1beta1
webhooks:
defaulting: true
validation: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
Expand Down
129 changes: 0 additions & 129 deletions api/bases/mariadb.openstack.org_mariadbs.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions api/v1beta1/galera_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,24 @@ package v1beta1

import (
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// CustomServiceConfigFile name of the additional mariadb config file
CustomServiceConfigFile = "galera_custom.cnf.in"

// GaleraContainerImage is the fall-back container image for Galera
GaleraContainerImage = "quay.io/podified-antelope-centos9/openstack-mariadb:current-podified"
)

// AdoptionRedirectSpec defines redirection to a different DB instance during Adoption
type AdoptionRedirectSpec struct {
// MariaDB host to redirect to (IP or name)
Host string `json:"host,omitempty"`
}

// GaleraSpec defines the desired state of Galera
type GaleraSpec struct {
// Name of the secret to look for password keys
Expand Down Expand Up @@ -130,3 +140,13 @@ func (instance Galera) RbacNamespace() string {
func (instance Galera) RbacResourceName() string {
return "galera-" + instance.Name
}

// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
func SetupDefaults() {
// Acquire environmental defaults and initialize Keystone defaults with them
galeraDefaults := GaleraDefaults{
ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_MARIADB_IMAGE_URL_DEFAULT", GaleraContainerImage),
}

SetupGaleraDefaults(galeraDefaults)
}
15 changes: 14 additions & 1 deletion api/v1beta1/galera_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import (
// log is for logging in this package.
var galeralog = logf.Log.WithName("galera-resource")

// GaleraDefaults -
type GaleraDefaults struct {
ContainerImageURL string
}

var galeraDefaults GaleraDefaults

// SetupWebhookWithManager sets up the webhook with the Manager
func (r *Galera) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
Expand All @@ -47,7 +54,7 @@ func (r *Galera) Default() {
// Default - set defaults for this MariaDB spec
func (spec *GaleraSpec) Default() {
if spec.ContainerImage == "" {
spec.ContainerImage = mariaDBDefaults.ContainerImageURL
spec.ContainerImage = galeraDefaults.ContainerImageURL
}
}

Expand Down Expand Up @@ -79,3 +86,9 @@ func (r *Galera) ValidateDelete() error {
// TODO(user): fill in your validation logic upon object deletion.
return nil
}

// SetupGaleraDefaults - initialize MariaDB spec defaults for use with either internal or external webhooks
func SetupGaleraDefaults(defaults GaleraDefaults) {
galeraDefaults = defaults
galeralog.Info("Galera defaults initialized", "defaults", defaults)
}
121 changes: 0 additions & 121 deletions api/v1beta1/mariadb_types.go

This file was deleted.

Loading

0 comments on commit 6fb96fd

Please sign in to comment.