Compare commits

...

2 Commits

Author SHA1 Message Date
af626f35c4 resolve symlink 2020-11-21 12:36:08 +01:00
9919c261f1 add example deployment 2020-11-21 12:24:30 +01:00
4 changed files with 70 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea .idea
config.yml config.yml
config.sm.yaml

4
config.example.yml Normal file
View File

@ -0,0 +1,4 @@
modules:
- import: go.adphi.net/go-repo
repository: git.adphi.net/adphi/go-repo
readme: git.adphi.net/adphi/go-repo/raw/master/README.md

58
deploy/deploy.yml Normal file
View File

@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-repo
labels:
app: go-repo
spec:
replicas: 1
template:
metadata:
name: go-repo
labels:
app: go-repo
spec:
containers:
- name: go-repo
args:
- /config/config.yml
image: adphi/go-repo
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8888
volumeMounts:
- mountPath: /config
name: config
restartPolicy: Always
volumes:
- name: config
configMap:
name: go-repo
selector:
matchLabels:
app: go-repo
---
apiVersion: v1
kind: ConfigMap
metadata:
name: go-repo
data:
config.yml: |
modules:
- import: go.adphi.net/go-repo
repository: git.adphi.net/adphi/go-repo
readme: git.adphi.net/adphi/go-repo/raw/master/README.md
---
apiVersion: v1
kind: Service
metadata:
name: go-repo
spec:
selector:
app: go-repo
ports:
- port: 80
targetPort: 8888
type: LoadBalancer

View File

@ -2,6 +2,7 @@ package main
import ( import (
"net/http" "net/http"
"path/filepath"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -24,7 +25,11 @@ func main() {
if l, err := logrus.ParseLevel(level); err == nil { if l, err := logrus.ParseLevel(level); err == nil {
logrus.SetLevel(l) logrus.SetLevel(l)
} }
mods, err := NewModules(args[0]) path := args[0]
if s, err := filepath.EvalSymlinks(path); err == nil {
path = s
}
mods, err := NewModules(path)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
@ -69,7 +74,7 @@ func main() {
} }
} }
}() }()
if err := watcher.Add(args[0]); err != nil { if err := watcher.Add(path); err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
go func() { go func() {