Skip to content

Commit

Permalink
modify kuberay operator crds and add apiserver chart
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyu.jiang committed Jul 7, 2022
1 parent 3093d78 commit 9acb15a
Show file tree
Hide file tree
Showing 14 changed files with 16,535 additions and 1,877 deletions.
23 changes: 23 additions & 0 deletions helm-chart/kuberay-apiserver/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions helm-chart/kuberay-apiserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: kuberay-apiserver
description: A Helm chart for kuberay-apiserver

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
62 changes: 62 additions & 0 deletions helm-chart/kuberay-apiserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kuberay-apiserver.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kuberay-apiserver.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kuberay-apiserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kuberay-apiserver.labels" -}}
helm.sh/chart: {{ include "kuberay-apiserver.chart" . }}
{{ include "kuberay-apiserver.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kuberay-apiserver.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kuberay-apiserver.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kuberay-apiserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kuberay-apiserver.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions helm-chart/kuberay-apiserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}
labels:
{{ include "kuberay-apiserver.labels" . | indent 4 }}
spec:
selector:
matchLabels:
app.kubernetes.io/component: {{ include "kuberay-apiserver.name" . }}
app.kubernetes.io/name: {{ .Release.Name }}
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app.kubernetes.io/component: {{ include "kuberay-apiserver.name" . }}
app.kubernetes.io/name: {{ .Release.Name }}
spec:
serviceAccountName: {{ .Values.serviceAccount.name }}
containers:
- name: {{ .Values.name }}-container
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- toYaml .Values.containerPort | nindent 8 }}
resources:
{{- toYaml .Values.resources | nindent 10 }}

16 changes: 16 additions & 0 deletions helm-chart/kuberay-apiserver/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.ingress.create -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: kuberay-apiserver-ingress
spec:
rules:
- host: api.kuberay.{{ .Values.ingress.host }}
http:
paths:
- backend:
serviceName: kuberay-apiserver-service
servicePort: 8888
path: /
pathType: ImplementationSpecific
{{- end -}}
42 changes: 42 additions & 0 deletions helm-chart/kuberay-apiserver/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

{{- if .Values.rbacEnable }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: {{ .Values.name }}
name: {{ .Values.name }}
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
- apiGroups:
- ""
resources:
- events
verbs:
- get
- list
- watch
{{- end }}
16 changes: 16 additions & 0 deletions helm-chart/kuberay-apiserver/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.rbacEnable }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
{{ include "kuberay-apiserver.labels" . | indent 4 }}
name: {{ include "kuberay-apiserver.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ include "kuberay-apiserver.fullname" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
14 changes: 14 additions & 0 deletions helm-chart/kuberay-apiserver/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}-service
annotations:
prometheus.io/path: /metrics
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
spec:
type: {{ .Values.service.type }}
selector:
app.kubernetes.io/name: {{ .Values.name }}
ports:
{{- toYaml .Values.service.ports | nindent 12 }}
9 changes: 9 additions & 0 deletions helm-chart/kuberay-apiserver/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: {{ .Values.name }}
name: {{ .Values.name }}
{{- end -}}
50 changes: 50 additions & 0 deletions helm-chart/kuberay-apiserver/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Default values for kuberay-apiserver.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

name: "kuberay-apiserver"
image:
repository: kuberay/apiserver
tag: nightly
pullPolicy: IfNotPresent

## Install Default RBAC roles and bindings
rbac:
create: true
apiVersion: v1

serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: "kuberay-apiserver"

containerPort:
- containerPort: 8888
- containerPort: 8887

resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 300m
memory: 300Mi

service:
type: NodePort
ports:
- name: http
port: 8888
targetPort: 8888
nodePort: 31888
- name: rpc
port: 8887
targetPort: 8887
nodePort: 31887

ingress:
create: false
Loading

0 comments on commit 9acb15a

Please sign in to comment.