Skip to content

Commit

Permalink
Remove secret name from global constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetrov117 committed Jul 26, 2024
1 parent c236ccf commit 58074e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/controller/reconcile_os.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (r *UpgradePlanReconciler) reconcileOS(ctx context.Context, upgradePlan *li
return ctrl.Result{}, r.createSecret(ctx, upgradePlan, secret)
}

controlPlanePlan := upgrade.OSControlPlanePlan(release.ReleaseVersion, &release.Components.OperatingSystem)
controlPlanePlan := upgrade.OSControlPlanePlan(release.ReleaseVersion, secret.Name, &release.Components.OperatingSystem)
if err = r.Get(ctx, client.ObjectKeyFromObject(controlPlanePlan), controlPlanePlan); err != nil {
if !errors.IsNotFound(err) {
return ctrl.Result{}, err
Expand Down
7 changes: 5 additions & 2 deletions internal/upgrade/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ import (

const (
scriptName = "os-upgrade.sh"
secretName = "os-upgrade-secret"
)

//go:embed templates/os-upgrade.sh.tpl
var osUpgradeScript string

func OSUpgradeSecret(releaseOS *release.OperatingSystem) (*corev1.Secret, error) {
const (
secretName = "os-upgrade-secret"
)

tmpl, err := template.New(scriptName).Parse(osUpgradeScript)
if err != nil {
return nil, fmt.Errorf("parsing contents: %w", err)
Expand Down Expand Up @@ -61,7 +64,7 @@ func OSUpgradeSecret(releaseOS *release.OperatingSystem) (*corev1.Secret, error)
return secret, nil
}

func OSControlPlanePlan(releaseVersion string, releaseOS *release.OperatingSystem) *upgradecattlev1.Plan {
func OSControlPlanePlan(releaseVersion, secretName string, releaseOS *release.OperatingSystem) *upgradecattlev1.Plan {
const (
planImage = "registry.suse.com/bci/bci-base:15.5"
)
Expand Down

0 comments on commit 58074e9

Please sign in to comment.