-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from schemahero/0.8.0-alpha.2
Generating better names for plan phase
- Loading branch information
Showing
9 changed files
with
226 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package migration | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/schemahero/schemahero/pkg/logger" | ||
"go.uber.org/zap" | ||
corev1 "k8s.io/api/core/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
) | ||
|
||
func (r *ReconcileMigration) reconcilePod(ctx context.Context, pod *corev1.Pod) (reconcile.Result, error) { | ||
podLabels := pod.GetObjectMeta().GetLabels() | ||
role, ok := podLabels["schemahero-role"] | ||
if !ok { | ||
return reconcile.Result{}, nil | ||
} | ||
|
||
if role != "" && role != "apply" { | ||
// make sure we are filtering to relevant events | ||
return reconcile.Result{}, nil | ||
} | ||
|
||
logger.Debug("reconciling schemahero pod", | ||
zap.String("kind", pod.Kind), | ||
zap.String("name", pod.Name), | ||
zap.String("role", role), | ||
zap.String("podPhase", string(pod.Status.Phase))) | ||
|
||
if pod.Status.Phase != corev1.PodSucceeded { | ||
return reconcile.Result{}, nil | ||
} | ||
|
||
// delete it | ||
if err := r.Delete(ctx, pod); err != nil { | ||
return reconcile.Result{}, errors.Wrap(err, "failed to delete apply pod") | ||
} | ||
|
||
return reconcile.Result{}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.