Skip to content

Install azure keyvault python package for k8s master image #17806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

lixiaoyuner
Copy link
Contributor

@lixiaoyuner lixiaoyuner commented Jan 17, 2024

Why I did it

Currently we will use AAD to do authentication with python language inside k8s master, we need to pre-install azure key-vault python packages.
Found some issues to fix when I tried to test k8s master image build.

  • Need to install gnupg package before installing GPG key for bookworm
  • The netcat package's name has changed to netcat-openbsd in bookworm
  • Upgrade the cri-dockerd version to 0.3.10 for bookworm
  • Need to build a VHDX disk for convenience of image usage
  • Change the k8s master change flag name to make it easy to understand
  • Remove the -x for the skipvstest script due to it will add an extra quota when the variables are referred.
Work item tracking
  • Microsoft ADO (number only): 26435886

How I did it

  • pip3 install azure-keyvault-secrets
  • apt-get -y install gnupg before install GPG key
  • apt-get -y install netcat-openbsd
  • upgrade the cri-dockerd version for bookworm

How to verify it

  • pip3 list to check if azure-keyvault-secrets is installed inside image
  • dpkg -l to check if gnupg and netcat-openbsd is installed inside image
  • systemctl status cri-dockerd.service to check if it's running well

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@lixiaoyuner lixiaoyuner requested a review from lguohan as a code owner January 17, 2024 08:24
make $BUILD_OPTIONS $(K8S_OPTIONS) target/sonic-vs.img.gz
mv target/sonic-vs.img.gz target/sonic-vs-k8s.img.gz
make $BUILD_OPTIONS INCLUDE_KUBERNETES_MASTER=y target/sonic-vs.img.gz
gzip -kd target/sonic-vs.img.gz
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the keep option "-k" can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the keep option "-k" can be removed.

Yes, you are correct. Thanks for this comment, fixed.

xumia
xumia previously approved these changes Jan 25, 2024
Copy link
Collaborator

@xumia xumia left a comment

Choose a reason for hiding this comment

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

LGTM

xumia
xumia previously approved these changes Jan 25, 2024
Copy link

@losha228 losha228 left a comment

Choose a reason for hiding this comment

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

LGTM

build_debian.sh Outdated
@@ -271,6 +271,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSIO

install_kubernetes () {
local ver="$1"
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 30, 2024

Choose a reason for hiding this comment

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

apt-get update

No need to update again. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apt-get update

No need to update again.

Removed

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Jan 30, 2024

sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update

No need to update again. #Closed


Refers to: build_debian.sh:281 in e65bae4. [](commit_id = e65bae4, deletion_comment = False)

build_debian.sh Outdated
@@ -299,10 +301,9 @@ then
install_kubernetes ${MASTER_KUBERNETES_VERSION}

sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 30, 2024

Choose a reason for hiding this comment

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

apt-get update

No need to update again. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apt-get update

No need to update again.

Removed

build_debian.sh Outdated
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/cri-dockerd.deb -fsSL \
https://github.com/Mirantis/cri-dockerd/releases/download/v${MASTER_CRI_DOCKERD}/cri-dockerd_${MASTER_CRI_DOCKERD}.3-0.debian-${IMAGE_DISTRO}_amd64.deb
https://github.com/Mirantis/cri-dockerd/releases/download/v${MASTER_CRI_DOCKERD}/cri-dockerd_${MASTER_CRI_DOCKERD}.3-0.debian-bullseye_amd64.deb
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 30, 2024

Choose a reason for hiding this comment

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

bullseye

Fixed distro is not future-proof. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bullseye

Fixed distro is not future-proof.

Have changed this back, the cri-dockerd latest version has bookworm version, I have upgraded the version to 0.3.10

@@ -271,6 +271,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSIO

install_kubernetes () {
local ver="$1"
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install gnupg
Copy link
Collaborator

Choose a reason for hiding this comment

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

gnupg

This will install more package(s) into sonic image. Is it really needed? Your intention is to change master image only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gnupg

This will install more package(s) into sonic image. Is it really needed? Your intention is to change master image only.

Yes, indeed need to install gnupg before install gpg file for bookworm, I have removed gnupg after installing the gpg file.

@lixiaoyuner
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@lixiaoyuner
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@liushilongbuaa
Copy link
Contributor

/azpw ms_conflict

@liushilongbuaa
Copy link
Contributor

/azpw ms_conflict

build_debian.sh Outdated
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -fsSL \
https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add -
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y remove gnupg
Copy link
Collaborator

@qiluo-msft qiluo-msft Feb 21, 2024

Choose a reason for hiding this comment

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

remove

purge is better than remove #Closed

@@ -2,7 +2,7 @@

# This script is for kubernetes master image usage
# Will mount kubernetes master disk and execute kubernetes entrance script

#
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unnecessary change?

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.

6 participants