Skip to content

Commit

Permalink
align with charts yurt-dashboard from commit 672e8efd14b3821df9081931…
Browse files Browse the repository at this point in the history
…147d9c20919ff0a8
  • Loading branch information
openyurt-bot committed Aug 30, 2022
1 parent 7f54c18 commit 364cad2
Show file tree
Hide file tree
Showing 10 changed files with 429 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/yurt-dashboard/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: yurt-dashboard
description: Dashboard for openyurt

# 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.
appVersion: 1.16.0
28 changes: 28 additions & 0 deletions charts/yurt-dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Prepare Image

### Build Image

Execute command `make docker-build`, generate docker image.

### Push Image

Execute command `make docker-push`, push docker image to remote repository.

## Deploy Dashboard

```shell

cd charts

cat<<EOF > dashboard.yaml
dashboard:
image:
pullPolicy: IfNotPresent
repository: huiwq1990/yurt-dashboard
tag: latest
ingress:
host: dashboard.yurt.epaas.domain
EOF

helm template yurt-dashboard ./yurt-dashboard -f dashboard.yaml
```
94 changes: 94 additions & 0 deletions charts/yurt-dashboard/crds/user_crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: users.user.openyurt.io
spec:
group: user.openyurt.io
names:
kind: User
listKind: UserList
plural: users
singular: user
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The validPeriod of user
jsonPath: .spec.validPeriod
name: ValidPeriod
type: integer
- description: The effectiveTime of user
jsonPath: .status.effectiveTime
name: EffectiveTime
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: User is the Schema for the users API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: UserSpec defines the desired state of User
properties:
email:
description: User's email
type: string
kubeConfig:
description: User connects to the cluster using KubeConfig
type: string
mobilephone:
description: User's mobile number
type: string
namespace:
description: Namespace indicates what namespace the user can work in
type: string
nodeAddScript:
description: User uses the NodeAddScript to add an edge node to the cluster
type: string
organization:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file User''s organization information'
type: string
token:
description: User uses the Token to log in to the experience center, use the created join-token as login token temporarily
type: string
validPeriod:
description: // MaxNodeNum represents the maximum number of edge nodes that can be added, the default is 3 MaxNodeNum int `json:"maxNodeNum,omitempty"` ValidPeriod represents the validity period of the user, in days, the default is 3 days
type: integer
required:
- email
- mobilephone
- organization
type: object
status:
description: UserStatus defines the observed state of User
properties:
effectiveTime:
description: EffectiveTime represents the effective date of the User
format: date-time
type: string
expired:
description: // NodeNum indicates the number of edge nodes that the user has currently joined NodeNum int `json:"nodeNum"` Expired indicates whether the User has expired, if Expired is true, the User will be deleted
type: boolean
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
52 changes: 52 additions & 0 deletions charts/yurt-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "yurt-dashboard.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 "yurt-dashboard.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 "yurt-dashboard.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "yurt-dashboard.selectorLabels" -}}
app.kubernetes.io/name: {{ include "yurt-dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
37 changes: 37 additions & 0 deletions charts/yurt-dashboard/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "yurt-dashboard.fullname" . }}
labels:
{{- include "yurt-dashboard.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.dashboard.replicaCount }}
selector:
matchLabels:
{{- include "yurt-dashboard.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "yurt-dashboard.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "yurt-dashboard.fullname" . }}-backend
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.dashboard.image.repository }}:{{ .Values.dashboard.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.dashboard.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
{{- with .Values.dashboard.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: openyurt.io/is-edge-worker
operator: In
values: [ "false" ]
22 changes: 22 additions & 0 deletions charts/yurt-dashboard/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "yurt-dashboard.fullname" . }}
labels:
{{- include "yurt-dashboard.labels" . | nindent 4 }}
{{- with .Values.dashboard.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
rules:
- host: {{ .Values.dashboard.ingress.host | quote }}
http:
paths:
- backend:
serviceName: {{ include "yurt-dashboard.fullname" . }}
servicePort: {{ .Values.dashboard.service.port }}
path: /

32 changes: 32 additions & 0 deletions charts/yurt-dashboard/templates/sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "yurt-dashboard.fullname" . }}-backend


---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "yurt-dashboard.fullname" . }}-backend
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "yurt-dashboard.fullname" . }}-backend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "yurt-dashboard.fullname" . }}-backend
subjects:
- kind: ServiceAccount
name: {{ include "yurt-dashboard.fullname" . }}-backend
namespace: {{ .Release.Namespace }}

15 changes: 15 additions & 0 deletions charts/yurt-dashboard/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "yurt-dashboard.fullname" . }}
labels:
{{- include "yurt-dashboard.labels" . | nindent 4 }}
spec:
type: {{ .Values.dashboard.service.type }}
ports:
- port: {{ .Values.dashboard.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "yurt-dashboard.selectorLabels" . | nindent 4 }}
Loading

0 comments on commit 364cad2

Please sign in to comment.