1
0
mirror of synced 2025-12-19 18:05:53 -05:00
Files
sense-installer/pkg/qliksense/upgrade.go
2020-06-23 09:38:45 -04:00

45 lines
995 B
Go

package qliksense
import (
"fmt"
qapi "github.com/qlik-oss/sense-installer/pkg/api"
)
func (q *Qliksense) UpgradeQK8s(cleanPatchFiles bool) error {
// step1: get CR
// step2: run kustomize
// step3: run kubectl apply
// fetch the version
qConfig := qapi.NewQConfig(q.QliksenseHome)
if cleanPatchFiles {
if err := q.DiscardAllUnstagedChangesFromGitRepo(qConfig); err != nil {
fmt.Printf("error removing temporary changes to the config: %v\n", err)
}
}
qcr, err := qConfig.GetCurrentCR()
if err != nil {
fmt.Println("cannot get the current-context cr", err)
return err
}
dcr, err := qConfig.GetDecryptedCr(qcr)
if err != nil {
return err
}
if dcr.Spec.Git != nil && dcr.Spec.Git.Repository != "" {
// fetching and applying manifest will be in the operator controller
// get decrypted cr
return q.applyCR(dcr)
}
err = q.applyConfigToK8s(dcr)
if err != nil {
fmt.Println("cannot do kubectl apply on manifests")
return err
}
return q.applyCR(dcr)
}