Skip to content

Commit

Permalink
feat: Kubernetes 1.26 support
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Sep 12, 2023
1 parent e18bcdb commit e1b5179
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 33 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
kubernetes: [v1.25.4,v1.24.4,v1.23.14,v1.22.12]
kubernetes: [v1.26.8,v1.25.13,v1.24.17,v1.23.17]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
minikube version: v1.29.0
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate Minikube
Expand All @@ -41,8 +41,8 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
kubernetes version: v1.25.4
minikube version: v1.29.0
kubernetes version: v1.26.8
github token: ${{ secrets.GITHUB_TOKEN }}
driver: docker
- name: Validate Minikube
Expand All @@ -64,8 +64,8 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
kubernetes version: v1.25.4
minikube version: v1.29.0
kubernetes version: v1.26.8
github token: ${{ secrets.GITHUB_TOKEN }}
start args: '--addons=registry --addons=metrics-server'
- name: Validate Minikube
Expand All @@ -85,8 +85,8 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
kubernetes version: v1.25.4
minikube version: v1.29.0
kubernetes version: v1.26.8
github token: ${{ secrets.GITHUB_TOKEN }}
start args: '--addons=ingress'
- name: Validate Minikube
Expand All @@ -100,7 +100,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes: [v1.25.4,1.24.8,v1.19.16]
kubernetes: [v1.26.8,v1.25.4,v1.19.16]
container_runtime: ['containerd']
steps:
- name: Checkout
Expand All @@ -110,7 +110,7 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
minikube version: v1.29.0
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}
container runtime: ${{ matrix.container_runtime }}
Expand All @@ -126,7 +126,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
kubernetes: [v1.22.15,v1.21.14,v1.20.15,v1.19.16,v1.18.20,v1.17.17]
kubernetes: [v1.22.17,v1.21.14,v1.20.15,v1.19.16,v1.18.20,v1.17.17]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -135,7 +135,7 @@ jobs:
- name: Test Action
uses: ./
with:
minikube version: v1.28.0
minikube version: v1.29.0
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate Minikube
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: Setup Minikube
uses: manusa/actions-setup-minikube@v2.7.2
with:
minikube version: 'v1.28.0'
kubernetes version: 'v1.25.4'
minikube version: 'v1.29.0'
kubernetes version: 'v1.26.8'
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Interact with the cluster
run: kubectl get nodes
Expand Down
80 changes: 65 additions & 15 deletions src/__tests__/configure-environment.test.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,77 @@
describe('configure-docker module test suite', () => {
let download;
let configureEnvironment;
let logExecSync;
beforeEach(() => {
jest.resetModules();
jest.mock('../exec');
jest.mock('../download');
download = require('../download');
configureEnvironment = require('../configure-environment');
logExecSync = require('../exec').logExecSync;
});
test('configureEnvironment, should run all configuration commands', () => {
// Given
logExecSync.mockImplementation(() => {});
// When
configureEnvironment();
// Then
expect(logExecSync).toHaveBeenCalledTimes(2);
});
test('configureEnvironment with docker driver, should run all configuration commands', () => {
// Given
logExecSync.mockImplementation(() => {});
// When
configureEnvironment({driver: 'docker'});
// Then
expect(logExecSync).toHaveBeenCalledTimes(3);
describe('configureEnvironment', () => {
beforeEach(() => {
logExecSync.mockImplementation(() => {});
});
describe('with driver=docker', () => {
beforeEach(() => {
configureEnvironment({driver: 'docker'});
});
test('installs conntrack', () => {
expect(logExecSync).toHaveBeenCalledWith('sudo apt update -y');
expect(logExecSync).toHaveBeenCalledWith(
'sudo apt-get install -y conntrack'
);
});
test('waits for docker to be ready', () => {
expect(logExecSync).toHaveBeenCalledWith(
"docker version -f '{{.Server.Version}} - {{.Client.Version}}'"
);
});
test('doesn\t install cni plugins', () => {
expect(download.installCniPlugins).not.toHaveBeenCalled();
});
});
describe('with driver=undefined', () => {
beforeEach(() => {
configureEnvironment();
});
test('installs conntrack', () => {
expect(logExecSync).toHaveBeenCalledWith('sudo apt update -y');
expect(logExecSync).toHaveBeenCalledWith(
'sudo apt-get install -y conntrack'
);
});
test('installs cni plugins', () => {
expect(download.installCniPlugins).toHaveBeenCalledTimes(1);
});
test('installs crictl', () => {
expect(download.installCriCtl).toHaveBeenCalledTimes(1);
});
test('installs cri-dockerd', () => {
expect(download.installCriDockerd).toHaveBeenCalledTimes(1);
});
});
describe('with driver=none', () => {
beforeEach(() => {
configureEnvironment({driver: 'none'});
});
test('installs conntrack', () => {
expect(logExecSync).toHaveBeenCalledWith('sudo apt update -y');
expect(logExecSync).toHaveBeenCalledWith(
'sudo apt-get install -y conntrack'
);
});
test('installs cni plugins', () => {
expect(download.installCniPlugins).toHaveBeenCalledTimes(1);
});
test('installs crictl', () => {
expect(download.installCriCtl).toHaveBeenCalledTimes(1);
});
test('installs cri-dockerd', () => {
expect(download.installCriDockerd).toHaveBeenCalledTimes(1);
});
});
});
});
10 changes: 6 additions & 4 deletions src/configure-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ const waitForDocker = async (attempt = 0) => {
};

const configureEnvironment = async (inputs = {}) => {
const {driver = 'none'} = inputs;
core.info('Updating Environment configuration to support Minikube');
logExecSync('sudo apt update -y');
logExecSync('sudo apt-get install -y conntrack');
if (inputs.driver === 'docker') {
if (driver === 'docker') {
core.info('Waiting for Docker to be ready');
await waitForDocker();
} else {
await download.installCniPlugins(inputs);
await download.installCriCtl(inputs);
await download.installCriDockerd(inputs);
}
await download.installCniPlugins(inputs);
await download.installCriCtl(inputs);
await download.installCriDockerd(inputs);
};

module.exports = configureEnvironment;

0 comments on commit e1b5179

Please sign in to comment.