regroup steps into 2 phases; more accurate names

This commit is contained in:
Nils Elde 2020-03-06 15:23:51 -05:00
Родитель 6427234d3f
Коммит 0aa3b66828
6 изменённых файлов: 15 добавлений и 21 удалений

Просмотреть файл

@ -137,7 +137,6 @@ type InstallPhase int
// InstallPhase constants.
const (
InstallPhaseDeployStorage InstallPhase = iota
InstallPhaseDeployResources
InstallPhaseBootstrap InstallPhase = iota
InstallPhaseRemoveBootstrap
)

Просмотреть файл

@ -416,12 +416,12 @@ func TestOpenShiftClusterStaticValidateDelta(t *testing.T) {
return &OpenShiftCluster{
Properties: Properties{
Install: &Install{
Phase: InstallPhaseDeployStorage,
Phase: InstallPhaseBootstrap,
},
},
}
},
modify: func(oc *OpenShiftCluster) { oc.Properties.Install.Phase = InstallPhaseDeployResources },
modify: func(oc *OpenShiftCluster) { oc.Properties.Install.Phase = InstallPhaseRemoveBootstrap },
wantErr: "400: PropertyChangeNotAllowed: properties.install.phase: Changing property 'properties.install.phase' is not allowed.",
},
{

Просмотреть файл

@ -213,7 +213,6 @@ type InstallPhase int
// InstallPhase constants
const (
InstallPhaseDeployStorage InstallPhase = iota
InstallPhaseDeployResources
InstallPhaseBootstrap InstallPhase = iota
InstallPhaseRemoveBootstrap
)

Просмотреть файл

@ -66,7 +66,7 @@ func ExampleOpenShiftClusterDocument() *OpenShiftClusterDocument {
},
Install: &Install{
Now: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
Phase: InstallPhaseDeployStorage,
Phase: InstallPhaseBootstrap,
},
StorageSuffix: "rexs1",
SSHKey: SecureBytes("ssh-key"),

Просмотреть файл

@ -7,9 +7,9 @@ import (
"fmt"
)
const _InstallPhaseName = "InstallPhaseDeployStorageInstallPhaseDeployResourcesInstallPhaseRemoveBootstrap"
const _InstallPhaseName = "InstallPhaseBootstrapInstallPhaseRemoveBootstrap"
var _InstallPhaseIndex = [...]uint8{0, 25, 52, 79}
var _InstallPhaseIndex = [...]uint8{0, 21, 48}
func (i InstallPhase) String() string {
if i < 0 || i >= InstallPhase(len(_InstallPhaseIndex)-1) {
@ -18,12 +18,11 @@ func (i InstallPhase) String() string {
return _InstallPhaseName[_InstallPhaseIndex[i]:_InstallPhaseIndex[i+1]]
}
var _InstallPhaseValues = []InstallPhase{0, 1, 2}
var _InstallPhaseValues = []InstallPhase{0, 1}
var _InstallPhaseNameToValueMap = map[string]InstallPhase{
_InstallPhaseName[0:25]: 0,
_InstallPhaseName[25:52]: 1,
_InstallPhaseName[52:79]: 2,
_InstallPhaseName[0:21]: 0,
_InstallPhaseName[21:48]: 1,
}
// InstallPhaseString retrieves an enum value from the enum constants string name.

Просмотреть файл

@ -137,14 +137,11 @@ func NewInstaller(ctx context.Context, log *logrus.Entry, env env.Interface, db
// Install installs an ARO cluster
func (i *Installer) Install(ctx context.Context, installConfig *installconfig.InstallConfig, platformCreds *installconfig.PlatformCreds, image *releaseimage.Image) error {
steps := map[api.InstallPhase][]interface{}{
api.InstallPhaseDeployStorage: {
api.InstallPhaseBootstrap: {
action(i.createDNS),
action(func(ctx context.Context) error {
return i.installStorage(ctx, installConfig, platformCreds, image)
}),
action(i.incrInstallPhase),
},
api.InstallPhaseDeployResources: {
action(i.installResources),
action(i.createPrivateEndpoint),
action(i.updateAPIIP),
@ -167,11 +164,11 @@ func (i *Installer) Install(ctx context.Context, installConfig *installconfig.In
action(i.updateRouterIP),
action(i.configureIngressCertificate),
condition{i.ingressControllerReady, 30 * time.Minute},
action(i.endOfInstallPhase),
action(i.finishInstallation),
},
}
err := i.startInstallPhase(ctx)
err := i.startInstallation(ctx)
if err != nil {
return err
}
@ -205,7 +202,7 @@ func (i *Installer) Install(ctx context.Context, installConfig *installconfig.In
return nil
}
func (i *Installer) startInstallPhase(ctx context.Context) error {
func (i *Installer) startInstallation(ctx context.Context) error {
var err error
i.doc, err = i.db.PatchWithLease(ctx, i.doc.Key, func(doc *api.OpenShiftClusterDocument) error {
if doc.OpenShiftCluster.Properties.Install == nil {
@ -225,7 +222,7 @@ func (i *Installer) incrInstallPhase(ctx context.Context) error {
return err
}
func (i *Installer) endOfInstallPhase(ctx context.Context) error {
func (i *Installer) finishInstallation(ctx context.Context) error {
var err error
i.doc, err = i.db.PatchWithLease(ctx, i.doc.Key, func(doc *api.OpenShiftClusterDocument) error {
doc.OpenShiftCluster.Properties.Install = nil