update terminal controller image, disable CGO (#1745)

Signed-off-by: gitccl <chenchuanle6@gmail.com>

Signed-off-by: gitccl <chenchuanle6@gmail.com>
This commit is contained in:
gitccl
2022-09-09 23:13:55 +08:00
committed by GitHub
parent e940d90335
commit 7a9346ade9
10 changed files with 21 additions and 34 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
module: [ user ]
module: [ user, terminal ]
steps:
- name: Checkout
uses: actions/checkout@v3
-1
View File
@@ -1,4 +1,3 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
+3 -25
View File
@@ -1,27 +1,5 @@
# Build the manager binary
FROM golang:1 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
ARG TARGETARCH
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
ENTRYPOINT ["/manager"]
COPY bin/controller-terminal-$TARGETARCH /manager
ENTRYPOINT ["/manager"]
+7 -2
View File
@@ -1,6 +1,6 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
IMG ?= ghcr.io/labring/terminal-controller:dev
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.24.1
@@ -63,7 +63,7 @@ test: manifests generate fmt vet envtest ## Run tests.
.PHONY: build
build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go
CGO_ENABLED=0 go build -o bin/manager main.go
.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
@@ -91,6 +91,11 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
.PHONY: pre-deploy
pre-deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default > deploy/manifests/deploy.yaml
.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
@@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: tomaito/terminal-controller
newTag: v1.2
newTag: v1.3
@@ -41,6 +41,7 @@ import (
)
const (
Protocol = "https://"
FinalizerName = "terminal.sealos.io/finalizer"
KeepaliveAnnotation = "lastUpdateTime"
)
@@ -169,8 +170,9 @@ func (r *TerminalReconciler) syncIngress(ctx context.Context, req ctrl.Request,
return err
}
if terminal.Status.Domain != host {
terminal.Status.Domain = host
domain := Protocol + host
if terminal.Status.Domain != domain {
terminal.Status.Domain = domain
return r.Status().Update(ctx, terminal)
}
+3
View File
@@ -0,0 +1,3 @@
FROM scratch
COPY manifests ./terminal-controller
CMD ["kubectl apply -f terminal-controller/clusterissuer.yaml", "kubectl apply -f terminal-controller/deploy.yaml"]
@@ -395,7 +395,7 @@ spec:
- --leader-elect
command:
- /manager
image: tomaito/terminal-controller:v1.2
image: ghcr.io/labring/terminal-controller:dev
livenessProbe:
httpGet:
path: /healthz
+1 -1
View File
@@ -63,7 +63,7 @@ test: manifests generate fmt vet envtest ## Run tests.
.PHONY: build
build:## Build manager binary.
go build -o bin/manager main.go
CGO_ENABLED=0 go build -o bin/manager main.go
.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.