-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MGMT-15047: use installer to deploy on external platform
Use the installer to deploy the external platform, and cleanup the previous hack. Remove the feature set as the external platform is now stable.
- Loading branch information
1 parent
6a583ef
commit 4a29b3d
Showing
5 changed files
with
11 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,13 @@ | ||
package external | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/openshift/assisted-service/internal/common" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
// Workaround as openshift installer does not support the external platform. | ||
// The trick is to generate the manifests with platform=none and patch | ||
// the insfrastructure object with the external platform. | ||
const ( | ||
clusterInfraPatchTemplate = `--- | ||
- op: replace | ||
path: /spec/platformSpec | ||
value: | ||
type: External | ||
external: | ||
platformName: %s | ||
- op: replace | ||
path: /status/platform | ||
value: External | ||
- op: replace | ||
path: /status/platformStatus | ||
value: | ||
type: External | ||
external: | ||
cloudControllerManager: | ||
state: External` | ||
) | ||
|
||
func (p externalProvider) PreCreateManifestsHook(cluster *common.Cluster, envVars *[]string, workDir string) error { | ||
return nil | ||
} | ||
|
||
func (p externalProvider) PostCreateManifestsHook(cluster *common.Cluster, envVars *[]string, workDir string) error { | ||
|
||
platformName := string(p.platformType) | ||
clusterInfraPatch := fmt.Sprintf(clusterInfraPatchTemplate, platformName) | ||
|
||
p.Log.Infof("Patching Infrastructure CR with external platform: platformName=%s", platformName) | ||
|
||
infraManifest := filepath.Join(workDir, "manifests", "cluster-infrastructure-02-config.yml") | ||
data, err := os.ReadFile(infraManifest) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to read Infrastructure Manifest \"%s\"", infraManifest) | ||
} | ||
p.Log.Infof("read the infrastructure manifest at %s", infraManifest) | ||
|
||
data, err = common.ApplyYamlPatch(data, []byte(clusterInfraPatch)) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to patch Infrastructure Manifest \"%s\"", infraManifest) | ||
} | ||
p.Log.Infof("applied the yaml patch to the infrastructure manifest at %s: \n %s", infraManifest, string(data[:])) | ||
|
||
err = os.WriteFile(infraManifest, data, 0600) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to write Infrastructure Manifest \"%s\"", infraManifest) | ||
} | ||
p.Log.Infof("wrote the resulting infrastructure manifest at %s", infraManifest) | ||
|
||
return nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters