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

Decouple kubespray-defaults from download #10626

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
2 changes: 1 addition & 1 deletion .ansible-lint-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ roles/kubernetes/control-plane/defaults/main/main.yml jinja[spacing]
roles/kubernetes/kubeadm/defaults/main.yml jinja[spacing]
roles/kubernetes/node/defaults/main.yml jinja[spacing]
roles/kubernetes/preinstall/defaults/main.yml jinja[spacing]
roles/kubespray-defaults/defaults/main.yaml jinja[spacing]
roles/kubespray-defaults/defaults/main/main.yml jinja[spacing]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN apt update -q \
MarkupSafe==2.1.3 \
ruamel.yaml==0.17.21 \
passlib==1.7.4 \
&& KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main.yaml) \
&& KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main/main.yml) \
&& curl -L https://dl.k8s.io/release/$KUBE_VERSION/bin/linux/$(dpkg --print-architecture)/kubectl -o /usr/local/bin/kubectl \
&& echo $(curl -L https://dl.k8s.io/release/$KUBE_VERSION/bin/linux/$(dpkg --print-architecture)/kubectl.sha256) /usr/local/bin/kubectl | sha256sum --check \
&& chmod a+x /usr/local/bin/kubectl \
Expand Down
2 changes: 1 addition & 1 deletion contrib/offline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ manage-offline-container-images.sh register

## generate_list.sh

This script generates the list of downloaded files and the list of container images by `roles/download/defaults/main/main.yml` file.
This script generates the list of downloaded files and the list of container images by `roles/kubespray-defaults/main/download.yml` file.

Run this script will execute `generate_list.yml` playbook in kubespray root directory and generate four files,
all downloaded files url in files.list, all container images in images.list, jinja2 templates in *.template.
Expand Down
4 changes: 2 additions & 2 deletions contrib/offline/generate_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CURRENT_DIR=$(cd $(dirname $0); pwd)
TEMP_DIR="${CURRENT_DIR}/temp"
REPO_ROOT_DIR="${CURRENT_DIR%/contrib/offline}"

: ${DOWNLOAD_YML:="roles/download/defaults/main/main.yml"}
: ${DOWNLOAD_YML:="roles/kubespray-defaults/main/download.yml"}

mkdir -p ${TEMP_DIR}

Expand All @@ -19,7 +19,7 @@ sed -n '/^downloads:/,/download_defaults:/p' ${REPO_ROOT_DIR}/${DOWNLOAD_YML} \
| sed 'N;s#\n# #g' | tr ' ' ':' | sed 's/\"//g' > ${TEMP_DIR}/images.list.template

# add kube-* images to images list template
# Those container images are downloaded by kubeadm, then roles/download/defaults/main/main.yml
# Those container images are downloaded by kubeadm, then roles/kubespray-defaults/main/download.yml
# doesn't contain those images. That is reason why here needs to put those images into the
# list separately.
KUBE_IMAGES="kube-apiserver kube-controller-manager kube-scheduler kube-proxy"
Expand Down
2 changes: 1 addition & 1 deletion docs/offline-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ If you use the settings like the one above, you'll need to define in your invent

* `registry_host`: Container image registry. If you _don't_ use the same repository path for the container images that
the ones defined
in [Download's role defaults](https://github.com/kubernetes-sigs/kubespray/blob/master/roles/download/defaults/main/main.yml)
in [kubesprays-defaults's role defaults](https://github.com/kubernetes-sigs/kubespray/blob/master/roles/kubespray-defaults/main/download.yml)
, you need to override the `*_image_repo` for these container images. If you want to make your life easier, use the
same repository path, you won't have to override anything else.
* `registry_addr`: Container image registry, but only have [domain or ip]:[port].
Expand Down
2 changes: 1 addition & 1 deletion extra_playbooks/migrate_openstack_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
hosts: kube_control_plane[0]
tasks:
- name: Include kubespray-default variables
include_vars: ../roles/kubespray-defaults/defaults/main.yaml
include_vars: ../roles/kubespray-defaults/defaults/main/main.yml
- name: Copy get_cinder_pvs.sh to master
copy:
src: get_cinder_pvs.sh
Expand Down
2 changes: 1 addition & 1 deletion inventory/sample/group_vars/all/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ loadbalancer_apiserver_healthcheck_port: 8081
# https_proxy: ""
# https_proxy_cert_file: ""

## Refer to roles/kubespray-defaults/defaults/main.yml before modifying no_proxy
## Refer to roles/kubespray-defaults/defaults/main/main.yml before modifying no_proxy
# no_proxy: ""

## Some problems may occur when downloading files over https proxy due to ansible bug
Expand Down
4 changes: 2 additions & 2 deletions pipeline.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ WORKDIR /kubespray

RUN --mount=type=bind,target=./requirements.txt,src=./requirements.txt \
--mount=type=bind,target=./tests/requirements.txt,src=./tests/requirements.txt \
--mount=type=bind,target=./roles/kubespray-defaults/defaults/main.yaml,src=./roles/kubespray-defaults/defaults/main.yaml \
--mount=type=bind,target=./roles/kubespray-defaults/defaults/main/main.yml,src=./roles/kubespray-defaults/defaults/main/main.yml \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& pip install --no-compile --no-cache-dir pip -U \
&& pip install --no-compile --no-cache-dir -r tests/requirements.txt \
&& KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main.yaml) \
&& KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main/main.yml) \
&& curl -L https://dl.k8s.io/release/$KUBE_VERSION/bin/linux/$(dpkg --print-architecture)/kubectl -o /usr/local/bin/kubectl \
&& echo $(curl -L https://dl.k8s.io/release/$KUBE_VERSION/bin/linux/$(dpkg --print-architecture)/kubectl.sha256) /usr/local/bin/kubectl | sha256sum --check \
&& chmod a+x /usr/local/bin/kubectl \
Expand Down
6 changes: 0 additions & 6 deletions roles/kubespray-defaults/meta/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion roles/kubespray-defaults/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Configure defaults
debug:
msg: "Check roles/kubespray-defaults/defaults/main.yml"
msg: "Check roles/kubespray-defaults/defaults/main/main.yml"
tags:
- always

Expand Down
4 changes: 2 additions & 2 deletions scripts/download_hash.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

# After a new version of Kubernetes has been released,
# run this script to update roles/download/defaults/main/main.yml
# run this script to update roles/kubespray-defaults/main/download.yml
# with new hashes.

import hashlib
Expand All @@ -10,7 +10,7 @@
import requests
from ruamel.yaml import YAML

MAIN_YML = "../roles/download/defaults/main/main.yml"
MAIN_YML = "../roles/kubespray-defaults/main/download.yml"

def open_main_yaml():
yaml = YAML()
Expand Down
2 changes: 1 addition & 1 deletion scripts/download_hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if [[ ${DEBUG:-false} == "true" ]]; then
set -o xtrace
fi

checksums_file="$(git rev-parse --show-toplevel)/roles/download/defaults/main/checksums.yml"
checksums_file="$(git rev-parse --show-toplevel)/roles/kubespray-defaults/defaults/main/checksums.yml"
downloads_folder=/tmp/kubespray_binaries

function get_versions {
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/check_readme_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TARGET_COMPONENTS="containerd calico cilium flannel kube-ovn kube-router weave c
cd $(dirname $0)/../../

echo checking kubernetes..
version_from_default=$(grep "^kube_version:" ./roles/kubespray-defaults/defaults/main.yaml | awk '{print $2}' | sed s/\"//g)
version_from_default=$(grep "^kube_version:" ./roles/kubespray-defaults/defaults/main/main.yml | awk '{print $2}' | sed s/\"//g)
version_from_readme=$(grep " \[kubernetes\]" ./README.md | awk '{print $3}')
if [ "${version_from_default}" != "${version_from_readme}" ]; then
echo "The version of kubernetes is different between main.yml(${version_from_default}) and README.md(${version_from_readme})."
Expand All @@ -17,7 +17,7 @@ fi

for component in $(echo ${TARGET_COMPONENTS}); do
echo checking ${component}..
version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/g)_version:" ./roles/download/defaults/main/main.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/g)_version:" ./roles/kubespray-defaults/defaults/main/download.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
if [ "${version_from_default}" = "" ]; then
version_from_default=$(grep "^$(echo ${component} | sed s/"-"/"_"/g)_version:" ./roles/kubernetes/node/defaults/main.yml | awk '{print $2}' | sed s/\"//g | sed s/^v//)
fi
Expand Down