Remove Factorio direct deploy bootstrap
Validate, publish and promote Factorio chart / chart (push) Successful in 16s

This commit is contained in:
feedc0de committed 2026-10-27 07:36:00 +01:00
1 parent 9383c6fb58
commit a1f107e1fe
4 files changed
-193

No files matched your search

-133
View File
@@ -1,133 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: factorio-deployer
namespace: factorio
automountServiceAccountToken: false
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: factorio-deployer
namespace: factorio
rules:
- apiGroups:
- apps
resources:
- deployments
resourceNames:
- factorio
verbs:
- get
- patch
- update
- watch
- apiGroups:
- ''
resources:
- services
resourceNames:
- factorio
- factorio-metrics
verbs:
- get
- patch
- update
- watch
- apiGroups:
- ''
resources:
- configmaps
resourceNames:
- factorio-scripts
- factorio-settings
verbs:
- get
- patch
- update
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
resourceNames:
- factorio
verbs:
- get
- patch
- update
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- prometheusrules
resourceNames:
- factorio
verbs:
- get
- patch
- update
- watch
- apiGroups:
- ''
resources:
- pods
- events
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: factorio-deployer
namespace: factorio
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: factorio-deployer
subjects:
- kind: ServiceAccount
name: factorio-deployer
namespace: factorio
---
apiVersion: v1
kind: Secret
metadata:
name: factorio-deployer-token
namespace: factorio
annotations:
kubernetes.io/service-account.name: factorio-deployer
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: factorio-dashboard-deployer
namespace: default
rules:
- apiGroups:
- ''
resources:
- configmaps
resourceNames:
- factorio-dashboard
verbs:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: factorio-dashboard-deployer
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: factorio-dashboard-deployer
subjects:
- kind: ServiceAccount
name: factorio-deployer
namespace: factorio
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
[[ $(kubectl config current-context) == kubernetes-admin@kubernetes ]] || { echo 'Wrong Kubernetes context' >&2; exit 1; }
python3 - <<'PY'
import base64,json,subprocess
get=lambda *args: json.loads(subprocess.check_output(['kubectl',*args]))
cluster=get('config','view','--minify','-o','json')['clusters'][0]['cluster']
secret=get('-n','factorio','get','secret','factorio-deployer-token','-o','json')['data']
config={'apiVersion':'v1','kind':'Config','clusters':[{'name':'cluster','cluster':{'server':cluster['server'],'certificate-authority-data':secret['ca.crt']}}], 'users':[{'name':'factorio-deployer','user':{'token':base64.b64decode(secret['token']).decode()}}], 'contexts':[{'name':'factorio-ci','context':{'cluster':'cluster','user':'factorio-deployer','namespace':'factorio'}}], 'current-context':'factorio-ci'}
print(base64.b64encode(json.dumps(config).encode()).decode())
PY
-30
View File
@@ -1,30 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: factorio
resources:
- factorio.yaml
- monitoring.yaml
configMapGenerator:
- name: factorio-scripts
files:
- scripts/start.sh
- scripts/health.sh
- scripts/collect.sh
- scripts/collector-health.sh
- name: factorio-settings
files:
- server-settings.json
- server-adminlist.json
generatorOptions:
disableNameSuffixHash: true
replacements:
- source:
kind: Deployment
name: factorio
fieldPath: spec.template.spec.containers.[name=factorio].image
targets:
- select:
kind: Deployment
name: factorio
fieldPaths:
- spec.template.spec.containers.[name=player-collector].image
-19
View File
@@ -1,19 +0,0 @@
"""Roll the server when mounted configuration changes."""
import hashlib
import json
import sys
from pathlib import Path
import yaml
docs = list(yaml.safe_load_all(Path(sys.argv[1]).read_text()))
config = {d['metadata']['name']: d.get('data', {}) for d in docs if d['kind'] == 'ConfigMap' and d['metadata']['namespace'] == 'factorio'}
checksum = hashlib.sha256(json.dumps(config, sort_keys=True).encode()).hexdigest()
for doc in docs:
if doc['kind'] == 'Deployment' and doc['metadata']['name'] == 'factorio':
template = doc['spec']['template']
template['metadata'].setdefault('annotations', {})['factorio.brunner.ninja/config-revision'] = checksum
# The fresh PVC is an administrator bootstrap resource. CI never owns storage.
if doc['kind'] == 'PersistentVolumeClaim':
continue
print('---')
print(yaml.safe_dump(doc, sort_keys=False), end='')