feat(example): add factorio image example
Build and Push Docker Image / Build image (push) Successful in 1m47s

This commit is contained in:
2026-06-28 19:24:51 +03:00
parent 04ad3616c9
commit 19f8e325c1
3 changed files with 33 additions and 7 deletions
+24
View File
@@ -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"
+2 -2
View File
@@ -1,7 +1,7 @@
package controller
type SourceConfig struct {
DefaultEnabled bool `yaml:"DefaultEnabled"`
DefaultEnabled bool `yaml:"defaultEnabled"`
}
type SourceDefinition struct {
@@ -17,7 +17,7 @@ type ServerConfig struct {
type AuthPasswordMethodConfig struct {
Enabled bool `yaml:"enabled"`
MinLength bool `yaml:"minLength"`
MinLength int `yaml:"minLength"`
}
type AuthProxyMethodConfig struct {
@@ -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,6 +538,7 @@ 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{
{
@@ -564,15 +568,13 @@ func (r *ServerManagerReconciler) BrowserConfigMap(s *servermanagerv1alpha1.Serv
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
}