diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d62684ff..77ce2743 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: "build-test" on: # rebuild any PRs and main branch changes pull_request: + types: + [ opened, synchronize, reopened ] push: branches: - master @@ -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 \ No newline at end of file + 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 diff --git a/README.md b/README.md index 936bd6d9..c7e0ca78 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,56 @@ +
+ addons (optional) +
+    - 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
+  
+
+ +
+ extra-config (optional) +
+    - default: ''
+    - value: Any extra config fields (see [docs](https://minikube.sigs.k8s.io/docs/handbook/config/#kubernetes-configuration))
+  
+
+ ## Example 1: #### Start Kubernetes on pull request @@ -139,6 +189,7 @@ jobs: name: job1 steps: - name: start minikube + uses: medyagh/setup-minikube@master id: minikube with: minikube-version: 1.24.0 @@ -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 diff --git a/action.yml b/action.yml index 1d8a8f06..1f48e5b9 100644 --- a/action.yml +++ b/action.yml @@ -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: @@ -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' diff --git a/dist/index.js b/dist/index.js index 355159fa..959fe1ae 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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(); diff --git a/src/minikube.ts b/src/minikube.ts index ff751ed1..127dde56 100644 --- a/src/minikube.ts +++ b/src/minikube.ts @@ -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()