Skip to content
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

feat: ep-controller fix and refactor yaml #83

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,30 @@ images:
docker build $(DOCKERARGS) -f ./build/crossdns.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/crossdns:${IMAGE_TAG}
docker build $(DOCKERARGS) -f ./build/cnf.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:${IMAGE_TAG}
docker build $(DOCKERARGS) -f ./build/dedinic.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/dedinic:${IMAGE_TAG}
docker build $(DOCKERARGS) -f ./build/ep-controller.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/ep-controller:${IMAGE_TAG}
docker build $(DOCKERARGS) -f ./build/ep-controller.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:${IMAGE_TAG}

image-crossdns:
docker build $(DOCKERARGS) -f ./build/crossdns.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/crossdns:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/crossdns:${IMAGE_TAG}

image-dedinic:
docker build $(DOCKERARGS) -f ./build/dedinic.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/dedinic:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/dedinic:${IMAGE_TAG}

image-cnf:
docker build $(DOCKERARGS) -f ./build/cnf.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:${IMAGE_TAG}
docker tag ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:${IMAGE_TAG} ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:latest
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:latest

image-ep-controller:
docker build $(DOCKERARGS) -f ./build/ep-controller.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/ep-controller:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/ep-controller:${IMAGE_TAG}
docker build $(DOCKERARGS) -f ./build/ep-controller.Dockerfile ./ -t ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:${IMAGE_TAG}
docker tag ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:${IMAGE_TAG} ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:latest
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:latest


images-push:
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/crossdns:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/cnf:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/dedinic:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/ep-controller:${IMAGE_TAG}
docker push ${REGISTRY}/${REGISTRY_NAMESPACE}/controller:${IMAGE_TAG}

# find or download golangci-lint
# download golangci-lint if necessary
Expand Down
22 changes: 16 additions & 6 deletions build/cnf.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
FROM golang:1.21 as builder
FROM golang:1.21-alpine as builder

WORKDIR /workspace
RUN apt install -y make
RUN apk update && apk add --no-cache make git
COPY ../go.mod ../go.sum ./
COPY ../staging ./staging
RUN go mod download
COPY .. .
RUN make cnf


FROM ubuntu:jammy
RUN apt update && apt install iproute2 bridge-utils tcpdump -y
RUN apt install wireguard-tools wget openresolv iptables -y
RUN apt-get autoclean; rm -rf /var/lib/apt/lists/*
FROM alpine:latest

# Install required packages
RUN apk update && apk add --no-cache \
iproute2 \
bridge-utils \
tcpdump \
iputils \
wireguard-tools \
wget \
openresolv \
iptables \
vim

WORKDIR /cnf
COPY --from=builder /workspace/bin/cnf ./
16 changes: 0 additions & 16 deletions build/daemon.Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions build/dedinic.Dockerfile

This file was deleted.

47 changes: 0 additions & 47 deletions build/start-dedinic.sh

This file was deleted.

64 changes: 55 additions & 9 deletions deploy/cluster/templates/cnf-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,40 @@ spec:
app: cnf-nauti
router.nauti.io/cnf: "true"
spec:
serviceAccountName: octopus
serviceAccountName: {{ .Values.serviceAccount.name }}
hostNetwork: false
containers:
- name: cnf-nauti
- name: controller
command:
- "/ep-controller"
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: PARALLEL_IP_ANNOTATION
value: "router.nauti.io/dedicated_ip"
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}/controller:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
requests:
cpu: 500m
memory: 512Mi
- name: cnf
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}/cnf:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
runAsUser: 0
privileged: true
command:
- ./cnf
- /cnf/cnf
args:
- --shared-namespace=syncer-operator
- --local-namespace=syncer-operator
- --as-hub={{ .Values.cluster.hub }}}
- --as-hub={{ .Values.cluster.hub }}
- --as-cluster=true
- --hub-secret-namespace=nauti-system
- --hub-secret-name=octopus
- --hub-secret-name={{ .Values.hub.secretName }}
- --hub-url={{ .Values.hub.hubURL }}
env:
- name: NAUTI_CLUSTERID
Expand All @@ -54,9 +70,39 @@ spec:
resources:
limits:
cpu: "1"
memory: 1000Mi
memory: 1Gi
requests:
cpu: 200m
memory: 200Mi
cpu: 100m
memory: 100Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/netns
mountPropagation: Bidirectional
name: host-ns
- mountPath: /var/run/nri
mountPropagation: HostToContainer
name: host-nri
dnsPolicy: ClusterFirst
nodeSelector:
kubernetes.io/os: "linux"
kubernetes.io/os: linux
priorityClassName: system-node-critical
restartPolicy: Always
securityContext: { }
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
- key: CriticalAddonsOnly
operator: Exists
volumes:
- hostPath:
path: /var/run/netns
type: ""
name: host-ns
- hostPath:
path: /var/run/nri
type: DirectoryOrCreate
name: host-nri
112 changes: 0 additions & 112 deletions deploy/cluster/templates/dedinic-cr.yaml

This file was deleted.

Loading
Loading