-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from projectsyn/fix-apiversion
Patch apiVersion in postgresql helm chart
- Loading branch information
Showing
4 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Adjust StatefuleSet generated by helm template: | ||
* * Fix the apiVersion | ||
*/ | ||
local com = import 'lib/commodore.libjsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local inv = kap.inventory(); | ||
local params = inv.parameters.keycloak; | ||
|
||
local chart_output_dir = std.extVar('output_path'); | ||
|
||
local list_dir(dir, basename=true) = | ||
std.native('list_dir')(dir, basename); | ||
|
||
local chart_files = list_dir(chart_output_dir); | ||
|
||
local input_file(elem) = chart_output_dir + '/' + elem; | ||
local stem(elem) = | ||
local elems = std.split(elem, '.'); | ||
std.join('.', elems[:std.length(elems) - 1]); | ||
|
||
|
||
local fix_api_version(sts) = | ||
sts { | ||
apiVersion: 'apps/v1', | ||
}; | ||
|
||
local fixup_obj(obj) = | ||
if obj.kind == 'StatefulSet' then | ||
fix_api_version(obj) | ||
else | ||
obj; | ||
|
||
local fixup(obj_file) = | ||
local objs = std.prune(com.yaml_load_all(obj_file)); | ||
// process all objs | ||
[ fixup_obj(obj) for obj in objs ]; | ||
|
||
{ | ||
[stem(elem)]: fixup(input_file(elem)) | ||
for elem in chart_files | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters