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

Support minikube --addons & --extra-config #41

Merged
merged 4 commits into from
Dec 2, 2022
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
25 changes: 21 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
pull_request:
types:
[ opened, synchronize, reopened ]
push:
branches:
- master
Expand All @@ -10,14 +12,29 @@ jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- run: |
npm install
npm run all
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- uses: ./
with:
milliseconds: 1000
with:
addons: ingress

# Test that nginx ingress has been enabled
- run: |
minikube addons list | grep 'ingress ' | grep enabled
test-extraOptions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
extra-config: 'kubelet.max-pods=10'

# Test that minikube max-pods extraConfig has been set
- run: |
cat ~/.minikube/profiles/minikube/config.json | jq '.KubernetesConfig.ExtraOptions[0].Key' | grep max-pods
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,56 @@
</pre>
</details>

<details>
<summary>addons (optional)</summary>
<pre>
- default: ''
- options:
- ambassador
- auto-pause
- csi-hostpath-driver
- dashboard
- default-storageclass
- efk
- freshpod
- gcp-auth
- gvisor
- headlamp
- helm-tiller
- inaccel
- ingress
- ingress-dns
- istio
- istio-provisioner
- kong
- kubevirt
- logviewer
- metallb
- metrics-server
- nvidia-driver-installer
- nvidia-gpu-device-plugin
- olm
- pod-security-policy
- portainer
- registry
- registry-aliases
- registry-creds
- storage-provisioner
- storage-provisioner-gluster
- volumesnapshots
- (minikube addons list)
- example: ingress,registry
</pre>
</details>

<details>
<summary>extra-config (optional)</summary>
<pre>
- default: ''
- value: Any extra config fields (see [docs](https://minikube.sigs.k8s.io/docs/handbook/config/#kubernetes-configuration))
</pre>
</details>

## Example 1:
#### Start Kubernetes on pull request

Expand Down Expand Up @@ -139,6 +189,7 @@ jobs:
name: job1
steps:
- name: start minikube
uses: medyagh/setup-minikube@master
id: minikube
with:
minikube-version: 1.24.0
Expand All @@ -148,7 +199,8 @@ jobs:
cpus: 4
memory: 4000m
cni: bridge
uses: medyagh/setup-minikube@master
addons: registry,ingress
extra-config: 'kubelet.max-pods=10'
# now you can run kubectl to see the pods in the cluster
- name: kubectl
run: kubectl get pods -A
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'setup-minikube'
description: 'test your app against real Kubernetes.'
author: 'Medya Gh'
branding:
icon: 'box'
icon: 'box'
color: 'blue'
inputs:
minikube-version:
Expand Down Expand Up @@ -33,6 +33,14 @@ inputs:
description: 'CNI plug-in to use. Valid options: auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest'
required: false
default: 'auto'
addons:
description: 'Choose optional addons to install. Valid options: ingress, gcp-auth, registry ...'
required: false
default: ''
extra-config:
description: 'Extra configuration (--extra-config) to pass into "minikube start".'
required: false
default: ''
runs:
using: 'node16'
main: 'dist/index.js'
2 changes: 2 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function setArgs(args) {
{ key: 'cpus', flag: '--cpus' },
{ key: 'memory', flag: '--memory' },
{ key: 'cni', flag: '--cni' },
{ key: 'addons', flag: '--addons' },
{ key: 'extra-config', flag: '--extra-config' },
];
inputs.forEach((input) => {
const value = (0, core_1.getInput)(input.key).toLowerCase();
Expand Down
2 changes: 2 additions & 0 deletions src/minikube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export function setArgs(args: string[]) {
{key: 'cpus', flag: '--cpus'},
{key: 'memory', flag: '--memory'},
{key: 'cni', flag: '--cni'},
{key: 'addons', flag: '--addons'},
{key: 'extra-config', flag: '--extra-config'},
]
inputs.forEach((input) => {
const value = getInput(input.key).toLowerCase()
Expand Down