Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pod and service custom labels #46

Merged
merged 4 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Configure your Infinispan cluster by specifying values in the `deploy.*` section
| `deploy.expose.host` | Specifies the hostname where the Ingress is exposed, if required. | `""` | |
| `deploy.expose.annotations` | Adds annotations to the service that exposes Infinispan on the network. | `{}` | - |
| `deploy.logging.categories` | Configures Infinispan cluster log categories and levels. | `{}` | - |
| `deploy.resourceLabels` | Adds labels to Infinispan resources such as pods and services. | `{}` | - |
| `deploy.podLabels` | Adds labels to every pod created. | `{}` | - |
| `deploy.svcLabels` | Adds labels to every service created. | `{}` | - |
| `deploy.resourceLabels` | Adds labels to all Infinispan resources including pods and services. | `{}` | - |
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each Infinispan Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable/disable ServiceMonitor functionality. | true | - |
| `deploy.nameOverride` | Specifies a name for all Infinispan cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
Expand Down
4 changes: 3 additions & 1 deletion README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Configure your {brandname} cluster by specifying values in the `deploy.*` sectio
| `deploy.expose.host` | Specifies the hostname where the {ingress} is exposed, if required. | `""` | |
| `deploy.expose.annotations` | Adds annotations to the service that exposes {brandname} on the network. | `{}` | - |
| `deploy.logging.categories` | Configures {brandname} cluster log categories and levels. | `{}` | - |
| `deploy.resourceLabels` | Adds labels to {brandname} resources such as pods and services. | `{}` | - |
| `deploy.podLabels` | Adds labels to every pod created. | `{}` | - |
| `deploy.svcLabels` | Adds labels to every service created. | `{}` | - |
ryanemerson marked this conversation as resolved.
Show resolved Hide resolved
| `deploy.resourceLabels` | Adds labels to all {brandname} resources including pods and services. | `{}` | - |
| `deploy.makeDataDirWritable` | Allows write access to the `data` directory for each {brandname} Server node. | false | Setting the value to `true` creates an initContainer that runs `chmod -R` on the `/opt/infinispan/server/data` directory and changes its permissions. |
| `deploy.monitoring.enabled` | Enable/disable ServiceMonitor functionality. | true | - |
| `deploy.nameOverride` | Specifies a name for all {brandname} cluster resources. | Helm Chart release name | Configure a name for the created resources only if you need it to be different to the Helm Chart release name. |
Expand Down
20 changes: 20 additions & 0 deletions templates/helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{- end }}

{{/*
Pod custom labels
*/}}

{{- define "infinispan-helm-charts.podLabels" -}}
{{- range .Values.deploy.podLabels }}
{{ .key }}: {{ .value }}
{{- end }}
{{- end }}

{{/*
Service custom labels
*/}}

{{- define "infinispan-helm-charts.svcLabels" -}}
{{- range .Values.deploy.svcLabels }}
{{ .key }}: {{ .value }}
{{- end }}
{{- end }}

{{/*
Service selector labels
*/}}
Expand Down
1 change: 1 addition & 0 deletions templates/metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
app: infinispan-service-metrics
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.labels" . | nindent 4 }}
{{- include "infinispan-helm-charts.svcLabels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
Expand Down
1 change: 1 addition & 0 deletions templates/ping-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
app: infinispan-service-ping
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.labels" . | nindent 4 }}
{{- include "infinispan-helm-charts.svcLabels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
Expand Down
1 change: 1 addition & 0 deletions templates/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app: infinispan-service-metrics
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.labels" . | nindent 4 }}
{{- include "infinispan-helm-charts.svcLabels" . | nindent 4 }}
spec:
endpoints:
- basicAuth:
Expand Down
1 change: 1 addition & 0 deletions templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
app: infinispan-service
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.labels" . | nindent 4 }}
{{- include "infinispan-helm-charts.svcLabels" . | nindent 4 }}
spec:
{{- if or (eq (.Values.deploy.expose.type) "LoadBalancer") (eq (.Values.deploy.expose.type) "NodePort") }}
type: {{ .Values.deploy.expose.type }}
Expand Down
1 change: 1 addition & 0 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
labels:
app: infinispan-pod
clusterName: {{ include "infinispan-helm-charts.name" . }}
{{- include "infinispan-helm-charts.podLabels" . | nindent 8 }}
spec:
affinity:
podAntiAffinity:
Expand Down
1 change: 1 addition & 0 deletions templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: "{{ include "infinispan-helm-charts.name" . }}-test-connection"
labels:
{{- include "infinispan-helm-charts.labels" . | nindent 4 }}
{{- include "infinispan-helm-charts.podLabels" . | nindent 4 }}
annotations:
{{- include "infinispan-helm-charts.annotations" . | nindent 4 }}
"helm.sh/hook": test
Expand Down
42 changes: 42 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,48 @@
}
}
},
"podLabels": {
"description": "Adds labels to every pod created",
"items": {
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
},
"type": [
"array",
"null"
]
},
"svcLabels": {
"description": "Adds labels to every service created",
"items": {
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
},
"type": [
"array",
"null"
]
},
"resourceLabels": {
"description": "Adds labels to Infinispan resources such as pods and services.",
"items": {
Expand Down
42 changes: 42 additions & 0 deletions values.schema.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,48 @@
}
}
},
"podLabels": {
"description": "Adds labels to every pod created",
"items": {
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
},
"type": [
"array",
"null"
]
},
"svcLabels": {
"description": "Adds labels to every service created",
"items": {
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
},
"type": [
"array",
"null"
]
},
ryanemerson marked this conversation as resolved.
Show resolved Hide resolved
"resourceLabels": {
"description": "Adds labels to {brandname} resources such as pods and services.",
"items": {
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ deploy:

resourceLabels: []

podLabels: []

svcLabels: []

infinispan:
cacheContainer:
# [USER] Add cache, template, and counter configuration.
Expand Down