@@ -91,6 +91,7 @@ func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
9191 }
9292
9393 state := observables {}
94+ state .instance = instance
9495
9596 // create two services and the pdb
9697 err = r .ensureUnconditionalObjects (ctx , instance )
@@ -661,3 +662,37 @@ func (r *EtcdClusterReconciler) ensureUnconditionalObjects(ctx context.Context,
661662 }
662663 return nil
663664}
665+
666+ // TODO!
667+ // nolint:unused
668+ func (r * EtcdClusterReconciler ) patchOrCreateObject (ctx context.Context , obj client.Object ) error {
669+ err := r .Patch (ctx , obj , client .Apply , & client.PatchOptions {FieldManager : "etcd-operator" }, client .ForceOwnership )
670+ if err == nil {
671+ return nil
672+ }
673+ if client .IgnoreNotFound (err ) == nil {
674+ err = r .Create (ctx , obj )
675+ }
676+ return err
677+ }
678+
679+ // TODO!
680+ // nolint:unparam,unused
681+ func (r * EtcdClusterReconciler ) createClusterFromScratch (ctx context.Context , state * observables ) (ctrl.Result , error ) {
682+ cm := factory .TemplateClusterStateConfigMap (state .instance , "new" , state .desiredReplicas ())
683+ err := ctrl .SetControllerReference (state .instance , cm , r .Scheme )
684+ if err != nil {
685+ return ctrl.Result {}, err
686+ }
687+ err = r .patchOrCreateObject (ctx , cm )
688+ if err != nil {
689+ return ctrl.Result {}, err
690+ }
691+ panic ("not yet implemented" )
692+ }
693+
694+ // TODO!
695+ // nolint:unused
696+ func (r * EtcdClusterReconciler ) scaleUpFromZero (ctx context.Context , state * observables ) (ctrl.Result , error ) {
697+ panic ("not yet implemented" )
698+ }
0 commit comments