currently I have an application set using git generator that defines the destination namespace as:
destination:
server: https://kubernetes.default.svc
namespace: '{{index .path.segments 1}}'
That works fine, and all subdirectories in the apps/*/yamls inside git gets their own namespace based on the value of that *.
So:
apps/app1/yaml/ goes to app1 namespace
apps/app2/yaml/ goes to app2 namespace
...
But I would like to make a little change in that behaviour.
IF the app name goes like app1:somename, I would like that the somename becomes the namespace name.
apps/app1:somename/yaml/ -> ns would be somename
apps/app2:someothername/yaml/ -> ns would be someothername
apps/app3/yaml/ -> since there is no :name it should fallback to app3 as namespace
Any idea in how to express that in go templating ?