Skip to content

Commit

Permalink
feat: public deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoumingde committed Oct 30, 2024
1 parent fe94995 commit afcc2f8
Show file tree
Hide file tree
Showing 22 changed files with 30,051 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ helm repo add fogcloud-charts https://fogcloud-io.github.io/fogcloud-charts
helm repo update
helm pull fogcloud-charts/fogcloud --untar
helm pull fogcloud-charts/fission-all --untar
helm pull fogcloud-charts/emqx-operator --untar
```
运行后在当前目录会生成fogcloud-charts文件夹

Expand All @@ -31,7 +30,7 @@ helm install fission ./fission-all -n fission
```
4. 安装emqx-operator
```console
helm upgrade --install emqx-operator ./emqx-operator -n emqx-operator --create-namespace
helm upgrade --install emqx-operator ./operator/emqx-operator -n emqx-operator --create-namespace
```
5. 安装fogcloud-charts
```console
Expand Down
2 changes: 1 addition & 1 deletion charts/fogcloud-charts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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: 2.2.5
version: 2.2.6

# 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
Expand Down
15 changes: 13 additions & 2 deletions charts/fogcloud-charts/configs/fogreviser/fogreviser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@ defaults: &defaults
MQTT_BROKER_SECRET: public
MQTT_BROKER_API_PORT: 8081


development: &development
<<: *defaults
REDIS_HOST: redis
POSTGRES_HOST: postgres
MQTT_BROKER_HOST: emqx-listeners
MQTT_BROKER_API_URL: "http://emqx-dashboard:18083"


beta:
<<: *defaults
REDIS_HOST: redis
POSTGRES_HOST: postgres
MQTT_BROKER_HOST: mqtt-broker
MQTT_BROKER_HOST: emqx-listeners
MQTT_BROKER_API_URL: "http://emqx-dashboard:18083"

production:
<<: *defaults
MQTT_BROKER_HOST: mqtt-broker
MQTT_BROKER_HOST: emqx-listeners
MQTT_BROKER_API_URL: "http://emqx-dashboard:18083"
23 changes: 23 additions & 0 deletions charts/fogcloud-charts/operator/emqx-operator/.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/
9 changes: 9 additions & 0 deletions charts/fogcloud-charts/operator/emqx-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
appVersion: 2.2.21
description: A Helm chart for EMQX Operator Controller
name: emqx-operator
sources:
- https://github.com/emqx/emqx-operator/tree/main/deploy/charts/emqx-operator
- https://github.com/emqx/emqx
type: application
version: 2.2.21
67 changes: 67 additions & 0 deletions charts/fogcloud-charts/operator/emqx-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# EMQX Operator

The EMQX Operator provides [Kubernetes](https://kubernetes.io/) native deployment and management of [EMQX](https://www.emqx.io/) including EMQX Broker and EMQX Enterprise. The purpose of this project is to simplify and automate the configuration of the EMQX cluster.

## Installing the Chart

To install the chart with the release name `emqx-operator`:

```console
## Add the EMQX Helm repository
$ helm repo add emqx https://repos.emqx.io/charts
$ helm repo update

## Install the emqx-operator helm chart
$ helm install emqx-operator emqx/emqx-operator \
--namespace emqx-operator-system \
--create-namespace
```

> **Tip**: List all releases using `helm ls -A`
## Uninstalling the Chart

To uninstall/delete the `emqx-operator` deployment:

```console
$ helm delete emqx-operator -n emqx-operator-system
```

## Configuration

The following table lists the configurable parameters of the cert-manager chart and their default values.

| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `skipCRDs` | If `true`, skips installing CRDs | `false` |
| `development` | Development configures the logger to use a Zap development config (stacktraces on warnings, no sampling), otherwise a Zap production config will be used (stacktraces on errors, sampling). | `false` |
| `image.repository` | Image repository | `emqx/emqx-operator-controller` |
| `image.tag` | Image tag | `{{RELEASE_VERSION}}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `imagePullSecrets` | Image pull secrets| `[]` |
| `nameOverride` | Override chart name | `""` |
| `fullnameOverride` | Default fully qualified app name. | `""` |
| `replicaCount` | Number of EMQX operator replicas | `1` |
| `revisionHistoryLimit` | The number of old history to retain to allow rollback | `1` |
| `serviceAccount.create` | If `true`, create a new service account | `true` |
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | |
| `serviceAccount.annotations` | Annotations to add to the service account | |
| `resources` | CPU/memory resource requests/limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `affinity` | Node affinity for pod assignment | `{}` |
| `tolerations` | Node tolerations for pod assignment | `[]` |
| `cert-manager.enable` | Using [cert manager](https://github.com/jetstack/cert-manager) for provisioning the certificates for the webhook server. You can follow [the cert manager documentation](https://cert-manager.io/docs/installation/) to install it. | `false` |
| `cert-manager.secretName` | TLS secret for certificates for the `${NAME}-webhook-service.${NAMESPACE}.svc` | `""` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```console
$ helm install emqx-operator -f values.yaml .
```
> **Tip**: You can use the default [values.yaml](https://github.com/emqx/emqx-operator/tree/main/deploy/charts/emqx-operator/values.yaml)
## Contributing

This chart is maintained at [github.com/emqx/emqx-operator](https://github.com/emqx/emqx-operator/tree/main/deploy/charts/emqx-operator).
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EMQX Operator Controller {{ .Chart.AppVersion }} has been deployed successfully!

Now you can create the EMQX Custom Resource file and deploy it.

Where to get help: https://github.com/emqx/emqx-operator/issues
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "emqx-operator.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 "emqx-operator.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 "emqx-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "emqx-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "emqx-operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if (index .Values "cert-manager" "enable") }}
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ include "emqx-operator.fullname" . }}-selfsigned-issuer
namespace: {{ .Release.Namespace }}
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "emqx-operator.fullname" . }}-serving-cert
namespace: {{ .Release.Namespace }}
spec:
dnsNames:
- {{ include "emqx-operator.fullname" . }}-webhook-service.{{ .Release.Namespace }}.svc
- {{ include "emqx-operator.fullname" . }}-webhook-service.{{ .Release.Namespace }}.svc.cluster.local
issuerRef:
kind: Issuer
name: {{ include "emqx-operator.fullname" . }}-selfsigned-issuer
secretName: {{ index .Values "cert-manager" "secretName" | default (printf "%s-webhook-server-cert" (include "emqx-operator.fullname" .)) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{- if .Values.serviceAccount.create -}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "emqx-operator.fullname" . }}-leader-election-rolebinding
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "emqx-operator.fullname" . }}-leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "emqx-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "emqx-operator.fullname" . }}-leader-election-role
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: controller-manager
name: {{ include "emqx-operator.fullname" . }}-controller-manager-metrics-service
namespace: {{ .Release.Namespace }}
spec:
ports:
- name: metrics
port: 8080
targetPort: metrics
selector:
control-plane: controller-manager
{{- include "emqx-operator.selectorLabels" . | nindent 4 }}
Loading

0 comments on commit afcc2f8

Please sign in to comment.