-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from yunify/feature/add_buildscript
Feature/add buildscript
- Loading branch information
Showing
5 changed files
with
159 additions
and
9 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
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,8 +1,35 @@ | ||
FROM alpine:edge AS build | ||
RUN apk update | ||
RUN apk upgrade | ||
RUN apk add go gcc g++ make git linux-headers | ||
WORKDIR /app | ||
ENV GOPATH /app | ||
ADD . /app/src/github.com/yunify/hostnic-cni | ||
RUN cd /app/src/github.com/yunify/hostnic-cni && rm -rf bin/ && make go-build | ||
|
||
FROM alpine:latest | ||
MAINTAINER martinyunify <[email protected]> | ||
|
||
ADD daemon / | ||
COPY --from=build /app/src/github.com/yunify/hostnic-cni/bin/daemon /bin/daemon | ||
|
||
EXPOSE 31080 31081 | ||
|
||
ENV LOGLEVEL info | ||
|
||
ENV VXNETS vxnet-xxxxxxx | ||
|
||
ENV POOLSIZE 3 | ||
|
||
ENV CLEANUPCACHEONEXIT false | ||
|
||
RUN mkdir -p /opt/cni/bin/ && mkdir -p /etc/cni/net.d/ | ||
|
||
VOLUME /etc/qingcloud/ | ||
|
||
VOLUME /etc/cni/net.d/ | ||
|
||
COPY --from=build /app/src/github.com/yunify/hostnic-cni/bin/hostnic /opt/cni/bin/hostnic | ||
|
||
ENTRYPOINT ["/bin/daemon"] | ||
|
||
ENTRYPOINT ["/daemon"] | ||
CMD ["start"] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
# Define the project string to be used | ||
PROJECT=hostnic-cni | ||
|
||
|
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,119 @@ | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: hostnic | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
verbs: | ||
- get | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes | ||
verbs: | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes/status | ||
verbs: | ||
- patch | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: hostnic | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: hostnic | ||
subjects: | ||
- kind: ServiceAccount | ||
name: hostnic | ||
namespace: kube-system | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: hostnic | ||
namespace: kube-system | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: kube-hostnic-cni-cfg | ||
namespace: kube-system | ||
labels: | ||
tier: node | ||
app: hostnic | ||
data: | ||
10-hostnic.conf: | | ||
{ | ||
"cniVersion": "0.3.1", | ||
"name": "hostnic", | ||
"type": "hostnic", | ||
"bindaddr":"localhost:31080", | ||
"ipam":{ | ||
"routes":[{"dst":"10.96.0.0/24","gw":"0.0.0.0"}] | ||
}, | ||
"isGateway": true | ||
} | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: kube-qingcloud-hostnic | ||
namespace: kube-system | ||
labels: | ||
tier: node | ||
app: kube-qingcloud-hostnic | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
tier: node | ||
app: kube-qingcloud-hostnic | ||
spec: | ||
hostNetwork: true | ||
nodeSelector: | ||
beta.kubernetes.io/arch: amd64 | ||
tolerations: | ||
- key: node-role.kubernetes.io/master | ||
operator: Exists | ||
effect: NoSchedule | ||
serviceAccountName: hostnic | ||
containers: | ||
- name: kube-qingcloud-hostnic | ||
image: dockerhub.qingcloud.com/qingcloud/hostnic-cni:hostnic-cni-v0.8-1-g89dae0f | ||
command: [ "start" ] | ||
securityContext: | ||
privileged: true | ||
env: | ||
- name: LOGLEVEL | ||
value: "info" | ||
|
||
- name: VXNETS | ||
value: "vxnet-2xj9lrp,vxnet-h00g66q" | ||
|
||
- name: POOLSIZE | ||
value: "3" | ||
|
||
volumeMounts: | ||
- name: hostnic-cfg | ||
mountPath: /etc/cni/ | ||
|
||
- name: qingcloud-cfg | ||
mountPath: /etc/qingcloud/ | ||
|
||
volumes: | ||
- name: hostnic-cfg | ||
configMap: | ||
name: kube-hostnic-cni-cfg | ||
|
||
- name: qingcloud-cfg | ||
hostPath: | ||
path: /etc/qingcloud/ |