Skip to content

Commit c0e15c6

Browse files
author
Emruz Hossain
authored
Add support for custom Pushgateway (#229)
* Add support for custom Pushgateway Signed-off-by: Emruz Hossain <emruz@appscode.com> * Update pushgateway tag Signed-off-by: Emruz Hossain <emruz@appscode.com>
1 parent 4ad1c1f commit c0e15c6

17 files changed

+90
-20
lines changed

apis/installer/v1alpha1/stash_community_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ type StashCommunitySpec struct {
4747
//+optional
4848
NameOverride string `json:"nameOverride"`
4949
//+optional
50-
FullnameOverride string `json:"fullnameOverride"`
51-
ReplicaCount int32 `json:"replicaCount"`
52-
RegistryFQDN string `json:"registryFQDN"`
53-
Operator Container `json:"operator"`
54-
Pushgateway Container `json:"pushgateway"`
55-
Cleaner CleanerRef `json:"cleaner"`
56-
ImagePullPolicy string `json:"imagePullPolicy"`
50+
FullnameOverride string `json:"fullnameOverride"`
51+
ReplicaCount int32 `json:"replicaCount"`
52+
RegistryFQDN string `json:"registryFQDN"`
53+
Operator Container `json:"operator"`
54+
Pushgateway Pushgateway `json:"pushgateway"`
55+
Cleaner CleanerRef `json:"cleaner"`
56+
ImagePullPolicy string `json:"imagePullPolicy"`
5757
//+optional
5858
ImagePullSecrets []string `json:"imagePullSecrets"`
5959
//+optional

apis/installer/v1alpha1/stash_enterprise_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ type StashEnterpriseSpec struct {
4747
//+optional
4848
NameOverride string `json:"nameOverride"`
4949
//+optional
50-
FullnameOverride string `json:"fullnameOverride"`
51-
ReplicaCount int32 `json:"replicaCount"`
52-
RegistryFQDN string `json:"registryFQDN"`
53-
Operator Container `json:"operator"`
54-
Pushgateway Container `json:"pushgateway"`
55-
Cleaner CleanerRef `json:"cleaner"`
56-
ImagePullPolicy string `json:"imagePullPolicy"`
50+
FullnameOverride string `json:"fullnameOverride"`
51+
ReplicaCount int32 `json:"replicaCount"`
52+
RegistryFQDN string `json:"registryFQDN"`
53+
Operator Container `json:"operator"`
54+
Pushgateway Pushgateway `json:"pushgateway"`
55+
Cleaner CleanerRef `json:"cleaner"`
56+
ImagePullPolicy string `json:"imagePullPolicy"`
5757
//+optional
5858
ImagePullSecrets []string `json:"imagePullSecrets"`
5959
//+optional

apis/installer/v1alpha1/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ type Container struct {
4040
SecurityContext *core.SecurityContext `json:"securityContext"`
4141
}
4242

43+
type Pushgateway struct {
44+
Container `json:",inline"`
45+
// Specify the URL of a custom Pushgateway server
46+
// +optional
47+
CustomURL string `json:"customURL,omitempty"`
48+
}
49+
4350
type CleanerRef struct {
4451
ImageRef `json:",inline"`
4552
Skip bool `json:"skip"`

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/stash-community/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ The following table lists the configurable parameters of the `stash-community` c
5959
| operator.securityContext | Security options the operator container should run with | `{}` |
6060
| pushgateway.registry | Docker registry used to pull Prometheus pushgateway image | `prom` |
6161
| pushgateway.repository | Prometheus pushgateway container image | `pushgateway` |
62-
| pushgateway.tag | Prometheus pushgateway container image tag | `v0.5.2` |
62+
| pushgateway.tag | Prometheus pushgateway container image tag | `v1.4.2` |
6363
| pushgateway.resources | Compute Resources required by the Prometheus pushgateway container | `{}` |
6464
| pushgateway.securityContext | Security options the Prometheus pushgateway container should run with | `{}` |
65+
| pushgateway.customURL | If you want to use a custom Pushgatway, specify its URL. Stash will not inject pushgatway sidecar if you set this field. | `` |
6566
| cleaner.registry | Docker registry used to pull Webhook cleaner image | `appscode` |
6667
| cleaner.repository | Webhook cleaner container image | `kubectl` |
6768
| cleaner.tag | Webhook cleaner container image tag | `v1.16` |

charts/stash-community/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,11 @@ imagePullSecrets:
104104
{{- end -}}
105105
{{- $secrets | join "," | print -}}
106106
{{- end -}}
107+
108+
{{- define "pushgateway-url" -}}
109+
{{- if .Values.pushgateway.customURL -}}
110+
{{- .Values.pushgateway.customURL -}}
111+
{{- else -}}
112+
{{- printf "http://%s.%s.svc:56789" (include "stash-community.fullname" . ) .Release.Namespace -}}
113+
{{- end -}}
114+
{{- end -}}

charts/stash-community/templates/deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ spec:
5151
- --audit-log-path=-
5252
- --tls-cert-file=/var/serving-cert/tls.crt
5353
- --tls-private-key-file=/var/serving-cert/tls.key
54-
- --service-name={{ include "stash-community.fullname" . }}
54+
- --pushgateway-url={{ include "pushgateway-url" . }}
5555
- --enable-mutating-webhook={{ .Values.apiserver.enableMutatingWebhook }}
5656
- --enable-validating-webhook={{ .Values.apiserver.enableValidatingWebhook }}
5757
- --bypass-validating-webhook-xray={{ .Values.apiserver.bypassValidatingWebhookXray }}
@@ -97,6 +97,7 @@ spec:
9797
- mountPath: /var/run/secrets/appscode/license
9898
name: license
9999
{{- end }}
100+
{{- if not .Values.pushgateway.customURL }}
100101
- name: pushgateway
101102
securityContext:
102103
{{- toYaml .Values.pushgateway.securityContext | nindent 10 }}
@@ -114,6 +115,7 @@ spec:
114115
name: data-volume
115116
- mountPath: /tmp
116117
name: stash-scratchdir
118+
{{- end }}
117119
volumes:
118120
- emptyDir: {}
119121
name: data-volume

charts/stash-community/templates/service.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ spec:
2525
- name: api
2626
port: 443
2727
targetPort: 8443
28+
{{- if not .Values.pushgateway.customURL }}
2829
# Port used to expose Prometheus pushgateway
2930
- name: pushgateway
3031
port: 56789
3132
protocol: TCP
3233
targetPort: 56789
34+
{{- end }}
3335
selector:
3436
{{- include "stash-community.selectorLabels" . | nindent 4 }}

charts/stash-community/values.openapiv3_schema.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,9 @@ properties:
11641164
type: object
11651165
pushgateway:
11661166
properties:
1167+
customURL:
1168+
description: Specify the URL of a custom Pushgateway server
1169+
type: string
11671170
registry:
11681171
type: string
11691172
repository:

charts/stash-community/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pushgateway:
4747
# Prometheus pushgateway container image
4848
repository: pushgateway
4949
# Prometheus pushgateway container image tag
50-
tag: v0.5.2
50+
tag: v1.4.2
5151
# Compute Resources required by the Prometheus pushgateway container
5252
resources: {}
5353
# Security options the Prometheus pushgateway container should run with
@@ -58,6 +58,10 @@ pushgateway:
5858
# readOnlyRootFilesystem: true
5959
# runAsNonRoot: true
6060
# runAsUser: 1000
61+
62+
# If you want to use a custom Pushgatway, specify its URL.
63+
# Stash will not inject pushgatway sidecar if you set this field.
64+
customURL:
6165
cleaner:
6266
# Docker registry used to pull Webhook cleaner image
6367
registry: appscode

0 commit comments

Comments
 (0)