Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test deployment
  • Loading branch information
an3l committed Dec 21, 2021
1 parent 9e89a5e commit 337b5f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 3 additions & 4 deletions api/v1alpha1/mariadb_types.go
Expand Up @@ -25,12 +25,11 @@ import (

// MariaDBSpec defines the desired state of MariaDB
type MariaDBSpec struct {
// Size is the size of the deployment

// +optional
// +kubebuilder:validation:Required
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=4
Size int32 `json:"size"`
Replicas *int32 `json:"size"`

// Database additional user details (base64 encoded)
// +kubebuilder:validation:Required
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/mariak8g.mariadb.org_mariadbs.yaml
Expand Up @@ -68,10 +68,9 @@ spec:
description: Root user password
type: string
size:
description: Size is the size of the deployment
default: 1
format: int32
maximum: 4
minimum: 1
type: integer
username:
description: Database additional user details (base64 encoded)
Expand Down
12 changes: 12 additions & 0 deletions controllers/mariadb_controller.go
Expand Up @@ -21,6 +21,8 @@ import (

"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/api/errors"
// apps "k8s.io/api/apps/v1" // go get
apps "k8s.io/api/core/v1"

"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -68,6 +70,16 @@ func (r *MariaDBReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
log.Error(err, "unable to update the variable status")
return ctrl.Result{}, err
}

// create or update the deployment
depl := &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
// we'll make things simple by matching name to the name of our mariadb-sample
Name: req.Name,
Namespace: req.Namespace,
},
}


log.Info("Reconciled MariaDB kind", "mariadb", app.Name, "status", app.Status)

Expand Down

0 comments on commit 337b5f9

Please sign in to comment.