Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [


{
"name": "Launch Namespace Custom",
"type": "go",
Expand All @@ -16,9 +14,8 @@
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",

// "envFile": "${workspaceRoot}/.dev.env",
"args": ["apply-namespace","--skip-deps","--diff-run","--dry-run", "-e","dev","--lint","dap-base"],
"args": ["apply", "namespace","--skip-deps","--diff-run","--dry-run", "-e","dev","--lint","dap-base"],
"showLog": true
},
{
Expand All @@ -31,9 +28,8 @@
"port": 2345,
"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",

// "envFile": "${workspaceRoot}/.dev.env",
"args": ["apply-namespace", "-e","dev","--lint","default"],
"args": ["apply", "namespace", "-e","dev","--lint","default"],
"showLog": true
},
{
Expand All @@ -43,11 +39,11 @@
"mode": "debug",
"remotePath": "",
"cwd": "${workspaceRoot}",
"port": 2345,
"host": "127.0.0.1",
//"port": 2345,
//"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",
// "envFile": "${workspaceRoot}/.dev.env",
"args": ["apply","--skip-deps","--diff-run", "-e","dev", "-n", "default","monitoring"],
"args": ["apply","--dry-run","--skip-deps","--diff-run", "-e","dev", "-n", "default","--app","k8s","monitoring"],
"showLog": true
},
{
Expand All @@ -57,11 +53,11 @@
"mode": "debug",
"remotePath": "",
"cwd": "${workspaceRoot}",
"port": 2345,
"host": "127.0.0.1",
//"port": 2345,
//"host": "127.0.0.1",
"program": "${workspaceRoot}/main.go",
// "envFile": "${workspaceRoot}/.dev.env",
"args": ["apply","-e","dev", "-n", "default","gitops-defs","--app","dummy","monitoring"],
"args": ["apply","--dry-run","--skip-deps","-e","dev", "-n", "default","gitops-manifests","--app","k8s","monitoring"],
"showLog": true
},
{
Expand Down
2 changes: 1 addition & 1 deletion cmd/applyGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func applyAppGroup(group string, namespace string, outputDir string, appFilter s
for _, matchedAppFile := range matches {
appFile := filepath.Base(matchedAppFile)
if appFile != "_app_group.yaml" {
app := utils.SanitizeAppName(appFile)
app := utils.SanitizeAppName(appFile, match)
if appFilter != "" {

if app != appFilter {
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/stringUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"strings"
)

func SanitizeAppName(input string) string {
r, _ := regexp.Compile("\\.ya?ml")
func SanitizeAppName(input string, expr string) string {
r, _ := regexp.Compile(expr) //"\\.ya?ml"
return r.ReplaceAllString(input, "")
}

Expand Down
6 changes: 3 additions & 3 deletions realm/namespaces/_defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repositories:
# To use official "stable" charts a.k.a https://github.com/helm/charts/tree/master/stable
- name: stable
url: https://kubernetes-charts-incubator.storage.googleapis.com
- name: incubator
url: https://charts.helm.sh/incubator

helmDefaults:
#tillerNamespace: tiller-namespace #dedicated default key for tiller-namespace
Expand All @@ -20,4 +20,4 @@ environments:

releases:
- name: dummydummy
chart: stable/raw
chart: incubator/raw
46 changes: 46 additions & 0 deletions realm/namespaces/default/monitoring/k8s.gitops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


bases:
- ../../_defaults.yaml
- ../_namespace.yaml
- ../../../values/env/{{.Environment.Name}}/values.yaml
- _app_group.yaml

---
templates:
{{ tpl ( readFile "./../../../templates/templates.yaml") . }}

releases:
- name: {{.Values.app}}
<<: *base-local
chart: incubator/raw
version: 0.2.3
values:
- templates:
- |
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: {{.Values.appGroup}}-{{.Values.app}}
namespace: {{.Values.namespace}}
spec:
serviceAccountName: {{.Values.namespaceDeployServiceAccount}}
fetch:
- image:
url: arttii/dummydeploy
# secretRef:
# name: {{.Values.dockerSecret}}
subPath: {{.Values.appGroup}}/dummy
template:
- ytt:
ignoreUnknownComments: true
strict: false
deploy:
- kapp:
rawOptions: ["--dangerous-override-ownership-of-existing-resources=true","--apply-concurrency=10"]
delete:
rawOptions: ["--apply-ignored=true"]




19 changes: 19 additions & 0 deletions realm/namespaces/default/monitoring/k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bases:
- ../../_defaults.yaml
- ../../../values/env/dev/{{.Environment.Values.namespace}}/values.yaml

releases:
- name: dummy
chart: incubator/raw
version: 0.2.3
values:
- templates:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: dummy




46 changes: 46 additions & 0 deletions realm/namespaces/default/monitoring/test.gitops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


bases:
- ../../_defaults.yaml
- ../_namespace.yaml
- ../../../values/env/{{.Environment.Name}}/values.yaml
- _app_group.yaml

---
templates:
{{ tpl ( readFile "./../../../templates/templates.yaml") . }}

releases:
- name: {{.Values.app}}
<<: *base-local
chart: incubator/raw
version: 0.2.3
values:
- templates:
- |
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: {{.Values.appGroup}}-{{.Values.app}}
namespace: {{.Values.namespace}}
spec:
serviceAccountName: {{.Values.namespaceDeployServiceAccount}}
fetch:
- image:
url: arttii/dummydeploy
# secretRef:
# name: {{.Values.dockerSecret}}
subPath: {{.Values.appGroup}}/test
template:
- ytt:
ignoreUnknownComments: true
strict: false
deploy:
- kapp:
rawOptions: ["--dangerous-override-ownership-of-existing-resources=true","--apply-concurrency=10"]
delete:
rawOptions: ["--apply-ignored=true"]