зеркало из https://github.com/Azure/orkestra.git
nitishm/bug/85/dns1123-sanitize (#87)
* sanitize to DNS1123 compatible names Signed-off-by: nitishm <nitishm@microsoft.com> * avoid delete while workflow is running Signed-off-by: nitishm <nitishm@microsoft.com> Co-authored-by: nitishm <nitishm@microsoft.com>
This commit is contained in:
Родитель
8ee2b66c3c
Коммит
47aa1d61bc
|
@ -110,8 +110,10 @@ func (r *ApplicationGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, e
|
|||
if err != nil {
|
||||
// TODO (nitishm) Handle different error types here to decide remediation action
|
||||
if errors.Is(err, pkg.ErrChecksumAppGroupSpecMismatch) {
|
||||
if appGroup.Status.Checksums != nil {
|
||||
appGroup.Status.Update = true
|
||||
}
|
||||
appGroup.Status.Checksums = checksums
|
||||
appGroup.Status.Update = true
|
||||
requeue, err = r.reconcile(ctx, logr, r.WorkflowNS, &appGroup)
|
||||
defer r.updateStatusAndEvent(ctx, appGroup, requeue, err)
|
||||
if err != nil {
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/Orkestra/api/v1alpha1"
|
||||
v1alpha12 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
|
||||
|
@ -218,8 +219,8 @@ func updateAppGroupDAG(g *v1alpha1.ApplicationGroup, entry *v1alpha12.Template,
|
|||
|
||||
for i, tpl := range tpls {
|
||||
entry.DAG.Tasks[i] = v1alpha12.DAGTask{
|
||||
Name: tpl.Name,
|
||||
Template: tpl.Name,
|
||||
Name: convertToDNS1123(tpl.Name),
|
||||
Template: convertToDNS1123(tpl.Name),
|
||||
Dependencies: g.Spec.Applications[i].Dependencies,
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +242,7 @@ func (a *argo) generateAppDAGTemplates(ctx context.Context, g *v1alpha1.Applicat
|
|||
if len(app.Spec.Subcharts) > 0 {
|
||||
hasSubcharts = true
|
||||
t := v1alpha12.Template{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
}
|
||||
|
||||
t.DAG = &v1alpha12.DAGTemplate{}
|
||||
|
@ -288,7 +289,7 @@ func (a *argo) generateAppDAGTemplates(ctx context.Context, g *v1alpha1.Applicat
|
|||
APIVersion: "helm.fluxcd.io/v1",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
Namespace: app.Spec.TargetNamespace,
|
||||
},
|
||||
Spec: app.DeepCopy().Spec.HelmReleaseSpec,
|
||||
|
@ -301,11 +302,11 @@ func (a *argo) generateAppDAGTemplates(ctx context.Context, g *v1alpha1.Applicat
|
|||
}
|
||||
|
||||
tApp := v1alpha12.Template{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
DAG: &v1alpha12.DAGTemplate{
|
||||
Tasks: []v1alpha12.DAGTask{
|
||||
{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
Template: helmReleaseExecutor,
|
||||
Arguments: v1alpha12.Arguments{
|
||||
Parameters: []v1alpha12.Parameter{
|
||||
|
@ -340,7 +341,7 @@ func (a *argo) generateSubchartAndAppDAGTasks(ctx context.Context, g *v1alpha1.A
|
|||
|
||||
hr := generateSubchartHelmRelease(app.HelmReleaseSpec, sc.Name, version, repo, targetNS, isStaged)
|
||||
task := v1alpha12.DAGTask{
|
||||
Name: sc.Name,
|
||||
Name: convertToDNS1123(sc.Name),
|
||||
Template: helmReleaseExecutor,
|
||||
Arguments: v1alpha12.Arguments{
|
||||
Parameters: []v1alpha12.Parameter{
|
||||
|
@ -389,7 +390,7 @@ func (a *argo) generateSubchartAndAppDAGTasks(ctx context.Context, g *v1alpha1.A
|
|||
APIVersion: "helm.fluxcd.io/v1",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
Namespace: app.HelmReleaseSpec.TargetNamespace,
|
||||
},
|
||||
Spec: app.DeepCopy().HelmReleaseSpec,
|
||||
|
@ -436,7 +437,7 @@ func (a *argo) generateSubchartAndAppDAGTasks(ctx context.Context, g *v1alpha1.A
|
|||
}
|
||||
|
||||
task := v1alpha12.DAGTask{
|
||||
Name: app.Name,
|
||||
Name: convertToDNS1123(app.Name),
|
||||
Template: helmReleaseExecutor,
|
||||
Arguments: v1alpha12.Arguments{
|
||||
Parameters: []v1alpha12.Parameter{
|
||||
|
@ -507,7 +508,7 @@ func generateSubchartHelmRelease(a helmopv1.HelmReleaseSpec, sc, version, repo,
|
|||
APIVersion: "helm.fluxcd.io/v1",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: sc,
|
||||
Name: convertToDNS1123(sc),
|
||||
Namespace: targetNS,
|
||||
},
|
||||
Spec: helmopv1.HelmReleaseSpec{
|
||||
|
@ -558,3 +559,7 @@ func defaultNamespace() string {
|
|||
}
|
||||
return "orkestra"
|
||||
}
|
||||
|
||||
func convertToDNS1123(in string) string {
|
||||
return strings.ReplaceAll(in, "_", "-")
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче