This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
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 #28 from projectsyn/fix/non-ocp
Remove service servingCert configuration on non-OCP distributions
- Loading branch information
Showing
13 changed files
with
920 additions
and
153 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
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,90 @@ | ||
local com = import 'lib/commodore.libjsonnet'; | ||
|
||
local inv = com.inventory(); | ||
local distribution = inv.parameters.facts.distribution; | ||
|
||
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 fixup_deploy(obj) = | ||
obj { | ||
spec+: { | ||
template+: { | ||
spec+: { | ||
containers: [ | ||
c { | ||
ports: [ | ||
{ | ||
containerPort: 8080, | ||
name: 'http', | ||
}, | ||
], | ||
} | ||
for c in super.containers | ||
if c.name != 'kube-rbac-proxy' | ||
], | ||
volumes: [ | ||
v | ||
for v in super.volumes | ||
if v.name != 'tls-cert' | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
local fixup_service(obj) = | ||
obj { | ||
spec+: { | ||
ports: [ | ||
{ | ||
name: 'http', | ||
port: 8080, | ||
targetPort: 'http', | ||
}, | ||
], | ||
}, | ||
}; | ||
local fixup_servicemonitor(obj) = | ||
obj { | ||
spec+: { | ||
endpoints: [ | ||
{ | ||
interval: '30s', | ||
port: 'http', | ||
scheme: 'http', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
local fixup_obj(obj) = | ||
if obj.kind == 'Deployment' then | ||
fixup_deploy(obj) | ||
else if obj.kind == 'Service' then | ||
fixup_service(obj) | ||
else if obj.kind == 'ServiceMonitor' then | ||
fixup_servicemonitor(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 ]; | ||
|
||
if distribution != 'openshift4' then | ||
{ | ||
[stem(elem)]: fixup(input_file(elem)) | ||
for elem in chart_files | ||
} | ||
else | ||
{} |
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
Oops, something went wrong.