Skip to content

Commit

Permalink
merge images into one
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Feb 22, 2020
1 parent 232251b commit 866db99
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 225 deletions.
29 changes: 7 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@ GOFILES_NOVENDOR=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
GO_VERSION=1.13

REGISTRY=index.alauda.cn/alaudak8s
ROLES=node controller cni db webhook pinger
DEV_TAG=dev
RELEASE_TAG=$(shell cat VERSION)

.PHONY: build-dev-images build-go build-bin test lint up down halt suspend resume kind push-dev push-release

build-dev-images: build-bin
@for role in ${ROLES} ; do \
docker build -t ${REGISTRY}/kube-ovn-$$role:${DEV_TAG} -f dist/images/Dockerfile.$$role dist/images/; \
done
docker build -t ${REGISTRY}/kube-ovn:${DEV_TAG} -f dist/images/Dockerfile dist/images/

push-dev:
@for role in ${ROLES} ; do \
docker push ${REGISTRY}/kube-ovn-$$role:${DEV_TAG}; \
done
docker push ${REGISTRY}/kube-ovn:${DEV_TAG}

build-go:
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/dist/images/kube-ovn -ldflags "-w -s" -v ./cmd/cni
Expand All @@ -26,14 +21,10 @@ build-go:
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/dist/images/kube-ovn-pinger -ldflags "-w -s" -v ./cmd/pinger

release: lint build-go
@for role in ${ROLES} ; do \
docker build -t ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG} -f dist/images/Dockerfile.$$role dist/images/; \
done
docker build -t ${REGISTRY}/kube-ovn:${RELEASE_TAG} -f dist/images/Dockerfile dist/images/

push-release:
@for role in ${ROLES} ; do \
docker push ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
docker push ${REGISTRY}/kube-ovn:${RELEASE_TAG}

lint:
@gofmt -d ${GOFILES_NOVENDOR}
Expand Down Expand Up @@ -70,9 +61,7 @@ suspend:
kind-init:
kind delete cluster --name=kube-ovn
kind create cluster --config yamls/kind.yaml --name kube-ovn
@for role in ${ROLES} ; do \
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl label node kube-ovn-control-plane kube-ovn/role=master
kubectl apply -f yamls/crd.yaml
kubectl apply -f yamls/ovn.yaml
Expand All @@ -81,18 +70,14 @@ kind-init:
kind-init-ha:
kind delete cluster --name=kube-ovn
kind create cluster --config yamls/kind.yaml --name kube-ovn
@for role in ${ROLES} ; do \
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl label node --all kube-ovn/role=master
kubectl apply -f yamls/crd.yaml
kubectl apply -f yamls/ovn-ha.yaml
kubectl apply -f yamls/kube-ovn.yaml

kind-reload:
@for role in ${ROLES} ; do \
kind load docker-image ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl delete pod -n kube-ovn --all

kind-clean:
Expand Down
15 changes: 11 additions & 4 deletions dist/images/Dockerfile.cni → dist/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,24 @@ RUN rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERS
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/ovn-central-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm && \
rpm -ivh --nodeps https://github.com/alauda/ovs/releases/download/${OVS_VERSION}-${OVS_SUBVERSION}/ovn-host-${OVS_VERSION}-${OVS_SUBVERSION}.el7.x86_64.rpm

RUN mkdir -p /var/run/openvswitch
RUN mkdir -p /var/run/openvswitch && \
mkdir -p /var/run/ovn && \
mkdir -p /etc/cni/net.d && \
mkdir -p /opt/cni/bin

ENV CNI_VERSION=v0.7.5
RUN curl -sSf -L --retry 5 https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-amd64-${CNI_VERSION}.tgz | tar -xz -C . ./loopback ./portmap

COPY start-cniserver.sh /kube-ovn/start-cniserver.sh
COPY install-cni.sh /kube-ovn/install-cni.sh
ENV KUBE_VERSION="v1.13.2"
RUN curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o /usr/bin/kubectl \
&& chmod +x /usr/bin/kubectl

COPY *.sh /kube-ovn/
COPY 00-kube-ovn.conflist /kube-ovn/00-kube-ovn.conflist

WORKDIR /kube-ovn
CMD ["sh", "start-cniserver.sh"]

COPY kube-ovn /kube-ovn/kube-ovn
COPY kube-ovn-daemon /kube-ovn/kube-ovn-daemon
COPY kube-ovn-pinger /kube-ovn/kube-ovn-pinger
COPY kube-ovn-controller /kube-ovn/kube-ovn-controller
35 changes: 0 additions & 35 deletions dist/images/Dockerfile.controller

This file was deleted.

39 changes: 0 additions & 39 deletions dist/images/Dockerfile.db

This file was deleted.

37 changes: 0 additions & 37 deletions dist/images/Dockerfile.node

This file was deleted.

34 changes: 0 additions & 34 deletions dist/images/Dockerfile.pinger

This file was deleted.

34 changes: 0 additions & 34 deletions dist/images/Dockerfile.webhook

This file was deleted.

9 changes: 5 additions & 4 deletions yamls/kube-ovn-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
hostNetwork: true
containers:
- name: kube-ovn-controller
image: "index.alauda.cn/alaudak8s/kube-ovn-controller:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/start-controller.sh
Expand Down Expand Up @@ -110,7 +110,7 @@ spec:
hostPID: true
initContainers:
- name: install-cni
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command: ["/kube-ovn/install-cni.sh"]
securityContext:
Expand All @@ -123,7 +123,7 @@ spec:
name: cni-bin
containers:
- name: cni-server
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
command: ["sh", "/kube-ovn/start-cniserver.sh"]
args:
- --enable-mirror=false
Expand Down Expand Up @@ -206,8 +206,9 @@ spec:
hostPID: true
containers:
- name: pinger
image: "index.alauda.cn/alaudak8s/kube-ovn-pinger:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command: ["/kube-ovn/kube-ovn-pinger"]
securityContext:
runAsUser: 0
privileged: false
Expand Down
8 changes: 4 additions & 4 deletions yamls/kube-ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
hostNetwork: true
containers:
- name: kube-ovn-controller
image: "index.alauda.cn/alaudak8s/kube-ovn-controller:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/start-controller.sh
Expand Down Expand Up @@ -108,7 +108,7 @@ spec:
hostPID: true
initContainers:
- name: install-cni
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command: ["/kube-ovn/install-cni.sh"]
securityContext:
Expand All @@ -121,7 +121,7 @@ spec:
name: cni-bin
containers:
- name: cni-server
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
imagePullPolicy: IfNotPresent
command:
- sh
Expand Down Expand Up @@ -211,7 +211,7 @@ spec:
hostPID: true
containers:
- name: pinger
image: "index.alauda.cn/alaudak8s/kube-ovn-pinger:v1.1.0-pre"
image: "index.alauda.cn/alaudak8s/kube-ovn:v1.1.0-pre"
command: ["/kube-ovn/kube-ovn-pinger", "--external-address=114.114.114.114"]
imagePullPolicy: IfNotPresent
securityContext:
Expand Down
Loading

0 comments on commit 866db99

Please sign in to comment.