From 9620fbbfca25922caf58574512c1976f4e1edf76 Mon Sep 17 00:00:00 2001 From: Hongchao Deng Date: Sat, 7 Aug 2021 16:05:09 +0800 Subject: [PATCH] add helm chart --- .../templates/apiserver/api-service.yaml | 20 +++++++++++++++++++ .../templates/kubevela-controller.yaml | 18 +++++++++++++++++ charts/vela-core/values.yaml | 12 +++++++++++ cmd/apiserver/main.go | 4 ++-- pkg/apiserver/commands/server/server.go | 3 +-- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 charts/vela-core/templates/apiserver/api-service.yaml diff --git a/charts/vela-core/templates/apiserver/api-service.yaml b/charts/vela-core/templates/apiserver/api-service.yaml new file mode 100644 index 000000000..c9709b56b --- /dev/null +++ b/charts/vela-core/templates/apiserver/api-service.yaml @@ -0,0 +1,20 @@ +{{- if .Values.apiserver.enabled -}} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ template "kubevela.name" . }}-api + namespace: {{ .Release.Namespace }} + labels: + {{- include "kubevela.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.apiserver.port }} + targetPort: {{ .Values.apiserver.port }} + protocol: TCP + name: api + selector: + {{- include "kubevela.selectorLabels" . | nindent 6 }} + +{{- end }} \ No newline at end of file diff --git a/charts/vela-core/templates/kubevela-controller.yaml b/charts/vela-core/templates/kubevela-controller.yaml index 62bc8b8e3..2dc1b0db1 100644 --- a/charts/vela-core/templates/kubevela-controller.yaml +++ b/charts/vela-core/templates/kubevela-controller.yaml @@ -158,6 +158,24 @@ spec: name: tls-cert-vol readOnly: true {{ end }} + {{- if .Values.apiserver.enabled -}} + - name: {{ .Release.Name }}-api + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + command: + - "apiserver" + args: + - "start" + - "--port={{ .Values.apiserver.port }}" + ports: + - containerPort: {{ .Values.apiserver.port }} + name: api + protocol: TCP + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ quote .Values.image.pullPolicy }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{ end }} {{ if .Values.admissionWebhooks.enabled }} volumes: - name: tls-cert-vol diff --git a/charts/vela-core/values.yaml b/charts/vela-core/values.yaml index 4cd3a0745..04dfbe36c 100644 --- a/charts/vela-core/values.yaml +++ b/charts/vela-core/values.yaml @@ -78,6 +78,18 @@ admissionWebhooks: # If autoGenWorkloadDefinition is true, webhook will auto generated workloadDefinition which componentDefinition refers to autoGenWorkloadDefinition: true +apiserver: + enabled: true + port: 8000 + resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 50m + memory: 20Mi + + #Enable debug logs for development purpose logDebug: false diff --git a/cmd/apiserver/main.go b/cmd/apiserver/main.go index 0361f6db3..947cf5294 100644 --- a/cmd/apiserver/main.go +++ b/cmd/apiserver/main.go @@ -25,8 +25,8 @@ import ( func main() { app := commands.NewCLI( - "velacp", - "KubeVela control plane", + "apiserver", + "KubeVela API Server", ) app.AddCommands( server.NewServerCommand(), diff --git a/pkg/apiserver/commands/server/server.go b/pkg/apiserver/commands/server/server.go index 122ed7ece..927226575 100644 --- a/pkg/apiserver/commands/server/server.go +++ b/pkg/apiserver/commands/server/server.go @@ -34,14 +34,13 @@ func NewServerCommand() *cobra.Command { s := &server{} cmd := &cobra.Command{ - Use: "apiserver", + Use: "start", Short: "Start running apiserver.", RunE: func(cmd *cobra.Command, args []string) error { return s.run() }, } - // rest cmd.Flags().IntVar(&s.restCfg.Port, "port", 8000, "The port number used to serve the http APIs.") return cmd