Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MariaDB CRD #173

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
}
zzzeek marked this conversation as resolved.
Show resolved Hide resolved

// 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