varie
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: "platform.example.com", Version: "v1alpha1"}
|
||||
var SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
var AddToScheme = SchemeBuilder.AddToScheme
|
||||
|
||||
func init() { SchemeBuilder.Register(&MySQLDatabase{}, &MySQLDatabaseList{}) }
|
||||
|
||||
var _ = metav1.Now
|
||||
@@ -0,0 +1,68 @@
|
||||
package v1alpha1
|
||||
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// MySQLDatabaseSpec defines the desired state of a logical MySQL database.
|
||||
type MySQLDatabaseSpec struct {
|
||||
ClusterRef ClusterReference `json:"clusterRef"`
|
||||
DatabaseName string `json:"databaseName"`
|
||||
AdminSecretRef SecretReference `json:"adminSecretRef"`
|
||||
Connection ConnectionSpec `json:"connection,omitempty"`
|
||||
User *UserSpec `json:"user,omitempty"`
|
||||
Credentials *CredentialsSpec `json:"credentials,omitempty"`
|
||||
Privileges []string `json:"privileges,omitempty"`
|
||||
Charset string `json:"charset,omitempty"`
|
||||
Collation string `json:"collation,omitempty"`
|
||||
DeletionPolicy string `json:"deletionPolicy,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterReference struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
type SecretReference struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ConnectionSpec struct {
|
||||
Host string `json:"host,omitempty"`
|
||||
Port int32 `json:"port,omitempty"`
|
||||
}
|
||||
|
||||
type UserSpec struct {
|
||||
Name string `json:"name"`
|
||||
Create bool `json:"create,omitempty"`
|
||||
}
|
||||
|
||||
type CredentialsSpec struct {
|
||||
SecretName string `json:"secretName"`
|
||||
}
|
||||
|
||||
type MySQLDatabaseStatus struct {
|
||||
Phase string `json:"phase,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
DatabaseName string `json:"databaseName,omitempty"`
|
||||
UserName string `json:"userName,omitempty"`
|
||||
SecretName string `json:"secretName,omitempty"`
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="Database",type="string",JSONPath=".status.databaseName"
|
||||
// +kubebuilder:printcolumn:name="User",type="string",JSONPath=".status.userName"
|
||||
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
|
||||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
type MySQLDatabase struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec MySQLDatabaseSpec `json:"spec"`
|
||||
Status MySQLDatabaseStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
type MySQLDatabaseList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []MySQLDatabase `json:"items"`
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Code generated by controller-gen style deepcopy implementation. DO NOT EDIT.
|
||||
package v1alpha1
|
||||
|
||||
func (in *MySQLDatabase) DeepCopyInto(out *MySQLDatabase) {
|
||||
*out = *in
|
||||
out.ObjectMeta = *in.ObjectMeta.DeepCopy()
|
||||
out.Status = in.Status
|
||||
if in.Status.Conditions != nil {
|
||||
out.Status.Conditions = make([]metav1.Condition, len(in.Status.Conditions))
|
||||
copy(out.Status.Conditions, in.Status.Conditions)
|
||||
}
|
||||
}
|
||||
func (in *MySQLDatabase) DeepCopy() *MySQLDatabase {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MySQLDatabase)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
func (in *MySQLDatabaseList) DeepCopyInto(out *MySQLDatabaseList) {
|
||||
*out = *in
|
||||
if in.Items != nil {
|
||||
out.Items = make([]MySQLDatabase, len(in.Items))
|
||||
for i := range in.Items {
|
||||
in.Items[i].DeepCopyInto(&out.Items[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
func (in *MySQLDatabaseList) DeepCopy() *MySQLDatabaseList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MySQLDatabaseList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user