From d5ed1499c25be2f545e05c358637099e2073c119 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Tue, 19 Mar 2024 05:48:55 -0400 Subject: [PATCH 1/4] Fix ApacheInternalPort Set ApacheInternalPort to 80, glance doesn't allow uploading using port 8080 unless its configuration is tuned. --- pkg/octavia/const.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/octavia/const.go b/pkg/octavia/const.go index 056ef327..dba0002c 100644 --- a/pkg/octavia/const.go +++ b/pkg/octavia/const.go @@ -45,5 +45,5 @@ const ( OctaviaInternalPort int32 = 9876 // ApacheInternalPort - - ApacheInternalPort int32 = 8080 + ApacheInternalPort int32 = 80 ) From f525be144cadca7fa9ad28b76caa5f04b90f1647 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Tue, 19 Mar 2024 05:49:25 -0400 Subject: [PATCH 2/4] Fix config-data volume for amphora upload config-data is now stored as a secret --- pkg/octavia/image_upload_deployment.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/octavia/image_upload_deployment.go b/pkg/octavia/image_upload_deployment.go index 080be7b7..5ed7a418 100644 --- a/pkg/octavia/image_upload_deployment.go +++ b/pkg/octavia/image_upload_deployment.go @@ -36,6 +36,8 @@ const ( ) func getVolumes(name string) []corev1.Volume { + var config0640AccessMode int32 = 0640 + return []corev1.Volume{ { Name: "amphora-image", @@ -46,10 +48,9 @@ func getVolumes(name string) []corev1.Volume { { Name: "httpd-config", VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: fmt.Sprintf("%s-config-data", name), - }, + Secret: &corev1.SecretVolumeSource{ + DefaultMode: &config0640AccessMode, + SecretName: name + "-config-data", }, }, }, From f6ba4e481921c5d5483ee856e5a7616d0b2d5434 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Tue, 19 Mar 2024 05:50:30 -0400 Subject: [PATCH 3/4] Fix missing image ID on existing amphora Fixed a bug with existing images ID, added better logs and error handling --- pkg/octavia/images.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/octavia/images.go b/pkg/octavia/images.go index 3be46668..7535266a 100644 --- a/pkg/octavia/images.go +++ b/pkg/octavia/images.go @@ -110,7 +110,7 @@ func ensureAmphoraImage( URI: amphoraImage.URL, } - log.Info(fmt.Sprintf("Uploading image %s", amphoraImage.Name)) + log.Info(fmt.Sprintf("Uploading image %s %s (%s)", amphoraImage.Name, amphoraImage.ID, amphoraImage.URL)) err := imageimport.Create(imageClient, amphoraImage.ID, imageImportCreateOpts).ExtractErr() if err != nil { return false, err @@ -216,12 +216,13 @@ func EnsureAmphoraImages( var existingImageStatus string if existingImage, ok := existingAmphoraImages[amphoraImage.Name]; ok { existingImageStatus = string(existingImage.Status) + amphoraImage.ID = existingImage.ID } else { existingImageStatus = "none" } ready, err := ensureAmphoraImage(imageClient, log, amphoraImage, existingImageStatus) if err != nil { - return false, err + return false, fmt.Errorf("error while uploading the amphora images: %w", err) } if !ready { imagesReady = false From fe1c56260f31fff3857b0e845ca81a2319832ae1 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Tue, 19 Mar 2024 06:00:58 -0400 Subject: [PATCH 4/4] Set AmphoraContainerImage default value --- api/v1beta1/octavia_webhook.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/v1beta1/octavia_webhook.go b/api/v1beta1/octavia_webhook.go index 0c05a574..c0e2ca3d 100644 --- a/api/v1beta1/octavia_webhook.go +++ b/api/v1beta1/octavia_webhook.go @@ -76,6 +76,9 @@ func (spec *OctaviaSpec) Default() { if spec.OctaviaWorker.ContainerImage == "" { spec.OctaviaWorker.ContainerImage = octaviaDefaults.WorkerContainerImageURL } + if spec.ApacheContainerImage == "" { + spec.ApacheContainerImage = octaviaDefaults.ApacheContainerImageURL + } } // Default - set defaults for this Octavia core spec (this version is used by the OpenStackControlplane webhook)