Add ssh to kic container image

pull/6390/head
Medya Gh 2020-01-23 17:45:50 -08:00
parent 5191659ff2
commit 773510b9c1
4 changed files with 22 additions and 4 deletions

View File

@ -485,8 +485,8 @@ endif
.PHONY: kic-base-image
kic-base-image: ## builds the base image used for kic.
docker rmi -f $(REGISTRY)/kicbase:v0.0.1-snapshot || true
docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v0.0.1-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) .
docker rmi -f $(REGISTRY)/kicbase:v0.0.2-snapshot || true
docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:v0.0.2-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) .

View File

@ -1,10 +1,13 @@
ARG COMMIT_SHA
# using node image created by kind https://github.com/kubernetes-sigs/kind
# could be changed to ubuntu.
FROM kindest/node:v1.16.2
USER root
RUN apt-get update && apt-get install -y \
sudo \
dnsutils \
&& apt-get clean -y
# Deleting all kind related stuff from the image.
RUN rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
@ -16,3 +19,8 @@ RUN rm -rf \
/usr/share/local/* \
/kind/bin/kubeadm /kind/bin/kubelet /kind/systemd /kind/images /kind/manifests
RUN echo "kic! Build: ${COMMIT_SHA} Time :$(date)" > "/kic.txt"
# for minikube ssh. to match VM using docker username
RUN useradd -ms /bin/bash docker
USER docker
RUN mkdir /home/docker/.ssh

View File

@ -39,7 +39,9 @@ const DefaultPodCIDR = "10.244.0.0/16"
const DefaultBindIPV4 = "127.0.0.1"
// BaseImage is the base image is used to spin up kic containers created by kind.
const BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.1@sha256:c4ad2938877d2ae0d5b7248a5e7182ff58c0603165c3bedfe9d503e2d380a0db"
// const BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.1@sha256:c4ad2938877d2ae0d5b7248a5e7182ff58c0603165c3bedfe9d503e2d380a0db"
// BaseImage is the base image is used to spin up kic containers created by kind.
const BaseImage = "gcr.io/k8s-minikube/kicbase:v0.0.2-snapshot"
// OverlayImage is the cni plugin used for overlay image, created by kind.
const OverlayImage = "kindest/kindnetd:0.5.3"
@ -100,7 +102,13 @@ func (d *Driver) Create() error {
ListenAddress: DefaultBindIPV4,
HostPort: int32(d.NodeConfig.HostBindPort),
ContainerPort: constants.APIServerPort,
})
},
oci.PortMapping{
ListenAddress: DefaultBindIPV4,
HostPort: int32(d.NodeConfig.HostBindPort) + constants.SSHPort, // TODO: @medyagh: use github.com/phayes/freeport instead.
ContainerPort: constants.SSHPort,
},
)
_, err := node.CreateNode(params)
if err != nil {

View File

@ -27,6 +27,8 @@ import (
)
const (
// SSHPort is the SSH serviceport on the node vm and container
SSHPort = 22
// APIServerPort is the default API server port
APIServerPort = 8443
// APIServerName is the default API server name