Fix ingress
This commit is contained in:
@@ -17,7 +17,7 @@ var serviceWaiters = make(map[string][]chan int)
|
|||||||
var locker = &sync.Mutex{}
|
var locker = &sync.Mutex{}
|
||||||
var serviceTick = make(chan int, 0)
|
var serviceTick = make(chan int, 0)
|
||||||
|
|
||||||
var Ingresses = make([]*helm.Ingress, 0)
|
var Ingresses = make(map[string]*helm.Ingress, 0)
|
||||||
var Values = make(map[string]map[string]interface{})
|
var Values = make(map[string]map[string]interface{})
|
||||||
|
|
||||||
var DependScript = `
|
var DependScript = `
|
||||||
@@ -168,7 +168,7 @@ func createIngress(name string, port int, s compose.Service) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locker.Lock()
|
locker.Lock()
|
||||||
Ingresses = append(Ingresses, ingress)
|
Ingresses[name] = ingress
|
||||||
locker.Unlock()
|
locker.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package helm
|
package helm
|
||||||
|
|
||||||
type Ingress struct {
|
type Ingress struct {
|
||||||
*K8sBase
|
*K8sBase `yaml:",inline"`
|
||||||
Spec IngressSpec
|
Spec IngressSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIngress(name string) *Ingress {
|
func NewIngress(name string) *Ingress {
|
||||||
|
11
main.go
11
main.go
@@ -2,12 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"helm-compose/compose"
|
"helm-compose/compose"
|
||||||
"helm-compose/generator"
|
"helm-compose/generator"
|
||||||
"helm-compose/helm"
|
"helm-compose/helm"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -45,6 +45,7 @@ func main() {
|
|||||||
for n, f := range files {
|
for n, f := range files {
|
||||||
for _, c := range f {
|
for _, c := range f {
|
||||||
kind := c.(helm.Kinded).Get()
|
kind := c.(helm.Kinded).Get()
|
||||||
|
kind = strings.ToLower(kind)
|
||||||
fname := filepath.Join(templatesDir, n+"."+kind+".yaml")
|
fname := filepath.Join(templatesDir, n+"."+kind+".yaml")
|
||||||
fp, _ := os.Create(fname)
|
fp, _ := os.Create(fname)
|
||||||
enc := yaml.NewEncoder(fp)
|
enc := yaml.NewEncoder(fp)
|
||||||
@@ -54,12 +55,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ing := range generator.Ingresses {
|
for name, ing := range generator.Ingresses {
|
||||||
|
|
||||||
fmt.Println("---")
|
fname := filepath.Join(templatesDir, name+".ingress.yaml")
|
||||||
enc := yaml.NewEncoder(os.Stdout)
|
fp, _ := os.Create(fname)
|
||||||
|
enc := yaml.NewEncoder(fp)
|
||||||
enc.SetIndent(2)
|
enc.SetIndent(2)
|
||||||
enc.Encode(ing)
|
enc.Encode(ing)
|
||||||
|
fp.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
enc := yaml.NewEncoder(os.Stdout)
|
enc := yaml.NewEncoder(os.Stdout)
|
||||||
|
Reference in New Issue
Block a user