-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature/add buildscript #19
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8574acc
add dockerfile and k8s metainfo
a2ab2df
fix docker build error
7ee66f2
fix docker build error
cf4a6c6
update docker image tag
0ef7c08
update docker version to support multistage build
f53eb20
update docker version to support multistage build
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个实际部署的时候怎么去变更呢?或者也从 configmap 读取?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#21 如果有多个容器共用一些配置用configmap会更方便。这里只是一个示例。用户可以按需求定制。我觉得在k8s app里可以改成用configmap的。