Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

fix: prevent credhub from consuming the postgres bosh-link from auto-scaler postgres #1651

Merged
merged 2 commits into from
Dec 8, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -o errexit -o nounset

release="credhub"
job="credhub"
job_mf="/var/vcap/all-releases/jobs-src/${release}/${job}/job.MF"
patch --verbose "${job_mf}" <<'EOT'
@@ -76,11 +76,6 @@ provides:
- credhub.data_storage.type
- credhub.data_storage.username

-consumes:
-- name: postgres
- type: database
- optional: true
-
properties:
credhub.port:
description: "Listening port for the CredHub API"
EOT
4 changes: 4 additions & 0 deletions chart/assets/operations/instance_groups/credhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
name: credhub_setup_client_secret
type: password

{{- range $bytes := .Files.Glob "assets/operations/pre_render_scripts/credhub_*" }}
{{ $bytes | toString }}
{{- end }}

{{- else }}

# Remove directly from the cf-deployment.yml YAML file.
Expand Down
1 change: 1 addition & 0 deletions chart/templates/_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
{{- include "_resources.update" . }}
{{- include "_database.update" . }}{{/* database/_database.tpl */}}
{{- include "_multicluster.update" . }}
{{- include "_credhub.update" . }}

{{- range $condition, $message := $.Values.unsupported }}
{{- if eq "true" (include "_config.condition" (list $ $condition)) }}
Expand Down
16 changes: 16 additions & 0 deletions chart/templates/_credhub.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- /*
==========================================================================================
| _credhub.update $
+-----------------------------------------------------------------------------------------
| kubecf credhub customization
| - disable consumption of `postgres` bosh-link. It is optional, and we do not
| wish to reconfigure credhub when autoscaler comes online or is switched off.
| I.e. autoscaler provides a postgres link, and we we wish to ignore it.
==========================================================================================
*/}}
{{- define "_credhub.update" }}
{{- $_ := include "_config.lookupManifest" (list $ "instance_groups/name=credhub/jobs/name=credhub") }}
{{- if $.kubecf.retval }}
{{- $_ := set $.kubecf.retval "consumes" (fromYaml "postgres: null") }}
{{- end }}
{{- end }}