Skip to content

Commit

Permalink
Merge pull request #271 from gthiemonge/fix-amphora-upload
Browse files Browse the repository at this point in the history
Fix amphora upload
  • Loading branch information
openshift-merge-bot[bot] authored Mar 19, 2024
2 parents ba81127 + fe1c562 commit 8675466
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions api/v1beta1/octavia_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/octavia/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ const (
OctaviaInternalPort int32 = 9876

// ApacheInternalPort -
ApacheInternalPort int32 = 8080
ApacheInternalPort int32 = 80
)
9 changes: 5 additions & 4 deletions pkg/octavia/image_upload_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (
)

func getVolumes(name string) []corev1.Volume {
var config0640AccessMode int32 = 0640

return []corev1.Volume{
{
Name: "amphora-image",
Expand All @@ -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",
},
},
},
Expand Down
5 changes: 3 additions & 2 deletions pkg/octavia/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8675466

Please sign in to comment.