Skip to content

feat: update live patching scripts to support custom repo service#6139

Merged
YaoC merged 2 commits intomasterfrom
chyao/security-patch-repo-service-support
Apr 22, 2025
Merged

feat: update live patching scripts to support custom repo service#6139
YaoC merged 2 commits intomasterfrom
chyao/security-patch-repo-service-support

Conversation

@YaoC
Copy link
Contributor

@YaoC YaoC commented Mar 31, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

For network isolated clusters, when doing security patch, they can't access internet to download packages. We decided to provide an internal repo service for these clusters. This PR is to update live patching scripts to support custom repo service.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

Copy link
Contributor

@yagmurbaydogan yagmurbaydogan left a comment

Choose a reason for hiding this comment

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

LGTM!

yagmurbaydogan
yagmurbaydogan previously approved these changes Mar 31, 2025
sed -i 's/https:\/\/snapshot.ubuntu.com\/ubuntu\/\([0-9]\{8\}T[0-9]\{6\}Z\)/https:\/\/snapshot.ubuntu.com\/ubuntu\/'"${golden_timestamp}"'/g' ${source_list_path}
# No live patching repo service annotation, so we need to change to use the ubuntu snapshot repo
# e.g. replace http://10.224.0.5/ubuntu/ with https://snapshot.ubuntu.com/ubuntu/20250318T000000Z
sed -i 's/http:\/\/[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\/ubuntu\//https:\/\/snapshot.ubuntu.com\/ubuntu\/'"${golden_timestamp}"'/g' ${source_list_path}
Copy link
Member

Choose a reason for hiding this comment

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

not related to this PR, but we need to make the same changes to the cshelper in RP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what we need to update in captureVHD API if it's NI:

  1. Get service IP
  2. Update cse for copied VMSS

sed -i 's/https:\/\/snapshot.ubuntu.com\/ubuntu\/\([0-9]\{8\}T[0-9]\{6\}Z\)/http:\/\/'"${live_patching_repo_service}"'\/ubuntu\//g' ${source_list_path}
# upgrade the old live patching repo service to the new one
# e.g. replace http://10.224.0.5/ubuntu/ with http://10.224.0.6/ubuntu/
sed -i 's/http:\/\/[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+\/ubuntu\//http:\/\/'"${live_patching_repo_service}"'\/ubuntu\//g' ${source_list_path}
Copy link
Member

Choose a reason for hiding this comment

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

how do we test this?

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to run existing e2es on this new Image version?

Copy link
Contributor Author

@YaoC YaoC Apr 1, 2025

Choose a reason for hiding this comment

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

Seem the e2e is on the new image version.

Copy link
Contributor

Choose a reason for hiding this comment

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

discussed with Ye offline regarding how we can get full RP E2E coverage before merge

Copy link
Member

@yewmsft yewmsft left a comment

Choose a reason for hiding this comment

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

Let's add e2e with this pr.

@YaoC YaoC force-pushed the chyao/security-patch-repo-service-support branch from 4918e66 to b0df435 Compare April 1, 2025 21:45
@YaoC YaoC force-pushed the chyao/security-patch-repo-service-support branch from b0df435 to 8bb0a4c Compare April 8, 2025 18:10
@YaoC YaoC force-pushed the chyao/security-patch-repo-service-support branch from 8bb0a4c to 4dc791b Compare April 8, 2025 18:23
# Network isolated cluster can't access the internet, so we deploy a live patching repo service in the cluster
# The node will use the live patching repo service to download the repo metadata and packages
# If the annotation is not set, we will use the ubuntu snapshot repo
live_patching_repo_service=$($KUBECTL get node ${node_name} -o jsonpath="{.metadata.annotations['kubernetes\.azure\.com/live-patching-repo-service']}")
Copy link
Contributor

@cameronmeissner cameronmeissner Apr 11, 2025

Choose a reason for hiding this comment

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

should we log something out if kubectl fails? you can grab the exit code with $?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we added set -e for this script, if kubectl fails, it will exit directly and also log the reason.

@github-actions
Copy link
Contributor

No changes to cached containers or packages on Windows VHDs

@YaoC YaoC requested a review from cameronmeissner April 17, 2025 23:05
@YaoC YaoC merged commit 77141a8 into master Apr 22, 2025
21 checks passed
@YaoC YaoC deleted the chyao/security-patch-repo-service-support branch April 22, 2025 16:25
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.

4 participants