-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak Dockerfile to install bins on k8s
- Loading branch information
1 parent
ed9f217
commit 680a732
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
FROM debian:jessie | ||
MAINTAINER projectcalico | ||
|
||
# Add binaries to image. | ||
RUN mkdir -p /opt/cni/bin | ||
ADD ./dist/calico /opt/cni/bin | ||
ADD ./dist/calico-ipam /opt/cni/bin | ||
|
||
# Add CNI install script. | ||
ADD ./scripts/install-cni.sh /install-cni.sh | ||
|
||
# Set volume, environment, and working directory. | ||
VOLUME /opt/cni | ||
ENV PATH=$PATH:/opt/cni/bin | ||
WORKDIR /opt/cni/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Script to install Calico CNI on a Kubernetes host. | ||
# Expects the CNI binary path to be mounted in to the | ||
# `calico/cni` container at /host/opt/cni/bin. | ||
# Expects the CNI network config path to be mounted in | ||
# to the `calico/cni` container at /host/etc/cni/net.d. | ||
|
||
# Place the binaries. | ||
rm -f /host/opt/cni/bin/calico /host/opt/cni/bin/calico-ipam | ||
cp /opt/cni/bin/calico /host/opt/cni/bin/calico | ||
cp /opt/cni/bin/calico-ipam /host/opt/cni/bin/calico-ipam | ||
echo "Wrote Calico CNI binaries to /host/opt/cni/bin/" | ||
echo "Version: $(/host/opt/cni/bin/calico -v)" | ||
|
||
# Make the network configuration file. | ||
cat >/host/etc/cni/net.d/10-calico.conf <<EOF | ||
{ | ||
"name": "calico-k8s-network", | ||
"type": "calico", | ||
"etcd_endpoints": "http://172.18.18.101:2379", | ||
"log_level": "debug", | ||
"ipam": { | ||
"type": "calico-ipam" | ||
}, | ||
"policy": { | ||
"type": "k8s", | ||
"k8s_api_root": "https://172.18.18.101:443/api/v1/", | ||
"k8s_client_certificate": "/etc/kubernetes/ssl/worker.pem", | ||
"k8s_client_key": "/etc/kubernetes/ssl/worker-key.pem" | ||
} | ||
} | ||
EOF | ||
|
||
echo "Wrote CNI config to disk: $(cat /host/etc/cni/net.d/10-calico.conf)" | ||
|
||
# And finally, sleep forever. | ||
echo "Done configuring CNI, sleeping" | ||
while true; do | ||
sleep 1; | ||
done |