-
Notifications
You must be signed in to change notification settings - Fork 138
Adding support to external MariaDB server #1311
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for raising this @wfelipew . Will take a closer look in the following weeks and let you know. Do you mind rebasing with main? |
9fa7ae3
to
bd01bda
Compare
Hey @wfelipew ! As we get close to the 25.08 release, I'm finally finding some time to review this. Would you mind resolving the conflicts and rebasing? |
4085384
to
59e9091
Compare
done |
Thanks for the effort @wfelipew ! Looks promising, will take a look tomorrow. |
59e9091
to
6805491
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for taking the initiative, I do appreciate the effort made here 🙏🏻
Whilst I believe you are on the right track, I think some adaptations are needed, specially around the new abstractions that we have created. Please see my comments, let me know what you think.
api/v1alpha1/mariadb_types.go
Outdated
// +kubebuilder:printcolumn:name="Primary",type="string",JSONPath=".status.currentPrimary" | ||
// +kubebuilder:printcolumn:name="Updates",type="string",JSONPath=".spec.updateStrategy.type" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two annotations can be omitted for ExternalMariaDB
: We don't know what the primary is nor we are handling updates.
api/v1alpha1/mariadb_types.go
Outdated
pp := corev1.PullIfNotPresent | ||
return pp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pp := corev1.PullIfNotPresent | |
return pp | |
return corev1.PullIfNotPresent |
We are returning a copy, it is safe to return corev1.PullIfNotPresent
directly unless I am missing something
api/v1alpha1/mariadb_types.go
Outdated
|
||
// Get image pull secrets | ||
func (m *ExternalMariaDB) GetImagePullSecrets() []LocalObjectReference { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil | |
return nil // ExternalMariaDB uses official MariaDB images (publicly available) for the Backups |
api/v1alpha1/mariadb_types.go
Outdated
|
||
// Get image | ||
func (m *ExternalMariaDB) GetImage() string { | ||
return fmt.Sprintf("mariadb:%s", m.Status.Version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Sprintf("mariadb:%s", m.Status.Version) | |
return fmt.Sprintf("mariadb:%s", m.Status.Version) // // ExternalMariaDB uses official MariaDB images (publicly available) for the Backups |
api/v1alpha1/mariadb_types.go
Outdated
// if !m.IsTLSEnabled() { | ||
// return false | ||
// } | ||
// tls := ptr.Deref(m.Spec.TLS, TLS{}) | ||
// return ptr.Deref(tls.Required, false) | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if !m.IsTLSEnabled() { | |
// return false | |
// } | |
// tls := ptr.Deref(m.Spec.TLS, TLS{}) | |
// return ptr.Deref(tls.Required, false) | |
return false | |
return false // ExternalMariaDB does not make use of this, as it is a internal server setting |
pkg/builder/connection_builder.go
Outdated
ObjectReference: mariadbv1alpha1.ObjectReference{ | ||
Name: opts.ExternalMariaDB.Name, | ||
}, | ||
Kind: "ExternalMariaDB", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we create a constant for this along with the other kinds?
PhysicalBackupKind = "PhysicalBackup" |
pkg/builder/connection_builder.go
Outdated
@@ -49,6 +60,15 @@ func (b *Builder) BuildConnection(opts ConnectionOpts, owner metav1.Object) (*ma | |||
if opts.Template != nil { | |||
conn.Spec.ConnectionTemplate = *opts.Template | |||
} | |||
|
|||
if b == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case gets b
to be nil, if using the NewBuilder
?
mariadb-operator/pkg/builder/builder.go
Line 15 in 3da8aa4
func NewBuilder(scheme *runtime.Scheme, env *environment.OperatorEnv, discovery *discovery.Discovery) *Builder { |
pkg/command/backup.go
Outdated
@@ -34,6 +35,11 @@ type BackupOpts struct { | |||
ExtraOpts []string | |||
} | |||
|
|||
type ConnectionParamsAwareInterface interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this defined under pkg/interfaces
already?
pkg/command/command.go
Outdated
} | ||
return statefulset.ServiceFQDN(mariadb.ObjectMeta) | ||
} | ||
// func host(mariadb interfaces.MariaDBGenericInterface) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is equivalent to GetHost
, probably we can remove
TLSServerCertSecretKey() types.NamespacedName | ||
} | ||
|
||
type ReplicationAwareInterface interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this interface can be removed, please see my previous comments
Thanks for the review, I'll working on it today |
6805491
to
40d86d3
Compare
@mmontes11 I believe I fixed everything except by this one -> #1311 (comment) |
Adding support to external MariaDB server as requested on #199.
It supports: