Skip to content

Commit fc8bf76

Browse files
fix: Update Github Action to publish arc member agent helm charts to MCR (Azure#1162)
2 parents 7a763d6 + 4120934 commit fc8bf76

File tree

13 files changed

+2295
-0
lines changed

13 files changed

+2295
-0
lines changed

.github/workflows/build-publish-mcr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
releaseTag:
99
description: 'Release tag to publish images, defaults to the latest one'
1010
type: string
11+
arcExtensionVersion:
12+
description: 'Release version of the Arc extension.'
13+
type: string
14+
required: true
1115

1216
permissions:
1317
id-token: write
@@ -16,12 +20,14 @@ permissions:
1620
env:
1721
# `public` indicates images to MCR wil be publicly available, and will be removed in the final MCR images
1822
REGISTRY_REPO: public/aks/fleet
23+
ARC_REGISTRY_REPO: public/microsoft.fleetmember
1924

2025
jobs:
2126
prepare-variables:
2227
runs-on: ubuntu-latest
2328
outputs:
2429
release_tag: ${{ steps.vars.outputs.release_tag }}
30+
fleet_networking_version: ${{ steps.vars.outputs.fleet_networking_version }}
2531
steps:
2632
- uses: actions/checkout@v4
2733
with:
@@ -37,6 +43,12 @@ jobs:
3743
fi
3844
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
3945
46+
# Fetch the latest fleet-networking version
47+
# NOTE: The fleet-networking image must be cut and pushed to MCR first before retrieving this version
48+
FLEET_NETWORKING_VERSION="${FLEET_NETWORKING_VERSION:-$(curl "https://api.github.com/repos/Azure/fleet-networking/tags" | jq -r '.[0].name')}"
49+
echo "fleet_networking_version=$FLEET_NETWORKING_VERSION" >> $GITHUB_OUTPUT
50+
echo "Using Fleet Networking version: $FLEET_NETWORKING_VERSION"
51+
4052
# NOTE: As exporting a variable from a secret is not possible, the shared variable registry obtained
4153
# from AZURE_REGISTRY secret is not exported from here.
4254
@@ -76,3 +88,18 @@ jobs:
7688
env:
7789
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
7890
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
91+
# Build Arc Extension for member clusters
92+
# Arc-connected clusters can join fleets as member clusters through an Arc Extension.
93+
# An Arc Extension is a packaged Helm chart that gets deployed to Arc clusters.
94+
# This step packages both the fleet member agent and networking agents into a single
95+
# Helm chart for Arc deployment, since Arc Extensions require all components to be bundled together.
96+
- name: Build and publish ARC member cluster agents helm chart
97+
run: |
98+
make helm-package-arc-member-cluster-agents
99+
env:
100+
ARC_MEMBER_AGENT_HELMCHART_VERSION: ${{ inputs.arcExtensionVersion }}
101+
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
102+
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
103+
MCS_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
104+
MEMBER_NET_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
105+
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.ARC_REGISTRY_REPO}}

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ HUB_AGENT_IMAGE_NAME ?= hub-agent
1212
MEMBER_AGENT_IMAGE_NAME ?= member-agent
1313
REFRESH_TOKEN_IMAGE_NAME ?= refresh-token
1414
CRD_INSTALLER_IMAGE_NAME ?= crd-installer
15+
ARC_MEMBER_AGENT_HELMCHART_NAME = arc-member-cluster-agents-helm-chart
1516

1617
KUBECONFIG ?= $(HOME)/.kube/config
1718
HUB_SERVER_URL ?= https://172.19.0.2:6443
@@ -336,6 +337,15 @@ docker-build-crd-installer: docker-buildx-builder
336337
--pull \
337338
--tag $(REGISTRY)/$(CRD_INSTALLER_IMAGE_NAME):$(CRD_INSTALLER_IMAGE_VERSION) .
338339

340+
# Fleet Agents and Networking Agents are packaged and pushed to MCR for Arc Extension.
341+
.PHONY: helm-package-arc-member-cluster-agents
342+
helm-package-arc-member-cluster-agents:
343+
envsubst < charts/member-agent-arc/values.yaml > charts/member-agent-arc/values.yaml.tmp && \
344+
mv charts/member-agent-arc/values.yaml.tmp charts/member-agent-arc/values.yaml && \
345+
helm package charts/member-agent-arc/ --version $(ARC_MEMBER_AGENT_HELMCHART_VERSION)
346+
347+
helm push $(ARC_MEMBER_AGENT_HELMCHART_NAME)-$(ARC_MEMBER_AGENT_HELMCHART_VERSION).tgz oci://$(REGISTRY)
348+
339349
## -----------------------------------
340350
## Cleanup
341351
## -----------------------------------

charts/member-agent-arc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.tgz
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/member-agent-arc/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: arc-member-cluster-agents-helm-chart
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "fleet-member-agent.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "fleet-member-agent.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "fleet-member-agent.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "fleet-member-agent.labels" -}}
37+
helm.sh/chart: {{ include "fleet-member-agent.chart" . }}
38+
{{ include "fleet-member-agent.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "fleet-member-agent.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "fleet-member-agent.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "fleet-member-agent.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "fleet-member-agent.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if and .Values.Azure.proxySettings.isProxyEnabled .Values.Azure.proxySettings.proxyCert }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: azure-proxy-cert
6+
namespace: fleet-system
7+
type: Opaque
8+
data:
9+
proxy-cert.crt: {{ .Values.Azure.proxySettings.proxyCert | b64enc | quote }}
10+
{{- end }}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.11.4
7+
labels:
8+
{{- if .Values.legacyAddonDelivery }}
9+
addonmanager.kubernetes.io/mode: Reconcile
10+
{{- end }}
11+
kubernetes.azure.com/managedby: fleet
12+
name: appliedworks.placement.kubernetes-fleet.io
13+
spec:
14+
group: placement.kubernetes-fleet.io
15+
names:
16+
categories:
17+
- fleet
18+
- fleet-placement
19+
kind: AppliedWork
20+
listKind: AppliedWorkList
21+
plural: appliedworks
22+
singular: appliedwork
23+
scope: Cluster
24+
versions:
25+
- name: v1
26+
schema:
27+
openAPIV3Schema:
28+
properties:
29+
apiVersion:
30+
type: string
31+
kind:
32+
type: string
33+
metadata:
34+
type: object
35+
spec:
36+
properties:
37+
workName:
38+
type: string
39+
workNamespace:
40+
type: string
41+
required:
42+
- workName
43+
- workNamespace
44+
type: object
45+
status:
46+
properties:
47+
appliedResources:
48+
items:
49+
properties:
50+
group:
51+
type: string
52+
kind:
53+
type: string
54+
name:
55+
type: string
56+
namespace:
57+
type: string
58+
ordinal:
59+
type: integer
60+
resource:
61+
type: string
62+
uid:
63+
type: string
64+
version:
65+
type: string
66+
required:
67+
- ordinal
68+
type: object
69+
type: array
70+
type: object
71+
required:
72+
- spec
73+
type: object
74+
served: true
75+
storage: false
76+
subresources:
77+
status: {}
78+
- name: v1beta1
79+
schema:
80+
openAPIV3Schema:
81+
properties:
82+
apiVersion:
83+
type: string
84+
kind:
85+
type: string
86+
metadata:
87+
type: object
88+
spec:
89+
properties:
90+
workName:
91+
type: string
92+
workNamespace:
93+
type: string
94+
required:
95+
- workName
96+
- workNamespace
97+
type: object
98+
status:
99+
properties:
100+
appliedResources:
101+
items:
102+
properties:
103+
group:
104+
type: string
105+
kind:
106+
type: string
107+
name:
108+
type: string
109+
namespace:
110+
type: string
111+
ordinal:
112+
type: integer
113+
resource:
114+
type: string
115+
uid:
116+
type: string
117+
version:
118+
type: string
119+
required:
120+
- ordinal
121+
type: object
122+
type: array
123+
type: object
124+
required:
125+
- spec
126+
type: object
127+
served: true
128+
storage: true
129+
subresources:
130+
status: {}

0 commit comments

Comments
 (0)