Skip to content
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

Update apt for Kubernetes in vagrant playbook #6114

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

qiyueyao
Copy link
Contributor

@qiyueyao qiyueyao commented Mar 15, 2024

As legacy Linux package repositories for Kubernetes are frozen, the old vagrant playbook throws an error.

fatal: [k8s-node-control-plane]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: E:The repository 'https://packages.cloud.google.com/apt kubernetes-xenial Release' does not have a Release file., W:Updating from such a repository can't be done securely, and is therefore disabled by default., W:See apt-secure(8) manpage for repository creation and user configuration details., W:https://download.docker.com/linux/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details."}
E:The repository 'https://apt.kubernetes.io kubernetes-xenial Release' does not have a Release file.

This change updates the apt_key and apt_repository for Kubernetes in vagrant playbook.

Reference: https://kubernetes.io/blog/2023/08/15/pkgs-k8s-io-introduction/#how-to-migrate
https://dl.k8s.io/release/stable.txt

@@ -1,15 +1,16 @@
- name: Add an apt signing key for Kubernetes
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
url: https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a good idea to bind it with a specific version. You may check this thread:
kubernetes/release#2862 (comment)
We may just need to update the location of the file to /usr/share/keyrings/cloud.google.gpg?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to @luolanzone for not binding to a specific version. I think we can fetch the latest stable release from https://dl.k8s.io/release/stable.txt and extract the major.minor version.

For signing keys I think we should use keys from pkgs.k8s.io as Google-hosted package repositories are removed on Jan 2024.

Copy link
Contributor Author

@qiyueyao qiyueyao Mar 19, 2024

Choose a reason for hiding this comment

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

Updated so that we are following this https://kubernetes.io/blog/2023/08/15/pkgs-k8s-io-introduction/#how-to-migrate and replacing the version as suggested, for both the signing key and apt repository.

@@ -1,15 +1,16 @@
- name: Add an apt signing key for Kubernetes
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
url: https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to @luolanzone for not binding to a specific version. I think we can fetch the latest stable release from https://dl.k8s.io/release/stable.txt and extract the major.minor version.

For signing keys I think we should use keys from pkgs.k8s.io as Google-hosted package repositories are removed on Jan 2024.

state: present
filename: kubernetes.list
filename: /etc/apt/sources.list.d/kubernetes.list
Copy link
Contributor

Choose a reason for hiding this comment

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

just filename: "kubernetes" would also work.

Ansible will take care of the path and filename extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the change.

@tnqn
Copy link
Member

tnqn commented Mar 18, 2024

Perhaps change the title to "Update apt for Kubernetes in vagrant playbook"

@qiyueyao qiyueyao changed the title Update apt for Kubernetes in e2e/.../provision.sh Update apt for Kubernetes in vagrant playbook Mar 18, 2024
xliuxu
xliuxu previously approved these changes Mar 20, 2024
Copy link
Contributor

@xliuxu xliuxu left a comment

Choose a reason for hiding this comment

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

LGTM

state: present

- name: Adding apt repository for Kubernetes
vars:
k8sVersion: "{{ k8sRelease.content.split('.')[0] }}.{{ k8sRelease.content.split('.')[1] }}"
apt_repository:
# kubernetes-xenial should work for Ubuntu 16.04+, there is no
# kubernetes-bionic
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can remove the outdated comments as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed👍

As legacy Linux package repositories for Kubernetes
are frozen, we need to migrate to community-operated
repositories. It also requires specific release version.

This change updates the apt_key and apt_repository
for Kubernetes in vagrant playbook.

Signed-off-by: Qiyue Yao <[email protected]>
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@tnqn
Copy link
Member

tnqn commented Mar 27, 2024

/skip-all

@tnqn tnqn merged commit c2f2459 into antrea-io:main Mar 27, 2024
47 of 54 checks passed
@qiyueyao qiyueyao deleted the fix-provision branch March 27, 2024 08:02
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