Skip to content

Commit

Permalink
Add deploy manifests for apiserver (ray-project#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffwan authored Jan 21, 2022
1 parent 719033b commit ca074de
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
30 changes: 30 additions & 0 deletions apiserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Build the backend service
FROM golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY apiserver/go.mod apiserver/go.mod
COPY apiserver/go.sum apiserver/go.sum

# Copy the go source
COPY proto/ proto/
COPY ray-operator/ ray-operator/
COPY apiserver/ apiserver/

WORKDIR /workspace/apiserver
# 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

# Build
WORKDIR /workspace/apiserver
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o kuberay-apiserver cmd/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
WORKDIR /
COPY --from=builder /workspace/apiserver/kuberay-apiserver .
USER 65532:65532

ENTRYPOINT ["/kuberay-apiserver"]
110 changes: 110 additions & 0 deletions apiserver/deploy/base/apiserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kuberay-apiserver
namespace: ray-system
spec:
selector:
matchLabels:
app: kuberay-apiserver
replicas: 1
template:
metadata:
labels:
app: kuberay-apiserver
spec:
serviceAccountName: kuberay-apiserver
containers:
- name: kuberay-apiserver-container
image: kuberay/kuberay-apiserver:v0.1.0
ports:
- containerPort: 8888
- containerPort: 8887
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 300m
memory: 300Mi
---
apiVersion: v1
kind: Service
metadata:
name: kuberay-apiserver-service
annotations:
prometheus.io/path: /metrics
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
namespace: ray-system
spec:
type: NodePort
selector:
app: kuberay-apiserver
ports:
- name: http
port: 8888
targetPort: 8888
nodePort: 31888
- name: rpc
port: 8887
targetPort: 8887
nodePort: 31887

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: kuberay-apiserver
name: kuberay-apiserver
namespace: ray-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: kuberay-apiserver
name: kuberay-apiserver
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kuberay-apiserver
subjects:
- kind: ServiceAccount
name: kuberay-apiserver
namespace: ray-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: kuberay-apiserver
name: kuberay-apiserver
rules:
- apiGroups:
- ray.io
resources:
- rayclusters
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
4 changes: 4 additions & 0 deletions apiserver/deploy/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- apiserver.yaml

0 comments on commit ca074de

Please sign in to comment.