Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable passing user ca bundle data as file to rosa #2713

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions pkg/common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,15 @@ var Proxy = struct {
HttpsProxy string
// The HTTP Proxy address to use for proxy tests.
HttpProxy string
// The User CA Bundle to use for proxy tests.
// Path to User CA Bundle to use for proxy tests.
UserCABundle string
// User CA Bundle to use for proxy tests.
UserCABundleData string
}{
HttpsProxy: "proxy.https_proxy",
HttpProxy: "proxy.http_proxy",
UserCABundle: "proxy.user_ca_bundle",
HttpsProxy: "proxy.https_proxy",
HttpProxy: "proxy.http_proxy",
UserCABundle: "proxy.user_ca_bundle",
UserCABundleData: "proxy.user_ca_bundle_data",
}

func InitOSDe2eViper() {
Expand Down Expand Up @@ -937,6 +940,11 @@ func InitOSDe2eViper() {

_ = viper.BindEnv(Proxy.UserCABundle, "USER_CA_BUNDLE")
RegisterSecret(Proxy.UserCABundle, "user-ca-bundle")

// If ca bundle is provided directly, save it in a temp file to provide to rosa create cluster.
_ = viper.BindEnv(Proxy.UserCABundleData, "USER_CA_BUNDLE_DATA")
filepath := WriteSecret(Proxy.UserCABundleData)
viper.Set(Proxy.UserCABundle, filepath)
}

func init() {
Expand All @@ -945,6 +953,14 @@ func init() {
InitGCPViper()
}

func WriteSecret(name string) string {
tmpDir, _ := os.MkdirTemp("", "")
tmpFile, _ := os.CreateTemp(tmpDir, name+"-*")
_, _ = tmpFile.WriteString(viper.GetString(name))
_ = tmpFile.Close()
return tmpFile.Name()
}

// PostProcess is a variety of post-processing commands that is intended to be run after a config is loaded.
func PostProcess() {
// Set REPORT_DIR to ARTIFACTS if ARTIFACTS is set.
Expand Down
2 changes: 1 addition & 1 deletion scripts/gap-analysis-jobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker create --name "${CONTAINER_NAME}" -e OCM_TOKEN \
-e SUBNET_IDS \
-e TEST_HTTP_PROXY \
-e TEST_HTTPS_PROXY \
-e USER_CA_BUNDLE \
-e USER_CA_BUNDLE_DATA \
quay.io/redhat-services-prod/osde2e-cicada-tenant/osde2e:latest test --configs "${CONFIGS}" "${ADDITIONAL_ARGS}"

# Start the container
Expand Down
9 changes: 0 additions & 9 deletions test/sdn_migration/sdn_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,6 @@ var _ = Describe("SDN migration", ginkgo.Ordered, func() {
})
})

// getEnvVar returns the env variable value and if unset returns default provided
func getEnvVar(key, value string) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I don't think we should delete any of Courtney's stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result, exist := os.LookupEnv(key)
if exist {
return result
}
return value
}

// osdClusterReadyHealthCheck verifies the osd-cluster-ready health check job is passing
func osdClusterReadyHealthCheck(ctx context.Context, clusterClient *openshiftclient.Client, action, reportDir string) error {
var (
Expand Down