11package kubernetes
22
33import (
4- "fmt"
5- "os"
6-
74 "github.com/DataDog/test-infra-definitions/common/config"
85 "github.com/DataDog/test-infra-definitions/common/utils"
96 "github.com/DataDog/test-infra-definitions/components"
107 "github.com/DataDog/test-infra-definitions/components/command"
118 oscomp "github.com/DataDog/test-infra-definitions/components/os"
129 "github.com/DataDog/test-infra-definitions/components/remote"
1310 "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
14- sdkconfig "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
1511)
1612
17- func NewLocalOpenShiftCluster (env config.Env , name string , opts ... pulumi.ResourceOption ) (* Cluster , error ) {
13+ func NewLocalOpenShiftCluster (env config.Env , name string , pullSecretPath string , opts ... pulumi.ResourceOption ) (* Cluster , error ) {
1814 return components .NewComponent (env , name , func (clusterComp * Cluster ) error {
15+ openShiftClusterName := env .CommonNamer ().DisplayName (49 )
1916 opts = utils .MergeOptions [pulumi.ResourceOption ](opts , pulumi .Parent (clusterComp ))
2017 commonEnvironment := env
2118 runner := command .NewLocalRunner (env , command.LocalRunnerArgs {
2219 OSCommand : command .NewUnixOSCommand (),
2320 })
2421
25- pullSecretPath := os .Getenv ("PULL_SECRET_PATH" )
26- if pullSecretPath == "" {
27- return fmt .Errorf ("PULL_SECRET_PATH environment variable is not set" )
28- }
29-
3022 crcSetup , err := runner .Command (commonEnvironment .CommonNamer ().ResourceName ("crc-setup" ), & command.Args {
3123 Create : pulumi .String ("crc setup" ),
3224 }, opts ... )
@@ -52,21 +44,18 @@ func NewLocalOpenShiftCluster(env config.Env, name string, opts ...pulumi.Resour
5244 }
5345
5446 clusterComp .KubeConfig = kubeConfigCmd .StdoutOutput ()
55- clusterComp .ClusterName = pulumi . String ( "openshift" ) .ToStringOutput ()
47+ clusterComp .ClusterName = openShiftClusterName .ToStringOutput ()
5648 return nil
5749 }, opts ... )
5850}
5951
60- func NewOpenShiftCluster (env config.Env , vm * remote.Host , name string , opts ... pulumi.ResourceOption ) (* Cluster , error ) {
52+ func NewOpenShiftCluster (env config.Env , vm * remote.Host , name string , pullSecretPath string , opts ... pulumi.ResourceOption ) (* Cluster , error ) {
6153 return components .NewComponent (env , name , func (clusterComp * Cluster ) error {
6254 openShiftClusterName := env .CommonNamer ().DisplayName (49 )
6355 opts = utils .MergeOptions [pulumi.ResourceOption ](opts , pulumi .Parent (clusterComp ))
6456 runner := vm .OS .Runner ()
6557 commonEnvironment := env
6658
67- infraConfig := sdkconfig .New (env .Ctx (), "ddinfra" )
68- pullSecretPath := infraConfig .Require ("openShiftPullSecretPath" )
69-
7059 openShiftInstallBinary , err := InstallOpenShiftBinary (env , vm , opts ... )
7160 if err != nil {
7261 return err
0 commit comments