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

update crio to 1.18.3 and kicbase to ubuntu 20.04 #8895

Merged
merged 8 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
upgrade crio to 1.18.3, ubuntu to 20.04 and add terrible hack to fix …
…restarts for cri-o
  • Loading branch information
sharifelgamal committed Jul 30, 2020
commit 61583d62492e2be0387563f460c56b1afba264c1
7 changes: 7 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ func runStart(cmd *cobra.Command, args []string) {
}
}

if existing != nil && existing.KubernetesConfig.ContainerRuntime == "crio" && driver.IsKIC(existing.Driver) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following this -- doesn't this run only if the previous provisionWithDriver error == nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, provision isn't what fails for crio, it's starting k8s that fails. what I found works is if we just stop and start again here, everything works as expected.

I'm basically emulating restarting and failing, then calling minikube stop then calling minikube start again, except I'm skipping the 6 minutes we need to wait for apiserver to not come back in the startWithDriver portion of the code.

again, I have no idea why, but empirically it works and it makes the tests pass.

// Stop and start again if it's crio because crio is bad and dumb
sharifelgamal marked this conversation as resolved.
Show resolved Hide resolved
out.WarningT("CRI-O currently has an issue and your cluster needs to be restarted.")
stopProfile(existing.Name)
starter, err = provisionWithDriver(cmd, ds, existing)
}

kubeconfig, err := startWithDriver(cmd, starter, existing)
if err != nil {
node.MaybeExitWithAdvice(err)
Expand Down
46 changes: 26 additions & 20 deletions cmd/minikube/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,36 +80,42 @@ func runStop(cmd *cobra.Command, args []string) {
}

stoppedNodes := 0

for _, profile := range profilesToStop {
register.Reg.SetStep(register.Stopping)
stoppedNodes = stopProfile(profile)
}

// end new code
api, cc := mustload.Partial(profile)
defer api.Close()
register.Reg.SetStep(register.Done)
if stoppedNodes > 0 {
out.T(out.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes})
}
}

for _, n := range cc.Nodes {
machineName := driver.MachineName(*cc, n)
func stopProfile(profile string) int {
stoppedNodes := 0
register.Reg.SetStep(register.Stopping)

nonexistent := stop(api, machineName)
if !nonexistent {
stoppedNodes++
}
}
// end new code
api, cc := mustload.Partial(profile)
defer api.Close()

if err := killMountProcess(); err != nil {
out.WarningT("Unable to kill mount process: {{.error}}", out.V{"error": err})
}
for _, n := range cc.Nodes {
machineName := driver.MachineName(*cc, n)

if err := kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()); err != nil {
exit.WithError("update config", err)
nonexistent := stop(api, machineName)
if !nonexistent {
stoppedNodes++
}
}

register.Reg.SetStep(register.Done)
if stoppedNodes > 0 {
out.T(out.Stopped, `{{.count}} nodes stopped.`, out.V{"count": stoppedNodes})
if err := killMountProcess(); err != nil {
out.WarningT("Unable to kill mount process: {{.error}}", out.V{"error": err})
}

if err := kubeconfig.UnsetCurrentContext(profile, kubeconfig.PathFromEnv()); err != nil {
exit.WithError("update config", err)
}

return stoppedNodes
}

func stop(api libmachine.API, machineName string) bool {
Expand Down
18 changes: 12 additions & 6 deletions deploy/kicbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,31 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
docker.io \
openssh-server \
dnsutils \
runc \
# libglib2.0-0 is required for conmon, which is required for podman
libglib2.0-0 \
# removing kind's crictl config
&& rm /etc/crictl.yaml

# install cri-o based on https://github.com/cri-o/cri-o/commit/96b0c34b31a9fc181e46d7d8e34fb8ee6c4dc4e1#diff-04c6e90faac2675aa89e2176d2eec7d8R128
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
# Install cri-o/podman dependencies:
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
curl -LO https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_20.04/Release.key && \
apt-key add - < Release.key && apt-get update && \
apt-get install -y --no-install-recommends cri-o-1.17
apt-get install -y --no-install-recommends containers-common catatonit conmon containernetworking-plugins podman-plugins varlink

# install cri-o based on https://github.com/cri-o/cri-o/commit/96b0c34b31a9fc181e46d7d8e34fb8ee6c4dc4e1#diff-04c6e90faac2675aa89e2176d2eec7d8R128
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/1.18:/1.18.3/xUbuntu_20.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
curl -LO https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/1.18:/1.18.3/xUbuntu_20.04/Release.key && \
apt-key add - < Release.key && apt-get update && \
apt-get install -y --no-install-recommends cri-o=1.18.3~2

# install podman
RUN sh -c "echo 'deb https://dl.bintray.com/afbjorklund/podman focal main' > /etc/apt/sources.list.d/podman.list" && \
curl -L https://bintray.com/user/downloadSubjectPublicKey?username=afbjorklund -o afbjorklund-public.key.asc && \
apt-key add - < afbjorklund-public.key.asc && apt-get update && \
apt-get install -y --no-install-recommends podman=1.8.2~2
apt-get install -y --no-install-recommends podman=1.9.3~1

# install varlink
RUN apt-get install -y --no-install-recommends varlink
RUN mkdir -p /usr/lib/cri-o-runc/sbin && cp /usr/local/sbin/runc /usr/lib/cri-o-runc/sbin/runc

COPY entrypoint /usr/local/bin/entrypoint
# automount service
Expand Down