Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build-publish-mcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
releaseTag:
description: 'Release tag to publish images, defaults to the latest one'
type: string
arcExtensionVersion:
description: 'Release version of the Arc extension.'
type: string
required: true

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

jobs:
prepare-variables:
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.vars.outputs.release_tag }}
fleet_networking_version: ${{ steps.vars.outputs.fleet_networking_version }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -37,6 +43,12 @@ jobs:
fi
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT

# Fetch the latest fleet-networking version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move it to the https://github.com/Azure/fleet-networking/blob/main/.github/workflows/build-publish-mcr.yml and handle it independently?

there is no order guaranteed when we cut the release.

there will be a case, we cut the fleet first and then fleet-networking. Then your acr does not have the latest fleet-networking tag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fleet member agent and networking agent both are needed to package and push to MCR.

We can move to fleet-networking but then we would then need to fetch the azure fleet version and would end up in the same case as you mentioned.

We will update the release process to update the order of cutting the release to

  1. azure/fleet-networking agent
  2. azure/fleet agent

I spoke to Britania, and it seems to be that DP team cuts the azure/fleet-networking first as it does not require backporting from the kubefleet and is easier compared to azure/fleet agent release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why merging fleet-networking and fleet agent into one chart?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppose someone updates fleet-networking repo, how do they know they need to update here too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i have the same question as Wantong, why we need to couple fleet and fleet-networking into one chart? why not doing it independently?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why merging fleet-networking and fleet agent into one chart?

We are working on enabling Arc connected clusters to join fleets as members. We install the agents on Arc clusters as an Arc Extension. The Arc Extension is simply a packaged helm chart pushed into MCR. Since we are installing the networking and fleet agents onto the Arc Clusters, they need to be packaged as one for Arc Extension. Please see this wiki for more info.

Suppose someone updates fleet-networking repo, how do they know they need to update here too?

We will be updating the Fleet Release Manual to ensure that we always run the Github Action to package all updated agents and push to MCR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a comment in this workflow to provide such context? so that we don't lose the context in the future.

Please update the release manual to make sure that when people bump the agent versions for the aks cluster, use the same version combination as the arc helm charts. Otherwise, what's installed in the normal aks cluster could be different from arc clusters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Github Action, if no tag is provided for agent versions we fetch the latest tag and push that to MCR. We are doing the same for the ARC helm charts. We use the bumped/updated tag agent version for both fleet agent for the aks cluster and arc helm chart

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clarify that, i'm talking about the toggle bump PR, who creates the bump PR needs to make sure the ARC is using the same versions (fleet & fleet-networking) as the one defined in the toggle to keep them consistent.

# NOTE: The fleet-networking image must be cut and pushed to MCR first before retrieving this version
FLEET_NETWORKING_VERSION="${FLEET_NETWORKING_VERSION:-$(curl "https://api.github.com/repos/Azure/fleet-networking/tags" | jq -r '.[0].name')}"
Comment thread
britaniar marked this conversation as resolved.
echo "fleet_networking_version=$FLEET_NETWORKING_VERSION" >> $GITHUB_OUTPUT
echo "Using Fleet Networking version: $FLEET_NETWORKING_VERSION"

# NOTE: As exporting a variable from a secret is not possible, the shared variable registry obtained
# from AZURE_REGISTRY secret is not exported from here.

Expand Down Expand Up @@ -76,3 +88,18 @@ jobs:
env:
CRD_INSTALLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.REGISTRY_REPO}}
# Build Arc Extension for member clusters
# Arc-connected clusters can join fleets as member clusters through an Arc Extension.
# An Arc Extension is a packaged Helm chart that gets deployed to Arc clusters.
# This step packages both the fleet member agent and networking agents into a single
# Helm chart for Arc deployment, since Arc Extensions require all components to be bundled together.
- name: Build and publish ARC member cluster agents helm chart
run: |
make helm-package-arc-member-cluster-agents
env:
ARC_MEMBER_AGENT_HELMCHART_VERSION: ${{ inputs.arcExtensionVersion }}
MEMBER_AGENT_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
REFRESH_TOKEN_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.release_tag }}
MCS_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
MEMBER_NET_CONTROLLER_IMAGE_VERSION: ${{ needs.prepare-variables.outputs.fleet_networking_version }}
REGISTRY: ${{ secrets.AZURE_REGISTRY }}/${{ env.ARC_REGISTRY_REPO}}
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ HUB_AGENT_IMAGE_NAME ?= hub-agent
MEMBER_AGENT_IMAGE_NAME ?= member-agent
REFRESH_TOKEN_IMAGE_NAME ?= refresh-token
CRD_INSTALLER_IMAGE_NAME ?= crd-installer
ARC_MEMBER_AGENT_HELMCHART_NAME = arc-member-cluster-agents-helm-chart

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

# Fleet Agents and Networking Agents are packaged and pushed to MCR for Arc Extension.
.PHONY: helm-package-arc-member-cluster-agents
helm-package-arc-member-cluster-agents:
envsubst < charts/member-agent-arc/values.yaml > charts/member-agent-arc/values.yaml.tmp && \
mv charts/member-agent-arc/values.yaml.tmp charts/member-agent-arc/values.yaml && \
helm package charts/member-agent-arc/ --version $(ARC_MEMBER_AGENT_HELMCHART_VERSION)

helm push $(ARC_MEMBER_AGENT_HELMCHART_NAME)-$(ARC_MEMBER_AGENT_HELMCHART_VERSION).tgz oci://$(REGISTRY)

## -----------------------------------
## Cleanup
## -----------------------------------
Expand Down
1 change: 1 addition & 0 deletions charts/member-agent-arc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
23 changes: 23 additions & 0 deletions charts/member-agent-arc/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/member-agent-arc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: arc-member-cluster-agents-helm-chart
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions charts/member-agent-arc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "fleet-member-agent.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "fleet-member-agent.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "fleet-member-agent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "fleet-member-agent.labels" -}}
helm.sh/chart: {{ include "fleet-member-agent.chart" . }}
{{ include "fleet-member-agent.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "fleet-member-agent.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fleet-member-agent.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "fleet-member-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "fleet-member-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/member-agent-arc/templates/azure-proxy-secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if and .Values.Azure.proxySettings.isProxyEnabled .Values.Azure.proxySettings.proxyCert }}
apiVersion: v1
kind: Secret
metadata:
name: azure-proxy-cert
namespace: fleet-system
type: Opaque
data:
proxy-cert.crt: {{ .Values.Azure.proxySettings.proxyCert | b64enc | quote }}
{{- end }}
130 changes: 130 additions & 0 deletions charts/member-agent-arc/templates/crds/appliedworks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
labels:
{{- if .Values.legacyAddonDelivery }}
addonmanager.kubernetes.io/mode: Reconcile
{{- end }}
kubernetes.azure.com/managedby: fleet
name: appliedworks.placement.kubernetes-fleet.io
spec:
group: placement.kubernetes-fleet.io
names:
categories:
- fleet
- fleet-placement
kind: AppliedWork
listKind: AppliedWorkList
plural: appliedworks
singular: appliedwork
scope: Cluster
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
properties:
workName:
type: string
workNamespace:
type: string
required:
- workName
- workNamespace
type: object
status:
properties:
appliedResources:
items:
properties:
group:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
ordinal:
type: integer
resource:
type: string
uid:
type: string
version:
type: string
required:
- ordinal
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: false
subresources:
status: {}
- name: v1beta1
schema:
openAPIV3Schema:
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
properties:
workName:
type: string
workNamespace:
type: string
required:
- workName
- workNamespace
type: object
status:
properties:
appliedResources:
items:
properties:
group:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
ordinal:
type: integer
resource:
type: string
uid:
type: string
version:
type: string
required:
- ordinal
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
Loading
Loading