Are there any potential impact with old Container Registry path in Cloud run YAML?

Hi all, I am working on migrating all docker images from the Container Registry to the Artifact Registry and noticed a few lines in Cloud Run YAML still contain paths for the Container Registry. If anyone could advise about the following questions, it would be highly appreciated.

  • How does the Cloud Build use annotation paths representing a Container Registry path from the YAML after migrating into the Artifact Registry?

  • YAML Example in Cloud Run;

  • metadata:
      name: sample-project
      namespace: '20344253xxxx'
      selfLink: /apis/serving.knative.dev/v1/namespaces/20344253xxxx/services/sample-project
      uid: 521db695-255f-42c3-b015-d2241xxxxxxx
      resourceVersion: AAYEzhtpxxx
      generation: 859
      creationTimestamp: '2021-08-11T04:31:18.087167Z'
      labels:
        run.googleapis.com/satisfiesPzs: 'true'
        cloud.googleapis.com/location: australia-southeast1
      annotations:
        run.googleapis.com/client-name: gcloud
        serving.knative.dev/creator: 20344253xxxx@cloudbuild.gserviceaccount.com
        serving.knative.dev/lastModifier: 20344253xxxx@cloudbuild.gserviceaccount.com
      **client.knative.dev/user-image: gcr.io/sandpit/sample-project:aa2782e <-------- Container registry path**
    ...
    spec:
          containerConcurrency: 80
          timeoutSeconds: 300
          serviceAccountName: sample-project@sandpit.iam.gserviceaccount.com
          containers:
          - **image: australia-southeast1-docker.pkg.dev/sandpit/sandpit-repo/sample-project:ec1773f <-------- Artifact Registry path after building**
            ports:
            - name: http1
              containerPort: 8080
    ...
    
  • Will our project get any further impacts when the image path at the annotations (client.knative.dev/user-image: Google Cloud console from the above example) is deleted?

    Thank you for your time to read this out!

Hi @user19283045 ,

Welcome to Google Cloud Community!

To answer your questions:

  1. Impact of Old Container Registry Paths in Cloud Run YAML:
  • The old Container Registry paths in your Cloud Run YAML file may not cause any immediate issues as long as the images are still available in the Container Registry.
  • However, it’s essential to update these paths to the new Artifact Registry paths for clarity and to ensure that Cloud Run can pull the images correctly.
  1. Cloud Build Annotations:
  • Annotations in the Cloud Build output can contain paths to container images. If you’ve migrated your images to Artifact Registry, you should update any annotations or references in your build scripts to reflect the new image paths in Artifact Registry.
  1. Impact of Deleting Old Container Registry Images:
  • If you delete the images from the old Container Registry (gcr.io), it will impact any services, deployments, or configurations that rely on those images.
  • Specifically, if you delete the image referenced in the client.knative.dev/user-image annotation, and your Cloud Run service is currently using that image, the service may not be able to start or may fail to update when scaling or redeploying.
  • Therefore, before deleting any images from the old Container Registry, ensure that all references in your Cloud Run YAML and other configurations are updated to use the new Artifact Registry paths.

Tips:

  • Update your Cloud Run YAML to use the correct Artifact Registry paths for container images.
  • Ensure any annotations or references in Cloud Build scripts also use the new Artifact Registry paths.
  • Be cautious when deleting old Container Registry images, as it could disrupt services and deployments relying on those images. Make sure all references are updated before deletion.

Hope this helps!

1 Like