Skip to content

Commit 53d5231

Browse files
committed
Makes the operator's own namespace available to its actions
1 parent bb90e0e commit 53d5231

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

Diff for: install/operator/pkg/controller/syndesis/syndesis_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (r *ReconcileSyndesis) Reconcile(ctx context.Context, request reconcile.Req
120120

121121
if a.CanExecute(syndesis) {
122122
log.V(synpkg.DEBUG_LOGGING_LVL).Info("Running action", "action", reflect.TypeOf(a))
123-
if err := a.Execute(ctx, syndesis); err != nil {
123+
if err := a.Execute(ctx, syndesis, request.Namespace); err != nil {
124124
log.Error(err, "Error reconciling", "action", reflect.TypeOf(a), "phase", syndesis.Status.Phase)
125125
return reconcile.Result{
126126
Requeue: true,

Diff for: install/operator/pkg/syndesis/action/action.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var actionLog = logf.Log.WithName("action")
3636

3737
type SyndesisOperatorAction interface {
3838
CanExecute(syndesis *synapi.Syndesis) bool
39-
Execute(ctx context.Context, syndesis *synapi.Syndesis) error
39+
Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error
4040
}
4141

4242
// NewOperatorActions gives the default set of actions operator will perform

Diff for: install/operator/pkg/syndesis/action/backup.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (a *backupAction) CanExecute(syndesis *synapi.Syndesis) bool {
4949
}
5050

5151
// Schedule a cronjob for systematic backups
52-
func (a *backupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
52+
func (a *backupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
5353
entries := c.Entries()
5454

5555
if s := syndesis.Spec.Backup.Schedule; s != "" {
@@ -74,7 +74,7 @@ func (a *backupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) e
7474
client, _ := a.clientTools.RuntimeClient()
7575
return client.Status().Update(ctx, syndesis)
7676
} else {
77-
return fmt.Errorf("unsopported number of entries for cron instance, cron %v", c)
77+
return fmt.Errorf("unsupported number of entries for cron instance, cron %v", c)
7878
}
7979
} else {
8080
if len(entries) == 1 {
@@ -84,7 +84,7 @@ func (a *backupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) e
8484
c.Remove(e.ID)
8585
c.Stop()
8686
} else if len(entries) > 1 {
87-
return fmt.Errorf("unsopported number of entries for cron instance, cron %v", c)
87+
return fmt.Errorf("unsupported number of entries for cron instance, cron %v", c)
8888
}
8989
}
9090

Diff for: install/operator/pkg/syndesis/action/checkupdates.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (a checkUpdatesAction) CanExecute(syndesis *synapi.Syndesis) bool {
3030
synapi.SyndesisPhaseStartupFailed)
3131
}
3232

33-
func (a checkUpdatesAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
33+
func (a checkUpdatesAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
3434
if a.operatorVersion == "" {
3535
a.operatorVersion = pkg.DefaultOperatorTag
3636
}

Diff for: install/operator/pkg/syndesis/action/initialize.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (a *initializeAction) CanExecute(syndesis *synapi.Syndesis) bool {
2828
synapi.SyndesisPhaseNotInstalled)
2929
}
3030

31-
func (a *initializeAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
31+
func (a *initializeAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
3232
list := synapi.SyndesisList{}
3333
rtClient, _ := a.clientTools.RuntimeClient()
3434
err := rtClient.List(ctx, &list, &client.ListOptions{Namespace: syndesis.Namespace})

Diff for: install/operator/pkg/syndesis/action/install.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (a *installAction) CanExecute(syndesis *synapi.Syndesis) bool {
9696

9797
var kindsReportedNotAvailable = map[schema.GroupVersionKind]time.Time{}
9898

99-
func (a *installAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
99+
func (a *installAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
100100
if syndesisPhaseIs(syndesis, synapi.SyndesisPhaseInstalling) {
101101
a.log.Info("installing Syndesis resource", "name", syndesis.Name)
102102
} else if syndesisPhaseIs(syndesis, synapi.SyndesisPhasePostUpgradeRun) {

Diff for: install/operator/pkg/syndesis/action/pod_scheduling.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (a *podSchedulingAction) CanExecute(syndesis *synapi.Syndesis) bool {
4343
return canExecute
4444
}
4545

46-
func (a *podSchedulingAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
46+
func (a *podSchedulingAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
4747
if a.updateIntegrationScheduling {
4848
a.executeIntegrationScheduling(ctx, syndesis)
4949
}

Diff for: install/operator/pkg/syndesis/action/startup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (a *startupAction) CanExecute(syndesis *synapi.Syndesis) bool {
3232
synapi.SyndesisPhaseStartupFailed)
3333
}
3434

35-
func (a *startupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
35+
func (a *startupAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
3636

3737
list := v1.DeploymentConfigList{
3838
TypeMeta: metav1.TypeMeta{

Diff for: install/operator/pkg/syndesis/action/upgrade.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (a *upgradeAction) CanExecute(syndesis *synapi.Syndesis) bool {
4141
)
4242
}
4343

44-
func (a *upgradeAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
44+
func (a *upgradeAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
4545
targetVersion := pkg.DefaultOperatorTag
4646

4747
if syndesis.Status.Phase == synapi.SyndesisPhaseUpgrading {

Diff for: install/operator/pkg/syndesis/action/upgradebackoff.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (a *upgradeBackoffAction) CanExecute(syndesis *synapi.Syndesis) bool {
3333
return syndesisPhaseIs(syndesis, synapi.SyndesisPhaseUpgradeFailureBackoff)
3434
}
3535

36-
func (a *upgradeBackoffAction) Execute(ctx context.Context, syndesis *synapi.Syndesis) error {
36+
func (a *upgradeBackoffAction) Execute(ctx context.Context, syndesis *synapi.Syndesis, operatorNamespace string) error {
3737
rtClient, _ := a.clientTools.RuntimeClient()
3838

3939
// Check number of attempts to fail fast

0 commit comments

Comments
 (0)