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

Commit

Permalink
Merge pull request #1651 from cloudfoundry-incubator/ak-issue-1649-cr…
Browse files Browse the repository at this point in the history
…edhub-postgres

fix: prevent credhub from consuming the postgres bosh-link from auto-scaler postgres
  • Loading branch information
jandubois authored Dec 8, 2020
2 parents 93a14ff + 026ea33 commit 2963005
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
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 }}

0 comments on commit 2963005

Please sign in to comment.