feat(example): add factorio image example
Build and Push Docker Image / Build image (push) Successful in 1m50s
Build and Push Docker Image / Build image (push) Successful in 1m50s
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
apiVersion: server-manager.acooldomain.co/v1alpha1
|
||||
kind: Image
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: kubernetes-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: minecraft-paper-1-21-5
|
||||
spec:
|
||||
location: git.acooldomain.co/server-manager/minecraft:paper-1.21.5
|
||||
name: minecraft
|
||||
tag: paper-1.21.5
|
||||
working_dir: /opt/server
|
||||
ports:
|
||||
- port: 25565
|
||||
protocol: TCP
|
||||
|
||||
init_script:
|
||||
image: alpine:latest
|
||||
command:
|
||||
- /bin/sh
|
||||
args:
|
||||
- /bin/sh
|
||||
- "-c"
|
||||
- "echo eula=true >> /data/eula.txt"
|
||||
@@ -1,7 +1,13 @@
|
||||
package controller
|
||||
|
||||
type SourceRule struct {
|
||||
FolderPath string `yaml:"folderPath"`
|
||||
Viewable bool `yaml:"viewable"`
|
||||
}
|
||||
|
||||
type SourceConfig struct {
|
||||
DefaultEnabled bool `yaml:"DefaultEnabled"`
|
||||
DefaultEnabled bool `yaml:"defaultEnabled"`
|
||||
Rules []SourceRule `yaml:"rules"`
|
||||
}
|
||||
|
||||
type SourceDefinition struct {
|
||||
@@ -15,9 +21,22 @@ type ServerConfig struct {
|
||||
Sources []SourceDefinition `yaml:"sources"`
|
||||
}
|
||||
|
||||
type UserDefaultPermissionConfig struct {
|
||||
Modify bool `yaml:"modify"`
|
||||
Share bool `yaml:"share"`
|
||||
Realtime bool `yaml:"realtime"`
|
||||
Create bool `yaml:"create"`
|
||||
Delete bool `yaml:"delete"`
|
||||
Api bool `yaml:"api"`
|
||||
}
|
||||
|
||||
type UserDefaultsConfig struct {
|
||||
Permissions UserDefaultPermissionConfig `yaml:"permissions"`
|
||||
}
|
||||
|
||||
type AuthPasswordMethodConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
MinLength bool `yaml:"minLength"`
|
||||
MinLength int `yaml:"minLength"`
|
||||
}
|
||||
|
||||
type AuthProxyMethodConfig struct {
|
||||
@@ -40,7 +59,8 @@ type FrontendConfig struct {
|
||||
}
|
||||
|
||||
type FileBrowserConfig struct {
|
||||
Server ServerConfig `yaml:"server"`
|
||||
Auth AuthConfig `yaml:"auth"`
|
||||
Frontend FrontendConfig `yaml:"frontend"`
|
||||
Server ServerConfig `yaml:"server"`
|
||||
Auth AuthConfig `yaml:"auth"`
|
||||
Frontend FrontendConfig `yaml:"frontend"`
|
||||
UserDefaults UserDefaultsConfig `yaml:"userDefaults"`
|
||||
}
|
||||
|
||||
@@ -302,13 +302,16 @@ func (r *ServerManagerReconciler) Reconcile(ctx context.Context, req ctrl.Reques
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
var foundBrowserConfigMap *corev1.ConfigMap
|
||||
logging.Info("created browser configmap")
|
||||
var foundBrowserConfigMap corev1.ConfigMap
|
||||
|
||||
err = r.Get(ctx, client.ObjectKeyFromObject(browserConfigMap), foundBrowserConfigMap)
|
||||
err = r.Get(ctx, client.ObjectKeyFromObject(browserConfigMap), &foundBrowserConfigMap)
|
||||
if err != nil {
|
||||
logging.Info("Failed getting browser configmap", "err", err)
|
||||
err = r.Create(ctx, browserConfigMap)
|
||||
return ctrl.Result{Requeue: true}, err
|
||||
}
|
||||
logging.Info("verified browser config map")
|
||||
|
||||
browserPod := r.BrowserPod(s, pvc, browserPvc, browserConfigMap)
|
||||
foundBrowser := &corev1.Pod{}
|
||||
@@ -535,11 +538,20 @@ func (r *ServerManagerReconciler) BrowserService(s *servermanagerv1alpha1.Server
|
||||
func (r *ServerManagerReconciler) BrowserConfigMap(s *servermanagerv1alpha1.ServerManager) (*corev1.ConfigMap, error) {
|
||||
serializedConfig, err := yaml.Marshal(FileBrowserConfig{
|
||||
Server: ServerConfig{
|
||||
Port: 80,
|
||||
BaseUrl: r.GenerateBrowserSubPath(s),
|
||||
Sources: []SourceDefinition{
|
||||
{
|
||||
Path: "/tmp/data",
|
||||
Config: SourceConfig{DefaultEnabled: true},
|
||||
Path: "/tmp/data",
|
||||
Config: SourceConfig{
|
||||
DefaultEnabled: true,
|
||||
Rules: []SourceRule{
|
||||
{
|
||||
FolderPath: "lost+found",
|
||||
Viewable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -551,28 +563,36 @@ func (r *ServerManagerReconciler) BrowserConfigMap(s *servermanagerv1alpha1.Serv
|
||||
},
|
||||
Proxy: AuthProxyMethodConfig{
|
||||
Enabled: true,
|
||||
Header: "X-Forwarded-User",
|
||||
Header: r.Config.Browser.AuthHeader,
|
||||
},
|
||||
},
|
||||
},
|
||||
Frontend: FrontendConfig{
|
||||
Name: "ACoolFileBrowser",
|
||||
},
|
||||
UserDefaults: UserDefaultsConfig{
|
||||
Permissions: UserDefaultPermissionConfig{
|
||||
Modify: true,
|
||||
Create: true,
|
||||
Delete: true,
|
||||
Api: true,
|
||||
Share: true,
|
||||
Realtime: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var configMapData map[string]string
|
||||
configMapData["config.yaml"] = string(serializedConfig)
|
||||
return &corev1.ConfigMap{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%s-browser-config", s.Name),
|
||||
Namespace: s.Namespace,
|
||||
Labels: map[string]string{"browser": s.Name},
|
||||
},
|
||||
Data: configMapData,
|
||||
Data: map[string]string{"config.yaml": string(serializedConfig)},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user