forked from pingcap/tidb-operator
-
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.
http-service: k8s deploy support (pingcap#5323)
- Loading branch information
1 parent
b2cb233
commit 45cd55c
Showing
4 changed files
with
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM pingcap/pingcap-base:v1 | ||
|
||
ARG TARGETARCH | ||
RUN dnf install -y tzdata bind-utils && dnf clean all | ||
ADD bin/${TARGETARCH}/http-service /usr/local/bin/http-service | ||
|
||
CMD ["/usr/local/bin/http-service"] |
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 |
---|---|---|
|
@@ -5,10 +5,18 @@ LDFLAGS += -X "github.com/pingcap/tidb-operator/http-service/version.GitBranch=$ | |
LDFLAGS += -X "github.com/pingcap/tidb-operator/http-service/version.GoVersion=$(shell go version)" | ||
|
||
GO := $(GOENV) go | ||
GOARCH ?= $(shell go env GOARCH) | ||
GOBUILD := CGO_ENABLED=0 $(GO) build | ||
|
||
DOCKER_REGISTRY ?= localhost:5000 | ||
DOCKER_REPO ?= ${DOCKER_REGISTRY}/pingcap | ||
IMAGE_TAG ?= latest | ||
|
||
build: | ||
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/http-service . | ||
$(GOBUILD) -ldflags '$(LDFLAGS)' -o bin/$(GOARCH)/http-service . | ||
|
||
docker: build | ||
docker build --tag "${DOCKER_REPO}/tidb-operator-http-service:${IMAGE_TAG}" --build-arg=TARGETARCH=$(GOARCH) . | ||
|
||
buf: | ||
GOBIN=$(shell pwd)/bin/ $(GO) install github.com/bufbuild/buf/cmd/[email protected] | ||
|
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,67 @@ | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: tidb-operator-http-service | ||
namespace: tidb-admin | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: tidb-operator:http-service | ||
rules: | ||
- apiGroups: ["*"] | ||
resources: ["namespaces", "secrets"] | ||
verbs: ["*"] | ||
- apiGroups: ["pingcap.com"] | ||
resources: ["*"] | ||
verbs: ["*"] | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: tidb-operator:http-service | ||
subjects: | ||
- kind: ServiceAccount | ||
name: tidb-operator-http-service | ||
namespace: tidb-admin | ||
roleRef: | ||
kind: ClusterRole | ||
name: tidb-operator:http-service | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: tidb-operator-http-service | ||
namespace: tidb-admin | ||
labels: | ||
app: tidb-operator-http-service | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: tidb-operator-http-service | ||
template: | ||
metadata: | ||
labels: | ||
app: tidb-operator-http-service | ||
spec: | ||
serviceAccountName: tidb-operator-http-service | ||
containers: | ||
- name: http-service | ||
image: pingcap/tidb-operator-http-service:latest | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 9080 | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: tidb-operator-http-service | ||
namespace: tidb-admin | ||
spec: | ||
ports: | ||
- port: 9080 | ||
targetPort: 9080 | ||
selector: | ||
app: tidb-operator-http-service |