forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clustermesh-apiserver: Add to cilium repo
Move clustermesh-apiserver to Cilium repo to ease development. Add support scripts for mTLS config management to contrib/k8s. Signed-off-by: Jarno Rajahalme <[email protected]>
- Loading branch information
1 parent
23ca7f2
commit 4d64ba1
Showing
14 changed files
with
1,588 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
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 @@ | ||
# (first line comment needed for DOCKER_BUILDKIT use) | ||
# | ||
ARG BASE_IMAGE=scratch | ||
|
||
FROM docker.io/library/golang:1.15.3 as builder | ||
ARG CILIUM_SHA="" | ||
LABEL cilium-sha=${CILIUM_SHA} | ||
ADD . /go/src/github.com/cilium/cilium | ||
WORKDIR /go/src/github.com/cilium/cilium/clustermesh-apiserver | ||
ARG NOSTRIP | ||
ARG LOCKDEBUG | ||
ARG RACE | ||
RUN make RACE=${RACE} NOSTRIP=${NOSTRIP} LOCKDEBUG=${LOCKDEBUG} | ||
|
||
# CGO_ENABLED=0 GOOS=linux go build | ||
|
||
FROM docker.io/library/alpine:3.12.0 as certs | ||
ARG CILIUM_SHA="" | ||
LABEL cilium-sha=${CILIUM_SHA} | ||
RUN apk --update add ca-certificates | ||
|
||
FROM docker.io/library/golang:1.15.3 as gops | ||
ARG CILIUM_SHA="" | ||
LABEL cilium-sha=${CILIUM_SHA} | ||
RUN go get -d github.com/google/gops && \ | ||
cd /go/src/github.com/google/gops && \ | ||
git checkout -b v0.3.10 v0.3.10 && \ | ||
git --no-pager remote -v && \ | ||
git --no-pager log -1 && \ | ||
CGO_ENABLED=0 go install && \ | ||
strip /go/bin/gops | ||
|
||
FROM ${BASE_IMAGE} | ||
ARG CILIUM_SHA="" | ||
LABEL cilium-sha=${CILIUM_SHA} | ||
LABEL maintainer="[email protected]" | ||
COPY --from=builder /go/src/github.com/cilium/cilium/clustermesh-apiserver/etcd-config.yaml /var/lib/cilium/etcd-config.yaml | ||
COPY --from=builder /go/src/github.com/cilium/cilium/clustermesh-apiserver/clustermesh-apiserver /usr/bin/clustermesh-apiserver | ||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=gops /go/bin/gops /bin/gops | ||
ENTRYPOINT ["/usr/bin/clustermesh-apiserver"] |
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 @@ | ||
clustermesh-apiserver |
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,26 @@ | ||
# Copyright 2017-2020 Authors of Cilium | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
include ../Makefile.defs | ||
|
||
TARGET := clustermesh-apiserver | ||
|
||
.PHONY: all $(TARGET) clean install | ||
|
||
all: $(TARGET) | ||
|
||
$(TARGET): | ||
@$(ECHO_GO) | ||
$(QUIET)$(GO_BUILD) -o $@ | ||
|
||
clean: | ||
@$(ECHO_CLEAN) | ||
-$(QUIET)rm -f $(TARGET) | ||
$(QUIET)$(GO_CLEAN) | ||
|
||
install: | ||
$(QUIET)$(INSTALL) -m 0755 -d $(DESTDIR)$(BINDIR) | ||
$(QUIET)$(INSTALL) -m 0755 $(TARGET) $(DESTDIR)$(BINDIR) | ||
$(QUIET)$(INSTALL) -m 0755 -d $(DESTDIR)$(CONFDIR)/bash_completion.d | ||
./$(TARGET) completion bash > $(TARGET)_bash_completion | ||
$(QUIET)$(INSTALL) -m 0644 -T $(TARGET)_bash_completion $(DESTDIR)$(CONFDIR)/bash_completion.d/$(TARGET) |
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,29 @@ | ||
# API server for Cilium ClusterMesh | ||
|
||
## Deploy the clustermesh-apiserver | ||
|
||
Cilium Helm charts automatically deploy clustermesh-apiserver when Cilium | ||
cluster.name is not "default". Remember to set a non-zero cluster.id in Helm as | ||
well. `clustermesh-apiserver` service type defaults to `NodePort`. Depending on | ||
your k8s provider it may be beneficial to change this to `LoadBalancer`: | ||
|
||
$ helm install cilium ... \ | ||
--set clustermesh.apiserver.service.type=LoadBalancer \ | ||
|
||
Additionally, if your load balancer can give you a static IP address, it may be | ||
specified like so: | ||
|
||
$ helm install cilium ... \ | ||
--set clustermesh.apiserver.service.loadBalancerIP=xxx.xxx.xxx.xxx \ | ||
|
||
## Connect Cilium clusters in to a clustermesh | ||
|
||
1. Extract a `cilium-clustermesh` secret from each cluster to be applied in another cluster: | ||
|
||
$ contrib/k8s/k8s-extract-clustermesh-nodeport-secret.sh > cluster1-secret.json | ||
|
||
Repeat this step in all your clusters, storing the outputs into different files. | ||
|
||
3. Apply secrets from all other clusters in each of your clusters, e.g., on cluster1: | ||
|
||
$ contrib/k8s/k8s-import-clustermesh-secrets.sh cluster2-secret.json cluster3-secret.json ... |
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,6 @@ | ||
--- | ||
trusted-ca-file: /var/lib/cilium/etcd-secrets/ca.crt | ||
key-file: /var/lib/cilium/etcd-secrets/tls.key | ||
cert-file: /var/lib/cilium/etcd-secrets/tls.crt | ||
endpoints: | ||
- https://127.0.0.1:2379 |
Oops, something went wrong.