Skip to content

Commit

Permalink
Fix uploadproxy override in cluster-sync (#3306)
Browse files Browse the repository at this point in the history
* Fix uploadproxy override in cluster-sync

Compare to kubevirt's:
https://github.com/kubevirt/kubevirt/blob/main/hack/cluster-deploy.sh#L53-L56

Signed-off-by: Edu Gómez Escandell <[email protected]>

* Remove https prefixing of proxy URL in functional tests

Signed-off-by: Edu Gómez Escandell <[email protected]>

* Tests prefix the upload proxy URL with https:// when necessary

Signed-off-by: Edu Gómez Escandell <[email protected]>

---------

Signed-off-by: Edu Gómez Escandell <[email protected]>
  • Loading branch information
EduardGomezEscandell authored Jun 23, 2024
1 parent 301f0ab commit b887d87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cluster-sync/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function wait_cdi_available {

function configure_uploadproxy_override {
host_port=$(./cluster-up/cli.sh ports uploadproxy | xargs)
override="127.0.0.1:$host_port"
override="https://127.0.0.1:$host_port"
_kubectl patch cdi ${CR_NAME} --type=merge -p '{"spec": {"config": {"uploadProxyURLOverride": "'"$override"'"}}}'
}

Expand Down
12 changes: 9 additions & 3 deletions tests/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,10 +989,16 @@ func uploadFileNameToPathWithClient(client *http.Client, requestFunc uploadFileN
func findProxyURLCdiConfig(f *framework.Framework) string {
config, err := f.CdiClient.CdiV1beta1().CDIConfigs().Get(context.TODO(), common.ConfigName, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
if config.Status.UploadProxyURL != nil {
return fmt.Sprintf("https://%s", *config.Status.UploadProxyURL)
if config.Status.UploadProxyURL == nil {
return ""
}
return ""
if strings.HasPrefix(*config.Status.UploadProxyURL, "http://") {
return *config.Status.UploadProxyURL
}
if strings.HasPrefix(*config.Status.UploadProxyURL, "https://") {
return *config.Status.UploadProxyURL
}
return "https://" + *config.Status.UploadProxyURL
}

func HasVolumeFromSecret(pod *v1.Pod, name string, secret *v1.Secret) bool {
Expand Down

0 comments on commit b887d87

Please sign in to comment.