Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release-ocm-2.8] MGMT-15034: MGMT-15047: use installer to deploy on …
…external platform (#5490) * MGMT-15034: Fix patch of infrastructure CR with external platform (#5312) Patch directly the Infrastructure CR from PostCreateManifestsHook function which makes it easier to test. This part of the code is a workaround until the openshift installer supports external platform. * MGMT-15047: use installer to deploy on external platform (#5381) 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
ad21c9e
commit 4156577
Showing
5 changed files
with
24 additions
and
50 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package external | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestProviderRegistry(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "ProviderExternal test") | ||
} |
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,53 +1,13 @@ | ||
package external | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/openshift/assisted-service/internal/common" | ||
) | ||
|
||
// 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 { | ||
p.Log.Info("Patching infrastructure object") | ||
|
||
platformName := string(p.platformType) | ||
clusterInfraPatch := fmt.Sprintf(clusterInfraPatchTemplate, platformName) | ||
|
||
clusterInfraPatchPath := filepath.Join(workDir, "manifests", "cluster-infrastructure-02-config.yml.patch_01_configure_external_platform") | ||
err := os.WriteFile(clusterInfraPatchPath, []byte(clusterInfraPatch), 0600) | ||
if err != nil { | ||
p.Log.Error("Couldn't write infrastructure patch %v", clusterInfraPatchPath) | ||
return err | ||
} | ||
|
||
return nil | ||
} |
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