Skip to content

Commit

Permalink
Workaround minikube bug
Browse files Browse the repository at this point in the history
If `minikube profile list` is called before `minikube start` it fails
because `$MINIKUBE_HOME/.minikube/profiles` does not exist[1]. I posted
a fix[1] on Jan 5 2023 but it was not accepted. Talur posted another
fix[2] on July 18 2023 but it is still waiting for review.

Fixing it in drenv until minikube maintainers find time to handle this.

[1] kubernetes/minikube#15593
[2] kubernetes/minikube#15594
[3] kubernetes/minikube#16900

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Nov 15, 2023
1 parent 719fd43 commit d2f7d1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube version
mkdir "$HOME/.minikube/profiles"
- name: Install kubectl
run: |
Expand Down
12 changes: 12 additions & 0 deletions test/drenv/minikube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import logging
import os

from . import commands

Expand All @@ -17,6 +18,10 @@


def profile(command, output=None):
# Workaround for https://github.com/kubernetes/minikube/pull/16900
# TODO: remove when issue is fixed.
_create_profiles_dir()

return _run("profile", command, output=output)


Expand Down Expand Up @@ -110,3 +115,10 @@ def _watch(command, *args, profile=None):
logging.debug("[%s] Running %s", profile, cmd)
for line in commands.watch(*cmd):
logging.debug("[%s] %s", profile, line)


def _create_profiles_dir():
minikube_home = os.environ.get("MINIKUBE_HOME", os.environ.get("HOME"))
profiles = os.path.join(minikube_home, ".minikube", "profiles")
logging.debug("Creating '%s'", profiles)
os.makedirs(profiles, exist_ok=True)

0 comments on commit d2f7d1b

Please sign in to comment.