Skip to content

Commit

Permalink
fix: selector issues when upgrading (#30)
Browse files Browse the repository at this point in the history
* fix: selector issues when upgrading

* fix: labels for all k8s objects

* doc: update readme to add upgrade notes
  • Loading branch information
vishnu-narayanan authored Aug 18, 2021
1 parent a0ff45f commit c70de7a
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 40 deletions.
2 changes: 1 addition & 1 deletion charts/chatwoot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sources:
- http://www.chatwoot.com

# This is the chart version.
version: 0.5.6
version: 0.6.0

# This is the application version.
appVersion: "v1.18.2"
18 changes: 18 additions & 0 deletions charts/chatwoot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ The command removes all the Kubernetes components associated with the chart and
| `env.REDIS_SENTINELS` | Redis Sentinel can be used by passing list of sentinel host and ports. For example, `sentinel_host1:port1`, `sentinel_host2:port2` | `""` |
| `env.REDIS_SENTINEL_MASTER_NAME` | Redis sentinel master name is required when using sentinel. | `""` |
| `env.REDIS_URL` | REDIS url | `"redis://:redis@chatwoot-chatwoot-redis-master:6379"` |

### Logging variables

| Name | Type | Default Value |
| ----------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------- |
| `env.RAILS_LOG_TO_STDOUT` | string | `"true"` |
| `env.LOG_LEVEL` | string | `"info"` |
| `env.LOG_SIZE` | string | `"500"` |

### Third party credentials

| Name | Type | Default Value |
Expand Down Expand Up @@ -212,3 +214,19 @@ PostgreSQL is installed along with the chart if you choose the default setup. To
## Redis

Redis is installed along with the chart if you choose the default setup. To use an external Redis DB, please set `redis.enabled` to `false` and set the variables under the Redis section above


## Upgrading


## From 0.5.x to 0.6.x

Existing labels were causing issues with `helm upgrade`. `0.6.x` introduces breaking changes related to selector
labels used for deployements. Please delete your helm release and recreate. Deleting your helm release will
not delete your persistent volumes used for redis and postgres and as such your data should be safe.

```
helm delete chatwoot
helm repo update
helm install chatwoot chatwoot/chatwoot
```
23 changes: 0 additions & 23 deletions charts/chatwoot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,3 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}


{{- define "rails.labels" }}
{{- include "chatwoot.labels" . }}
component: rails
name: {{ .Values.services.name}}
version: {{ .Values.image.tag }}
{{- end }}

{{- define "sidekiq.labels" }}
{{- include "chatwoot.labels" . }}
component: rails
name: sidekiq
{{- end }}

{{- define "migration-job.labels" }}
{{- include "chatwoot.labels" . }}
component: db-migration
name: db-migration
version: {{ .Values.image.tag}}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
{{- end }}
6 changes: 4 additions & 2 deletions charts/chatwoot/templates/env-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ kind: ConfigMap
metadata:
creationTimestamp: null
labels:
{{- include "chatwoot.labels" . | nindent 4 }}

app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
name: env
data:
{{- range $key, $value := .Values.env}}
Expand Down
5 changes: 4 additions & 1 deletion charts/chatwoot/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "chatwoot.labels" . | nindent 4 }}
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
5 changes: 4 additions & 1 deletion charts/chatwoot/templates/migrations-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ kind: Job
metadata:
name: "{{ .Release.Name }}-migrate"
labels:
{{- include "migration-job.labels" . | nindent 4}}
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
Expand Down
5 changes: 4 additions & 1 deletion charts/chatwoot/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ kind: ServiceAccount
metadata:
name: {{ include "chatwoot.serviceAccountName" . }}
labels:
{{- include "chatwoot.labels" . | nindent 4 }}
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
16 changes: 11 additions & 5 deletions charts/chatwoot/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ metadata:
name: {{ template "chatwoot.fullname" . }}-web
creationTimestamp: null
labels:
{{- include "rails.labels" . | nindent 4}}
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ int .Values.web.replica }}
selector:
matchLabels:
{{- include "rails.labels" . | nindent 6 }}
app: {{ template "chatwoot.fullname" . }}
release: "{{ .Release.Name }}"
role: web
strategy: {}
template:
metadata:

creationTimestamp: null
labels:
{{- include "rails.labels" . | nindent 8 }}
app: {{ template "chatwoot.fullname" . }}
release: "{{ .Release.Name }}"
role: web
spec:
containers:
- args:
Expand All @@ -33,7 +39,7 @@ spec:
- docker/entrypoints/rails.sh
env:
{{- include "chatwoot.environ" . }}
image: "{{ .Values.image.repository}}:{{ .Values.image.tag}}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
name: {{ .Chart.Name }}-web
ports:
- containerPort: {{ int .Values.services.internlPort }}
Expand Down
8 changes: 6 additions & 2 deletions charts/chatwoot/templates/web-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ metadata:
name: {{ template "chatwoot.fullname" . }}
creationTimestamp: null
labels:
{{- include "rails.labels" . | nindent 4}}
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- with .Values.services.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand All @@ -16,6 +19,7 @@ spec:
targetPort: {{ int .Values.services.targetPort }}
type: {{ .Values.services.type }}
selector:
{{- include "rails.labels" . | nindent 4}}
app: {{ template "chatwoot.fullname" . }}
role: web
status:
loadBalancer: {}
15 changes: 11 additions & 4 deletions charts/chatwoot/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "chatwoot.fullname" . }}-worker
creationTimestamp: null
labels:
{{- include "sidekiq.labels" . | nindent 4 }}
name: {{ template "chatwoot.fullname" . }}-worker
app: {{ template "chatwoot.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ int .Values.worker.replica }}
selector:
matchLabels:
{{- include "sidekiq.labels" . | nindent 6 }}
app: {{ template "chatwoot.fullname" . }}
release: "{{ .Release.Name }}"
role: worker
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
{{- include "sidekiq.labels" . | nindent 8 }}
app: {{ template "chatwoot.fullname" . }}
release: "{{ .Release.Name }}"
role: worker
spec:
containers:
- args:
Expand Down

0 comments on commit c70de7a

Please sign in to comment.