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

feat(dockerhub-mirror) set up a new dedicated ACR to mirror DockerHub inside the Jenkins Azure infrastructure #794

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

dduportal
Copy link
Contributor

@dduportal dduportal commented Aug 6, 2024

Related to jenkins-infra/helpdesk#4192

Fixup of 91cf2dc

Reference Azure documentation: https://learn.microsoft.com/en-us/azure/container-registry/container-registry-artifact-cache?pivots=development-environment-azure-portal

This PR introduces an Azure Container Registry set up as a DockerHub mirror using a "Cache Rule" which mirrors docker.io/* to * (note: it forbids us to use other caching mechanism!).

This registry has the following properties:

The registry is available for the following (heavy DockerHub users) services (I've only setup the Azure ephemeral VM agents subnets for now) through a combination of (private endpoint with a NIC in the subnet + private DNS zone with automatic records + inbound and outbound NSG rules):

  • ci.jenkins.io
  • cert.ci.jenkins.io
  • trusted.jenkins.io
  • infra.jenkins.io

Azure makes it mandatory to log-in on DockerHub for such a mirror system. As such, we use a distinct token stored in an Azure Keyvault which is "Public Images Read Only" associated to the jenkinsciinfra organization to avoid the "application" rate limit (e.g. 5k pull / day / IP) and only have the DockerHub anti-abuse system as upper limit (which seems to be a combination of requests and amount of data).

Capture d’écran 2024-08-05 à 16 31 38


Testing and approving

This PR is expected to have no changes in the plan as it was applied manually:

  • End to end testing was done on each controller by:
    • Starting an Azure VM ephemeral agent using a pipeline replay with correct label
      • The pipeline tries to resolve the DNS name dockerhubmirror.azurecr.io and should resolve to an IP local to the VM subnet
    • Once the VM is up, checking the connectivity in Azure UI portal (Network Watcher -> Connection troubleshoot)
      • Source VM is the agent VM, which name is retrieved from build log
      • Destination is https://dockerhubmirror.azurecr.io
Capture d’écran 2024-08-06 à 10 42 25
  • The bootstrap must be done in 2 terraform apply commands as documented, because the ACR component CredentialSet is not supported by Terraform yet (see comments in TF code).

… inside the Jenkins Azure infrastructure

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
@dduportal
Copy link
Contributor Author

Merging to fix the Terraform errors on main branch and avoid accidental roll backs.

@timja do not hesitate to review: I'll fix any feedbacks!

@dduportal dduportal merged commit 59c4445 into jenkins-infra:main Aug 6, 2024
3 checks passed
@dduportal dduportal deleted the feat/acr/ci.jio/recreate branch August 6, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant