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

CRAYSAT-1912: Get K8s version from node-images #273

Merged
merged 1 commit into from
Oct 10, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.32.6] - 2024-10-08

### Changed
- Updated the version of `kubectl` included in `cray-sat` container to 1.24 to
match the version of Kubernetes included in CSM 1.6.

## [3.32.5] - 2024-10-03

### Added
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ COPY docs/man docs/man
COPY tools tools

RUN --mount=type=secret,id=netrc,target=/root/.netrc \
--mount=type=bind,source=node-images,target=/tmp/node-images \
pip3 install --no-cache-dir pip && \
pip3 install --no-cache-dir --timeout=300 . && \
./config-docker-sat.sh
Expand Down
12 changes: 11 additions & 1 deletion Jenkinsfile.github
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP
* (C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -45,6 +45,16 @@ pipeline {
}

stages {
stage('Checkout node-images repo for Kubernetes version') {
steps {
dir("node-images") {
git(
url: "https://github.com/Cray-HPE/node-images", branch: "main",
credentialsId: "jenkins-algol60-cray-hpe-github-integration"
)
}
}
}
stage('Run Unit Tests') {
steps {
sh 'make unittest'
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
# (C) Copyright 2022, 2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -34,13 +34,19 @@ endif

all : unittest codestyle image

unittest:
# The node-images repo must be cloned to get the Kubernetes version, so we can
# install the matching version of kubectl in the cray-sat image. In the Jenkins
# pipeline, this is handled prior to running make
node-images:
git clone --branch main [email protected]:Cray-HPE/node-images.git node-images

unittest: node-images
$(DOCKER_BUILD) --target testing --tag $(TEST_TAG)
docker run $(TEST_TAG)

codestyle:
codestyle: node-images
$(DOCKER_BUILD) --target codestyle --tag $(CODESTYLE_TAG)
docker run $(CODESTYLE_TAG)

image:
image: node-images
$(DOCKER_BUILD) --tag $(DEFAULT_TAG)
17 changes: 5 additions & 12 deletions docker_scripts/config-docker-sat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# MIT License
#
# (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand All @@ -27,10 +27,8 @@ LOGDIR=/var/log/cray/sat

SATMANDIR=/usr/share/man/man8

METAL_PROVISION_REPO="https://github.com/Cray-HPE/metal-provision.git"
METAL_PROVISION_DIR="metal-provision"
METAL_PROVISION_BASE_PACKAGES_PATH="group_vars/all.yml"
METAL_PROVISION_BRANCH="lts/csm-1.5"
NODE_IMAGES_DIR="/tmp/node-images"
NODE_IMAGES_BASE_PACKAGES_PATH="metal-provision/group_vars/all.yml"

# create logging directory
if [ ! -d "$LOGDIR" ]; then
Expand Down Expand Up @@ -61,18 +59,13 @@ register-python-argcomplete sat > /usr/share/bash-completion/completions/sat
echo "export PATH=$VIRTUAL_ENV/bin:\$PATH" > /etc/profile.d/sat_path.sh

# install kubectl using same version used in ncn image
cd /sat
git clone $METAL_PROVISION_REPO $METAL_PROVISION_DIR
cd $METAL_PROVISION_DIR
git checkout $METAL_PROVISION_BRANCH

KUBERNETES_PULL_VERSION=$(python3 <<EOF
import sys

import yaml


with open("${METAL_PROVISION_BASE_PACKAGES_PATH}") as pkgs:
with open("${NODE_IMAGES_DIR}/${NODE_IMAGES_BASE_PACKAGES_PATH}") as pkgs:
pkgs = yaml.safe_load(pkgs)
version = pkgs.get("kubernetes_release")
if version:
Expand All @@ -84,7 +77,7 @@ EOF
)

if [ -z "$KUBERNETES_PULL_VERSION" ]; then
echo >&2 "Unable to determine version of kubectl to use from ${METAL_PROVISION_REPO}"
echo >&2 "Unable to determine version of kubectl to use from node-images repo"
exit 1
fi

Expand Down
Loading