Commit Graph

43 Commits

Author SHA1 Message Date
Jeremy Cline
15b054fc8a fedora-image-uploader: fix deployment trigger on image changes
I broke the trigger when I switched from one container to multiple
containers in the pod. Syntax-wise, I found this multi-line variant in
the CoreOS Cincinnati deployment config, and it seems like there's not a
way to say "all container images in the spec". Or there might be, but I
couldn't find an example or documentation.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2025-05-09 11:37:35 -04:00
Jeremy Cline
0571feb2ce fedora-image-uploader: deploy as multiple containers
In the beginning, this just handled Azure images. Now it does Azure,
AWS, GCP, and containers. Currently, it processes images serially, which
is mostly okay. However, it does mean that whatever service is handled
last has to wait for all the others to succeed before it starts, and it
also means if any of the handlers for their respective platform fail, it
retries *all* the images again. For most things this is a no-op (or a
few inexpensive calls), but it does have to re-download the image from
Koji to checksum it.

This adds an AMQP message queue for each content type we handle, and
produces a fedora-messaging config for each content type. The deployment
is now made up of 4 containers: azure-image-uploader,
aws-image-uploader, container-image-uploader, and
google-cloud-image-uploader. They only differ in the secrets injected
into them and the fedora-messaging config file they use. The end result
is that images should be available faster and its more resilient to
remote services being down.

Finally, it's worth noting that this bumps the warning threshold for
queue sizes. It can take some services (Azure and AWS) upwards of 30
minutes to replicate the images around the world, and since we subscribe
to _any_ compose status changes, it's not unreasonable for 5-10 messages
to stack up when we hit a compose change that is "FINISHED" with images.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2025-04-29 18:25:08 +00:00
Adam Williamson
d1728cd3d1 cloud-image-uploader: update container image config for IoT changes
We finally merged https://pagure.io/fedora-iot/pungi-iot/pull-request/102
which changes the properties of the container images built in the
IoT compose. This should adjust to that and publish both the base
and IoT images, if we got it all right.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-04-22 13:48:14 -07:00
Jeremy Cline
7a64016377 fedora-image-uploader: Enable GCP image uploads in production
Configure uploading images to Google Cloud.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2025-03-24 11:23:14 -04:00
Jeremy Cline
5dabb7c3b5 fedora-image-uploader: Fix Google Cloud credential path
I used the wrong name for the file being mounted in the volume. This
will fix the image uploader boot-looping in staging.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2025-03-20 17:02:34 +00:00
Jeremy Cline
3c6ab8afd8 fedora-image-uploader: add Google Compute Engine support for staging
This enables support for uploading images to Google Cloud in staging.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2025-03-19 21:10:14 +00:00
Ryan Lerch
d4e85c5312 cloud-image-uploader - rename templates to .j2
Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-14 08:37:30 +10:00
Ryan Lerch
89f6f1fc32 Fix majority of remaining yamllint warnings and errors
Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2024-11-28 17:31:45 +10:00
Jeremy Cline
6baf164a3d fedora-image-uploader: handle all container repos
Now that the F41 freeze is over, switch container pushes over to
fedora-image-uploader for the remaining repositories.

This also renames the Onyx and Sericea repositories to make it clear
what they are.

Signed-off-by: Jeremy Cline <jeremycline@linux.microsoft.com>
2024-11-14 20:40:55 +00:00
Jeremy Cline
38fa375e0a fedora-image-uploader: add configuration for prod container uploading
We've finally ironed out the issues in stage with this, so this is the
configuration to enable it in production.

This should be rolled out in conjunction with disabling the bash script
that currently handles image pushes.
2024-10-08 20:10:00 +00:00
Adam Williamson
349730a38a c-i-u: try 'name' not 'secretName' when projecting secrets
This is what's in the docs, and it blew up with secretName...

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2024-10-04 13:31:06 -07:00
Jeremy Cline
f8cad3cd92 fedora-image-uploader: Add the push cert for registry.fedoraproject.org
To push images, we need to use a client certificate and key[0]. Add
those to the image uploader container.

[0] 7a10d32e16/f/playbooks/groups/releng-compose.yml (_144)
2024-10-04 16:17:18 -04:00
Jeremy Cline
c443794a41 fedora-image-uploader: Adjust stage registry URL
The container can't reach the old URL, but can talk to this one.
2024-10-04 11:52:08 -04:00
Jeremy Cline
09e774f4a9 Reapply "fedora-image-uploader: Add staging config for container uploads"
This reverts commit 15dbcbb7ac, which was
a revert of commit 5e0ad1134d (pr #2200).

Adam Williamson got rid of the need for buildah so hopefully we won't
run into lots of permission issues.
2024-10-03 22:45:13 +00:00
Jeremy Cline
637e92fe11 fedora-image-uploader: Drop unused config options for AWS images
The AMI description setting wasn't actually being used.

More importantly, however, is the AMI volume size is now also unused.
The reason for this is that when we import the image, the default is to
use the snapshot's size as the volume size, but you can optionally set
it to something else. AWS pre-allocates volumes of a couple different
sizes (currently 1G, 5G, 8G, and 10G).

Folks building the image set the size to be 5G, but this setting
(carried over from fedimg) overrode it. Dropping it lets them control
the AMI size by adjusting how big the images are. Probably not optimal
for upload speed, but less confusing since there are fewer configuration
layers people might not be aware of.
2024-09-24 18:25:08 +00:00
Jeremy Cline
15dbcbb7ac Revert "fedora-image-uploader: Add staging config for container uploads"
This reverts commit 5e0ad1134d (pr #2200).

Unfortunately, using buildah inside an unprivileged OpenShift container
turns out to not be very simple, even though we're not building any
containers, just importing and pushing them.

We can either figure out how to make it work with OpenShift (and while
it is definitely possible, I don't know if folks are okay with the
compromises that might be required) or deploy it in a VM for now.

In the meantime, the staging container is bootlooping so I'd like to
back this configuration out for the sake of my inbox.
2024-09-20 10:01:51 -04:00
Jeremy Cline
5e0ad1134d fedora-image-uploader: Add staging config for container uploads
Upload images to the stage registry. Rather than massaging the
credentials into the format written out by podman-login, just pass the
credentials in and have the app run podman-login with them. The
configuration includes the registry along with the prefix used for the
environment variables containing the credentials.
2024-09-18 19:43:42 +00:00
Jeremy Cline
8fe5517885 fedora-image-uploader: publish AWS messages when images are uploaded
I had hoped to get some feedback on the message schema, but perhaps the
easiest way is to publish these and figure out if anything is missing or
wrong. We can always update the schema.
2024-08-14 22:40:58 +00:00
Jeremy Cline
eaba6a35e6 Enable AWS image uploads in production
Now that AWS image uploads work in staging, enable them in production
via the config. A functional build is already deployed to OpenShift in
prod, but since there is no AWS config it won't do anything until we
merge and deploy this.
2024-08-13 23:10:39 +00:00
Jeremy Cline
471599c785 fedora-image-uploader: Publish AMQP messages for published Azure images
This enables publishing messages whenever we upload an Azure image.
2024-07-03 11:52:56 +00:00
Kevin Fenzi
3d98cbbd03 fedimg: change staging bucket name
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2024-06-24 14:47:30 -07:00
Kevin Fenzi
c1d34ab1d6 cloud-image-uploader: just set volume size to 6 for now
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2024-06-24 12:59:57 -07:00
Jeremy Cline
2e2d141320 fedora-image-uploader: Add AWS configuration for staging
This will enable AWS support on staging. It remains off in production.
2024-06-24 15:20:18 -04:00
Jeremy Cline
858ab494c3 Add AWS credentials to the cloud-image-uploader
For now, just re-use the fedimg credentials.

Note that currently the AWS support is not enabled so nothing makes use
of these credentials just yet.
2024-06-24 15:10:59 -04:00
Jeremy Cline
a0db292af2 fedora-image-uploader: configure message publishing
The service will soon emit messages when new images are uploaded. This
grants it access to publish under the fedora_image_uploader topic.

Specific topics under the org.fedoraproject.prod prefix look like:

  fedora_image_uploader.azure.Fedora-Cloud-40.aarch64
  fedora_image_uploader.container.fedora.f40
2024-06-18 22:33:43 +00:00
Jeremy Cline
f0f0062de1 fedora-image-uploader: Fix config for new package name
The Python package was renamed[0] upstream. Because the container
contains a default CMD that was updated to reference the new callback
path, the only thing that broke in production was the logging.

[0] https://pagure.io/cloud-image-uploader/pull-request/15
2024-06-17 09:45:36 +00:00
Jeremy Cline
9c2a1fb270 fedora-image-uploader: Add log handler to email errors 2024-06-12 07:26:36 +00:00
Jeremy Cline
d54c08c67a cloud-image-uploader: Switch to Pungi compose messages
The cloud-image-uploader uses Pungi compose messages starting with
v0.3.0. This switches the routing keys and also adds a one-off task to
remove the queue before re-adding it to flush out any queued up messages
and remove the old topic bindings.
2024-05-07 15:19:23 +00:00
Neil Hanlon
bafcded29e fix(os:cloud-image-uploader): set workingDir on container
The latest import failed due to "ERROR: Unable to create local
directories(/.ansible/tmp): [Errno 13] Permission denied: b'/.ansible'".
Which implies the code is being executed from `/`, despite the WORKDIR
variable being set in the container image--I suspect this is a quirk of
kube/openshift that was not expected.

This change sets the workingDir to /srv/cloud-uploader, as specified in
the Containerfile, which should resolve the execution error.

Signed-off-by: Neil Hanlon <neil@shrug.pw>
2024-04-20 20:47:16 +00:00
Jeremy Cline
79935add66 cloud-image-uploader: Fix routing key for AMQP binding
env renders to "production" which is not what messages are published
under ("prod"). Match what other apps are doing and just use a wildcard
so it'll match anything. Since prod and stage are separate brokers this
is fine.
2024-04-17 11:10:46 -04:00
Jeremy Cline
d89d0d22cf cloud-image-uploader: replicate production images beyond eastus
The image needs to be replicated to a region to be usable in that
region. It's likely we'll want to expand this list and potentially add
logic to the uploader to not replicate nightly images until they are
promoted to the latest image in the stream so I've templated it it
in the configuration.
2024-04-16 12:20:04 -04:00
Jeremy Cline
1072599f35 cloud-image-uploader: change prod storage account name
Storage account names need to be globally unique. It seems fedoraimages
was already taken, so I've adjusted it to one that's not taken. It's
only used to import the images so the name doesn't really matter.
2024-04-16 12:20:02 -04:00
Jeremy Cline
ea9efa2ffc cloud-image-uploader: fix the final queue reference
I forgot queues are declared separately from the bindings.
2024-04-10 17:16:31 -04:00
Jeremy Cline
e086b2fe93 cloud-image-uploader: azure gallery names are unique per subscription
I assumed gallery names were unique per resource group, but this is not
the case. They're unique per subscription, oddly, so we need to use a
different name in staging.
2024-04-10 17:16:26 -04:00
Jeremy Cline
6d9f9ecc68 cloud-image-uploader: change rabbitmq name to match CN in certificate
The client certificate contains "cloud-image-uploader.stg" for the CN,
so our RabbitMQ name needs to match. Additionally, the queue name needs
to start with the username, so we need to adjust that as well.
2024-04-10 13:32:01 -04:00
Francois Andrieu
ce0f875245 cloud-image-uploader: fix deployment trigger & remove rollout 2024-04-10 18:23:41 +02:00
Jeremy Cline
76285355d6 cloud-image-uploader: fix up queue name
The queue name needs to match the queue name we defined in the playbook
that creates the user and queue.
2024-04-10 11:55:48 -04:00
Jeremy Cline
07be198d0a cloud-image-uploader fix TLS settings for fedora-messaging
These need to match the "key" used in the playbook that creates the
secret files.
2024-04-10 11:03:28 -04:00
Kevin Fenzi
59c2360268 cloud-image-uploader: pull image from local openshift registry
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2024-04-09 16:37:19 -07:00
Kevin Fenzi
8f16ad59fd cloud-image-uploader: Add matchLabels attribute
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2024-04-09 16:25:58 -07:00
Jeremy Cline
30b24d38ef cloud-image-uploader: use stringData instead of data
I mis-read the docs and data needs to be base64 encoded, stringData will
handle it for you.
2024-04-09 19:13:57 -04:00
Jeremy Cline
cf9b6065db cloud-image-uploader: swap staging and prod blocks in config
These were all backwards, setting prod settings in stage and stage
settings in prod.
2024-04-09 23:01:08 +00:00
Jeremy Cline
e564d0c2da Add a role and playbook for the cloud-image-uploader
This app is an AQMP client that uploads VM images to public clouds. It
currently supports Azure images.

Ref: https://pagure.io/fedora-infrastructure/issue/11860
2024-04-09 23:01:08 +00:00