Skip to content

Commit

Permalink
remove debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuyi1159 committed Aug 22, 2024
1 parent cb7da15 commit 21ba3f2
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 45 deletions.
7 changes: 0 additions & 7 deletions controllers/extensions/addon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package extensions

import (
"context"
"fmt"
"runtime"

batchv1 "k8s.io/api/batch/v1"
Expand Down Expand Up @@ -157,23 +156,17 @@ func (r *AddonReconciler) deleteExternalResources(reqCtx intctrlutil.RequestCtx,
}
job := &batchv1.Job{}
if err := r.Get(reqCtx.Ctx, key, job); err != nil {
fmt.Println("not found: ", jobName)
return client.IgnoreNotFound(err)
}
if !job.DeletionTimestamp.IsZero() {
fmt.Println("DeletionTimestamp.IsZero: ", jobName)
fmt.Println(job.DeletionTimestamp)
return nil
}
if err := r.Delete(reqCtx.Ctx, job); err != nil {
fmt.Println("can not found when delete: ", jobName)
return client.IgnoreNotFound(err)
}
fmt.Println("succee delete: ", jobName)
return nil
}
for _, j := range []string{getInstallJobName(addon), getUninstallJobName(addon)} {
fmt.Println("job name: ", j)
if err := deleteJobIfExist(j); err != nil {
return nil, err
}
Expand Down
4 changes: 0 additions & 4 deletions controllers/extensions/reconciler_auto_install_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

ctrl "sigs.k8s.io/controller-runtime"

extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
Expand Down Expand Up @@ -51,14 +49,12 @@ func (r *autoInstallCheckReconciler) PreCondition(tree *kubebuilderx.ObjectTree)
func (r *autoInstallCheckReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("autoInstallCheckReconciler", "phase", addon.Status.Phase)
fmt.Println("autoInstallCheckReconciler, phase: ", addon.Status.Phase)
if addon.Spec.Installable == nil || !addon.Spec.Installable.AutoInstall {
return kubebuilderx.Continue, nil
}
// proceed if has specified addon.spec.installSpec
if addon.Spec.InstallSpec != nil {
r.reqCtx.Log.V(1).Info("has specified addon.spec.installSpec")
// fmt.Println("has specified addon.spec.installSpec")
return kubebuilderx.Continue, nil
}
enabledAddonWithDefaultValues(r.reqCtx.Ctx, &r.stageCtx, addon, AddonAutoInstall, "Addon enabled auto-install")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

ctrl "sigs.k8s.io/controller-runtime"

extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
Expand Down Expand Up @@ -51,10 +49,8 @@ func (r *enabledWithDefaultValuesReconciler) PreCondition(tree *kubebuilderx.Obj
func (r *enabledWithDefaultValuesReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("enabledWithDefaultValuesReconciler", "phase", addon.Status.Phase)
fmt.Println("enabledWithDefaultValuesReconciler, phase: ", addon.Status.Phase)
if addon.Spec.InstallSpec.HasSetValues() || addon.Spec.InstallSpec.IsDisabled() {
r.reqCtx.Log.V(1).Info("has specified addon.spec.installSpec")
// fmt.Println("enabledWithDefaultValuesReconciler, has specified addon.spec.installSpec")
return kubebuilderx.Continue, nil
}
if v, ok := addon.Annotations[AddonDefaultIsEmpty]; ok && v == trueVal {
Expand Down
4 changes: 0 additions & 4 deletions controllers/extensions/reconciler_fetchN_deletion_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

corev1 "k8s.io/api/core/v1"
ctrl "sigs.k8s.io/controller-runtime"

Expand Down Expand Up @@ -54,7 +52,6 @@ func (r *fetchNDeletionCheckReconciler) PreCondition(tree *kubebuilderx.ObjectTr
func (r *fetchNDeletionCheckReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("get addon", "generation", addon.Generation, "observedGeneration", addon.Status.ObservedGeneration)
fmt.Println("fetchNDeletionCheckReconciler, phase: ", addon.Status.Phase)
r.reqCtx.UpdateCtxValue(operandValueKey, addon)

// CheckIfAddonUsedByCluster, if err, skip the deletion stage
Expand All @@ -78,7 +75,6 @@ func (r *fetchNDeletionCheckReconciler) Reconcile(tree *kubebuilderx.ObjectTree)
return kubebuilderx.Continue, err
}
r.reqCtx.Log.V(1).Info("start normal reconcile")
// fmt.Println("fetchNDeletionCheckReconciler, start normal reconcile")
return kubebuilderx.Continue, nil
}

Expand Down
14 changes: 1 addition & 13 deletions controllers/extensions/reconciler_gen_id_proceed.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (r *genIDProceedReconciler) PreCondition(tree *kubebuilderx.ObjectTree) *ku
func (r *genIDProceedReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("genIDProceedCheckReconciler", "phase", addon.Status.Phase)
fmt.Println("genIDProceedCheckReconciler, phase: ", addon.Status.Phase)

helmInstallJob, err1 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "install", tree)
helmUninstallJob, err2 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "uninstall", tree)
Expand Down Expand Up @@ -91,11 +90,8 @@ func (r *genIDProceedReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubeb
}
}

fmt.Println("Failed: ", addon.Status.Phase)

if addon.Generation == addon.Status.ObservedGeneration {
r.setReconciled()
fmt.Println("aaaaaa")
return kubebuilderx.RetryAfter(time.Second), nil
}
} else if (err1 == nil && helmInstallJob.Status.Succeeded > 0) || (err2 == nil && helmUninstallJob.Status.Succeeded > 0) {
Expand All @@ -106,15 +102,8 @@ func (r *genIDProceedReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubeb
err := r.reconciler.PatchPhase(addon, r.stageCtx, "Disabled", AddonDisabled)
return kubebuilderx.Continue, err
}
if helmInstallJob.Status.Succeeded > 0 {
fmt.Println("helmInstallJob.Status.Succeeded")
}
if helmUninstallJob.Status.Succeeded > 0 {
fmt.Println("helmUninstallJob.Status.Succeeded")
}
if (!helmInstallJob.DeletionTimestamp.IsZero() && helmInstallJob.Status.Succeeded > 0) ||
(!helmUninstallJob.DeletionTimestamp.IsZero() && helmUninstallJob.Status.Succeeded > 0) {
fmt.Println("!Job.DeletionTimestamp.IsZero(), DeletionTimestamp: ", helmInstallJob.DeletionTimestamp)
return kubebuilderx.Continue, nil
}

Expand All @@ -125,10 +114,9 @@ func (r *genIDProceedReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubeb
return kubebuilderx.Continue, err
}
r.setReconciled()
fmt.Println("setReconciled")
return kubebuilderx.Continue, nil
}
}
}

return kubebuilderx.Continue, nil
}
Expand Down
1 change: 0 additions & 1 deletion controllers/extensions/reconciler_installable_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (r *installableCheckReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (k
}

r.reqCtx.Log.V(1).Info("installableCheckReconciler", "phase", addon.Status.Phase)
fmt.Println("installableCheckReconciler, phase: ", addon.Status.Phase)
// check the annotations constraint about Kubeblocks Version
check, err := checkAnnotationsConstraint(r.reqCtx.Ctx, r.reconciler, addon)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions controllers/extensions/reconciler_metadata_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

ctrl "sigs.k8s.io/controller-runtime"

extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
Expand Down Expand Up @@ -51,7 +49,6 @@ func (r *metadataCheckReconciler) PreCondition(tree *kubebuilderx.ObjectTree) *k
func (r *metadataCheckReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("metadataCheckReconciler", "phase", addon.Status.Phase)
fmt.Println("metadataCheckReconciler, phase: ", addon.Status.Phase)
setAddonProviderAndVersion(addon)
if err := r.reconciler.Client.Update(r.reqCtx.Ctx, addon); err != nil {
r.setRequeueWithErr(err, "")
Expand Down
3 changes: 0 additions & 3 deletions controllers/extensions/reconciler_progressing.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

apierrors "k8s.io/apimachinery/pkg/api/errors"

extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
Expand Down Expand Up @@ -57,7 +55,6 @@ func (r *progressingReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebu

addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("progressingReconciler", "phase", addon.Status.Phase)
fmt.Println("progressingReconciler, phase: ", addon.Status.Phase)

helmInstallJob, err1 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "install", tree)
helmUninstallJob, err2 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "uninstall", tree)
Expand Down
3 changes: 0 additions & 3 deletions controllers/extensions/reconciler_terminal_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package extensions

import (
"fmt"

extensionsv1alpha1 "github.com/apecloud/kubeblocks/apis/extensions/v1alpha1"
"github.com/apecloud/kubeblocks/pkg/controller/kubebuilderx"
"github.com/apecloud/kubeblocks/pkg/controller/model"
Expand Down Expand Up @@ -51,7 +49,6 @@ func (r *terminalStateReconciler) PreCondition(tree *kubebuilderx.ObjectTree) *k
func (r *terminalStateReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("terminalStateReconciler", "phase", addon.Status.Phase)
fmt.Println("terminalStateReconciler, phase: ", addon.Status.Phase)

helmInstallJob, err1 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "install", tree)
helmUninstallJob, err2 := r.reconciler.GetInstallJob(r.reqCtx.Ctx, "uninstall", tree)
Expand Down
3 changes: 0 additions & 3 deletions controllers/extensions/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ func (r *AddonReconciler) PatchPhase(addon *extensionsv1alpha1.Addon, stageCtx s
func (r *helmTypeInstallReconciler) Reconcile(tree *kubebuilderx.ObjectTree) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("helmTypeInstallStage", "phase", addon.Status.Phase)
fmt.Println("helmTypeInstallReconciler, phase: ", addon.Status.Phase)
mgrNS := viper.GetString(constant.CfgKeyCtrlrMgrNS)

key := client.ObjectKey{
Expand Down Expand Up @@ -423,7 +422,6 @@ func (r *helmTypeInstallReconciler) Reconcile(tree *kubebuilderx.ObjectTree) {
func (r *helmTypeUninstallReconciler) Reconcile(tree *kubebuilderx.ObjectTree) {
addon := tree.GetRoot().(*extensionsv1alpha1.Addon)
r.reqCtx.Log.V(1).Info("helmTypeUninstallReconciler", "phase", addon.Status.Phase)
fmt.Println("helmTypeUninstallReconciler, phase: ", addon.Status.Phase)
key := client.ObjectKey{
Namespace: viper.GetString(constant.CfgKeyCtrlrMgrNS),
Name: getUninstallJobName(addon),
Expand All @@ -433,7 +431,6 @@ func (r *helmTypeUninstallReconciler) Reconcile(tree *kubebuilderx.ObjectTree) {
r.setRequeueWithErr(err, "")
return
} else if err == nil {
fmt.Println("get helmTypeUninstallJob!!!!!!!!!!!!!!!")
if helmUninstallJob.Status.Succeeded > 0 {
r.reqCtx.Log.V(1).Info("helm uninstall job succeed", "job", key)
// TODO:
Expand Down

0 comments on commit 21ba3f2

Please sign in to comment.