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

[release/v1.7] fix: debian apt-get update running before configuring repositories #3084

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
8 changes: 8 additions & 0 deletions pkg/scripts/os_debian.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Acquire::http::Proxy "{{ .HTTP_PROXY }}";
{{- end }}
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
{{- if .CONFIGURE_REPOSITORIES }}
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi
{{- end }}

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
6 changes: 6 additions & 0 deletions pkg/scripts/testdata/TestKubeadmDebian-cilium_cluster.golden
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
6 changes: 6 additions & 0 deletions pkg/scripts/testdata/TestKubeadmDebian-nutanix_cluster.golden
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
6 changes: 6 additions & 0 deletions pkg/scripts/testdata/TestKubeadmDebian-simple.golden
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
6 changes: 6 additions & 0 deletions pkg/scripts/testdata/TestKubeadmDebian-with_containerd.golden
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
6 changes: 6 additions & 0 deletions pkg/scripts/testdata/TestUpgradeKubeadmAndCNIDebian.golden
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Acquire::https::Proxy "http://https.proxy";
Acquire::http::Proxy "http://http.proxy";
EOF

# Removing deprecated Kubernetes repositories from apt sources is needed when upgrading from older KubeOne versions,
# otherwise, apt-get update will fail to upgrade the packages.
if sudo grep -q "deb http://apt.kubernetes.io/ kubernetes-xenial main" /etc/apt/sources.list.d/kubernetes.list; then
rm -f /etc/apt/sources.list.d/kubernetes.list
fi

sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --option "Dpkg::Options::=--force-confold" -y --no-install-recommends \
apt-transport-https \
Expand Down