Skip to content

Commit

Permalink
fix: mutliple fixes for pgadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
matmut7 committed May 3, 2024
1 parent 90b5572 commit e7b18ce
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 23 deletions.
4 changes: 4 additions & 0 deletions plugins/contrib/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ dependencies:
degit: socialgouv/helm-charts/charts/maildev@v1
condition: maildev.enabled
version: "1"
- name: pgadmin
degit: socialgouv/helm-charts/charts/pgadmin@v1
version: "1"
condition: pgadmin.enabled
4 changes: 2 additions & 2 deletions plugins/contrib/deploy-with/kubectl-dependency-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = async (options, context) => {

const { surviveOnBrokenCluster = false } = options

const { applyTimeout = "2m" } = options
const { applyTimeout = "2m", kindsForceRecreate = ["Job"] } = options

const kubectlProcesses = []
const kubectlDeleteManifestOptions = {
Expand All @@ -75,7 +75,7 @@ module.exports = async (options, context) => {

const recreateAnnotationKey = "kontinuous/kubectl-recreate"
const getRecreateThisResource = (manifest) => {
if (manifest.kind === "Job") {
if (kindsForceRecreate.includes(manifest.kind)) {
return true
}
const manifestsRecreateResourceOption =
Expand Down
7 changes: 7 additions & 0 deletions plugins/contrib/kontinuous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ deploySidecars:
progressing:
enabled: true

deployWith:
kubectlDependencyTree:
options:
kindsForceRecreate:
- "Job"
- "Policy"

postDeploy:
notifyMattermost:
enabled: false
18 changes: 2 additions & 16 deletions plugins/contrib/values-compilers/09-maildev.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
function isMaildevComponent(component) {
return component[`~chart`]?.endsWith(".contrib.maildev")
}

function extractMaildevComponents(values, acc = []) {
Object.entries(values).forEach(([key, component]) => {
if (typeof component === "object" && component !== null) {
extractMaildevComponents(component, acc)
if (component._isChartValues && isMaildevComponent(component)) {
acc.push([key, component])
}
}
})
return acc
}
const extractComponents = require("./helpers/extract-components")

const maildev = async (values, _options, { _config, utils, _ctx }) => {
const { deepmerge } = utils

const components = extractMaildevComponents(values)
const components = extractComponents("maildev", values)

components.forEach(([key, component]) => {
const persistenceEnabled =
Expand Down
17 changes: 17 additions & 0 deletions plugins/contrib/values-compilers/09-pgadmin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const extractComponents = require("./helpers/extract-components")

module.exports = async (values, _options, { _config, utils, _ctx }) => {
const { deepmerge } = utils
const components = extractComponents("pgadmin", values)

components.forEach(([key, componentValues]) => {
const mergedValues = {
host: componentValues.host || `${key}-${values.global.host}`,
ingress: {
annotations: values.global.ingress.annotations,
},
}

deepmerge(componentValues, mergedValues)
})
}
17 changes: 17 additions & 0 deletions plugins/contrib/values-compilers/helpers/extract-components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function isComponent(name, component) {
return component[`~chart`]?.endsWith(`.contrib.${name}`)
}

function extractComponents(name, values, acc = []) {
Object.entries(values).forEach(([key, component]) => {
if (typeof component === "object" && component !== null) {
extractComponents(name, component, acc)
if (component._isChartValues && isComponent(name, component)) {
acc.push([key, component])
}
}
})
return acc
}

module.exports = extractComponents
4 changes: 0 additions & 4 deletions plugins/fabrique/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ dependencies:
repository: https://codecentric.github.io/helm-charts
version: 2.1.1
condition: keycloakx.enabled
- name: pgadmin
degit: socialgouv/helm-charts/charts/pgadmin@v1
version: "1"
condition: pgadmin.enabled
3 changes: 2 additions & 1 deletion plugins/fabrique/values-compilers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = [

"./global-defaults.js",

"../charts/contrib/values-compilers/09-maildev.js",
"../charts/contrib/values-compilers/09-maildev",
"../charts/contrib/values-compilers/09-pgadmin",
"../charts/contrib/values-compilers/10-tpl-meta-values",
"../charts/contrib/values-compilers/11-get-git-default-branch",
]

0 comments on commit e7b18ce

Please sign in to comment.