From 7b4b5a130568dfc90c058d1d856b845b753bc362 Mon Sep 17 00:00:00 2001
From: Evan Baker <rbtr@users.noreply.github.com>
Date: Thu, 14 Mar 2024 16:46:01 -0700
Subject: [PATCH] feat: replace ACR and MCR with GHCR (#45)

Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
---
 controller/Dockerfile.controller                    |  4 ++--
 deploy/manifests/controller/helm/retina/values.yaml | 10 +++++-----
 docs/captures/cli.md                                |  4 ++--
 docs/troubleshooting/capture.md                     |  2 +-
 hack/tools/kapinger/manifests/deploy.yaml           |  6 +++---
 pkg/capture/constants/job_specification.go          |  4 ++--
 pkg/capture/crd_to_job_test.go                      |  2 +-
 pkg/capture/utils/capture_image_test.go             |  4 ++--
 scripts/windows.ps1                                 |  2 +-
 test/goldpinger/daemonset.yaml                      |  4 ++--
 test/goldpinger/deployment.yaml                     |  2 +-
 test/integration/capture/capture_suite_test.go      |  2 +-
 test/scale/example-deployment.yaml                  |  2 +-
 test/trafficgen/kapinger.yaml                       |  4 ++--
 windows/manifests/windows.yaml                      |  2 +-
 15 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/controller/Dockerfile.controller b/controller/Dockerfile.controller
index 804252fe3c..1785ab9bfe 100644
--- a/controller/Dockerfile.controller
+++ b/controller/Dockerfile.controller
@@ -1,5 +1,5 @@
-ARG builderImage="acnpublic.azurecr.io/retina-builder:0.0.1"
-ARG toolsImage="acnpublic.azurecr.io/retina-tools:0.0.1"
+ARG builderImage="ghcr.io/microsoft/retina/retina-builder:0.0.1"
+ARG toolsImage="ghcr.io/microsoft/retina/retina-tools:0.0.1"
 
 # Stage: Build binary
 FROM --platform=$BUILDPLATFORM mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS builder
diff --git a/deploy/manifests/controller/helm/retina/values.yaml b/deploy/manifests/controller/helm/retina/values.yaml
index a4403c0a3f..70c7180665 100644
--- a/deploy/manifests/controller/helm/retina/values.yaml
+++ b/deploy/manifests/controller/helm/retina/values.yaml
@@ -9,8 +9,8 @@ os:
 
 operator:
   enabled: false
-  repository: mcr.microsoft.com/containernetworking/retina-operator
-  tag: "v0.1.3"
+  repository: ghcr.io/microsoft/retina/retina-operator
+  tag: "v0.0.1-pre"
   installCRDs: true
   enableRetinaEndpoint: false
   capture:
@@ -18,11 +18,11 @@ operator:
     jobNumLimit: 0
 
 image:
-  repository: mcr.microsoft.com/containernetworking/retina-agent
-  initRepository: mcr.microsoft.com/containernetworking/retina-init
+  repository: ghcr.io/microsoft/retina/retina-agent
+  initRepository: ghcr.io/microsoft/retina/retina-init
   pullPolicy: Always
   # Overrides the image tag whose default is the chart appVersion.
-  tag: "v0.1.3"
+  tag: "v0.0.1-pre"
 
 enablePodLevel: false
 remoteContext: false
diff --git a/docs/captures/cli.md b/docs/captures/cli.md
index e82fefd543..fc4ad27d6f 100644
--- a/docs/captures/cli.md
+++ b/docs/captures/cli.md
@@ -154,11 +154,11 @@ Blob-upload requires a Blob Shared Access Signature with the write permission to
 
 ### Debug mode
 
-With debug mode, when `--debug` is specified, we can overwrite the capture job Pod image from the default official `MCR` one.
+With debug mode, when `--debug` is specified, we can overwrite the capture job Pod image from the default official `GHCR` one.
 
 #### Examples
 
-- use `acnpublic` ACR in default debug mode
+- use `ghcr.io` image in default debug mode
 
 `kubectl retina capture create --host-path /mnt/test --namespace capture --node-selectors "kubernetes.io/os=linux" --debug`
 
diff --git a/docs/troubleshooting/capture.md b/docs/troubleshooting/capture.md
index cf8d34f249..b7474f4de4 100644
--- a/docs/troubleshooting/capture.md
+++ b/docs/troubleshooting/capture.md
@@ -24,7 +24,7 @@ kubectl get pod -n <capture namespace> --seletor job-name=<capture job name>
 
 ## Capture Pod ImagePullBackOff
 
-By default, kubectl retina plugin will eventually create Capture Pods from the [MCR](https://mcr.microsoft.com/) image with the same version as the kubectl plugin. If the kubectl plugin is built from a local environment, the MCR image cannot be found. Check [capture CLI Debug Mode](../captures/cli.md#Debug_mode) for local development and testing.
+By default, kubectl retina plugin will eventually create Capture Pods from the [GHCR](https://github.com/microsoft/retina) image with the same version as the kubectl plugin. If the kubectl plugin is built from a local environment, the GHCR image cannot be found. Check [capture CLI Debug Mode](../captures/cli.md#Debug_mode) for local development and testing.
 
 ## Windows node allows only one capture job running at one time
 
diff --git a/hack/tools/kapinger/manifests/deploy.yaml b/hack/tools/kapinger/manifests/deploy.yaml
index b022a20111..157cf7ae92 100644
--- a/hack/tools/kapinger/manifests/deploy.yaml
+++ b/hack/tools/kapinger/manifests/deploy.yaml
@@ -60,7 +60,7 @@ spec:
                 topologyKey: "kubernetes.io/hostname"
       containers:
         - name: kapinger
-          image: acnpublic.azurecr.io/kapinger:latest
+          image: ghcr.io/microsoft/retina/kapinger:latest
           resources:
             limits:
               memory: 20Mi
@@ -119,7 +119,7 @@ spec:
                 topologyKey: "kubernetes.io/hostname"
       containers:
         - name: kapinger
-          image: acnpublic.azurecr.io/kapinger:windows-ltsc2022-amd64-v35
+          image: ghcr.io/microsoft/retina/kapinger:windows-ltsc2022-amd64-v35
           env:
             - name: TARGET_TYPE
               value: "service"
@@ -173,7 +173,7 @@ spec:
                 topologyKey: "kubernetes.io/hostname"
       containers:
         - name: kapinger
-          image: acnpublic.azurecr.io/kapinger:latest
+          image: ghcr.io/microsoft/retina/kapinger:latest
           resources:
             limits:
               memory: 20Mi
diff --git a/pkg/capture/constants/job_specification.go b/pkg/capture/constants/job_specification.go
index 4031f768a4..487e0824fb 100644
--- a/pkg/capture/constants/job_specification.go
+++ b/pkg/capture/constants/job_specification.go
@@ -27,8 +27,8 @@ const (
 	CaptureOutputLocationBlobUploadSecretKey string = "blob-upload-url"
 
 	// CaptureWorkloadImageName defines the official capture workload image repo and image name
-	CaptureWorkloadImageName string = "mcr.microsoft.com/containernetworking/retina-agent"
+	CaptureWorkloadImageName string = "ghcr.io/microsoft/retina/retina-agent"
 
 	// DebugCaptureWorkloadImageName defines the capture workload image for testing and debugging
-	DebugCaptureWorkloadImageName string = "acnpublic.azurecr.io/retina-agent"
+	DebugCaptureWorkloadImageName string = "ghcr.io/microsoft/retina/retina-agent"
 )
diff --git a/pkg/capture/crd_to_job_test.go b/pkg/capture/crd_to_job_test.go
index 96234dd7a0..26011a88ae 100644
--- a/pkg/capture/crd_to_job_test.go
+++ b/pkg/capture/crd_to_job_test.go
@@ -32,7 +32,7 @@ import (
 )
 
 const (
-	retinaAgentImageForTest = "acnpublic.azurecr.io/retina-agent:v0.0.6-52-g07caaaf"
+	retinaAgentImageForTest = "ghcr.io/microsoft/retina/retina-agent:v0.0.1-pre"
 	apiServerURL            = "https://retina-test-c4528d-zn0ugsna.hcp.southeastasia.azmk8s.io:443"
 )
 
diff --git a/pkg/capture/utils/capture_image_test.go b/pkg/capture/utils/capture_image_test.go
index b96c8815a4..208d6621be 100644
--- a/pkg/capture/utils/capture_image_test.go
+++ b/pkg/capture/utils/capture_image_test.go
@@ -25,7 +25,7 @@ func TestCaptureWorkloadImage(t *testing.T) {
 			env:           map[string]string{},
 			sourceVersion: "v1.0.0",
 			versionSource: VersionSourceCLIVersion,
-			expectedImage: "mcr.microsoft.com/containernetworking/retina-agent:v1.0.0",
+			expectedImage: "ghcr.io/microsoft/retina/retina-agent:v1.0.0",
 		},
 		{
 			name: "Debug mode: image determined by CLI version",
@@ -35,7 +35,7 @@ func TestCaptureWorkloadImage(t *testing.T) {
 			sourceVersion: "v1.0.0",
 			versionSource: VersionSourceCLIVersion,
 
-			expectedImage: "acnpublic.azurecr.io/retina-agent:v1.0.0",
+			expectedImage: "ghcr.io/microsoft/retina/retina-agent:v1.0.0",
 		},
 		{
 			name:          "Debug mode: image determined by environment variable RETINA_AGENT_IMAGE",
diff --git a/scripts/windows.ps1 b/scripts/windows.ps1
index b18aa39e89..5391a353b7 100644
--- a/scripts/windows.ps1
+++ b/scripts/windows.ps1
@@ -26,6 +26,6 @@ function retina-image {
     if ($null -eq $env:TAG) { $env:TAG = $args[0] } 
     docker build `
         -f .\Dockerfile.windows `
-        -t acnpublic.azurecr.io/retina-agent:$env:TAG `
+        -t ghcr.io/microsoft/retina/retina-agent:$env:TAG `
         .
 }
diff --git a/test/goldpinger/daemonset.yaml b/test/goldpinger/daemonset.yaml
index 895409a038..714e15c3cd 100644
--- a/test/goldpinger/daemonset.yaml
+++ b/test/goldpinger/daemonset.yaml
@@ -74,7 +74,7 @@ spec:
                   fieldPath: status.podIP
           #            - name: HOSTS_TO_RESOLVE
           #              value: "1.1.1.1 8.8.8.8 www.bing.com"
-          image: acnpublic.azurecr.io/goldpinger:v2.0.2
+          image: docker.io/bloomberg/goldpinger:v3.9.0
           securityContext:
             allowPrivilegeEscalation: false
             readOnlyRootFilesystem: true
@@ -166,7 +166,7 @@ spec:
                   fieldPath: status.podIP
           #            - name: HOSTS_TO_RESOLVE
           #              value: "1.1.1.1 8.8.8.8 www.bing.com"
-          image: "acnpublic.azurecr.io/goldpinger-win:v2.0.2"
+          image: "docker.io/bloomberg/goldpinger:v3.9.0"
           command: ["\\goldpinger.exe"]
           ports:
             - containerPort: 7070
diff --git a/test/goldpinger/deployment.yaml b/test/goldpinger/deployment.yaml
index 151b459cca..8da9761ee1 100644
--- a/test/goldpinger/deployment.yaml
+++ b/test/goldpinger/deployment.yaml
@@ -73,7 +73,7 @@ spec:
                   fieldPath: status.podIP
             - name: HOSTS_TO_RESOLVE
               value: "1.1.1.1 8.8.8.8 www.bing.com"
-          image: "mcr.microsoft.com/aks/e2e/bloomberg-goldpinger:v3.7.0"
+          image: "docker.io/bloomberg/goldpinger:v3.9.0"
           securityContext:
             allowPrivilegeEscalation: false
             readOnlyRootFilesystem: true
diff --git a/test/integration/capture/capture_suite_test.go b/test/integration/capture/capture_suite_test.go
index b72514c64e..314b2d32b9 100644
--- a/test/integration/capture/capture_suite_test.go
+++ b/test/integration/capture/capture_suite_test.go
@@ -70,7 +70,7 @@ var _ = Describe("Capture flag tests", func() {
 		// by user.
 		if retinaAgentImagePreset := os.Getenv("RETINA_AGENT_IMAGE"); len(retinaAgentImagePreset) == 0 {
 			retinaVersion := assertExecCommandOutput("kubectl", "retina", "version")
-			retinaAgentImage := fmt.Sprintf("acnpublic.azurecr.io/retina-agent:%s", strings.TrimSpace(retinaVersion))
+			retinaAgentImage := fmt.Sprintf("ghcr.io/microsoft/retina/retina-agent:%s", strings.TrimSpace(retinaVersion))
 			os.Setenv("RETINA_AGENT_IMAGE", retinaAgentImage)
 			unsetRetinaAgentEnv = true
 		}
diff --git a/test/scale/example-deployment.yaml b/test/scale/example-deployment.yaml
index ae0c30f3ad..ed41a01251 100644
--- a/test/scale/example-deployment.yaml
+++ b/test/scale/example-deployment.yaml
@@ -43,7 +43,7 @@ spec:
               valueFrom:
                 fieldRef:
                   fieldPath: status.podIP
-          image: "mcr.microsoft.com/aks/e2e/bloomberg-goldpinger:v3.7.0"
+          image: "docker.io/bloomberg/goldpinger:v3.9.0"
           imagePullPolicy: Always
           securityContext:
             allowPrivilegeEscalation: false
diff --git a/test/trafficgen/kapinger.yaml b/test/trafficgen/kapinger.yaml
index c7393c91f3..a570d9b5cb 100644
--- a/test/trafficgen/kapinger.yaml
+++ b/test/trafficgen/kapinger.yaml
@@ -47,7 +47,7 @@ spec:
       serviceAccountName: kapinger-sa
       containers:
         - name: kapinger
-          image: acnpublic.azurecr.io/kapinger:latest
+          image: ghcr.io/microsoft/retina/kapinger:latest
           resources:
             limits:
               memory: 20Mi
@@ -92,7 +92,7 @@ spec:
       serviceAccountName: kapinger-sa
       containers:
         - name: kapinger
-          image: acnpublic.azurecr.io/kapinger:latest
+          image: ghcr.io/microsoft/retina/kapinger:latest
           resources:
             limits:
               memory: 20Mi
diff --git a/windows/manifests/windows.yaml b/windows/manifests/windows.yaml
index 80e3c8098e..accbce0a05 100644
--- a/windows/manifests/windows.yaml
+++ b/windows/manifests/windows.yaml
@@ -35,7 +35,7 @@ spec:
       hostNetwork: true
       containers:
         - name: retinawin
-          image: mcr.microsoft.com/containernetworking/retina-agent:v0.0.6
+          image: ghcr.io/microsoft/retina/retina-agent:v0.0.1-pre
           ports:
             - containerPort: 10093
           command: