diff --git a/crafty/argocd.yaml b/crafty/argocd.yaml new file mode 100644 index 0000000..597d9fc --- /dev/null +++ b/crafty/argocd.yaml @@ -0,0 +1,31 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: crafty + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + sources: + - repoURL: https://github.com/Mayne0213/applications.git + targetRevision: main + path: crafty + destination: + server: https://kubernetes.default.svc + namespace: crafty + syncPolicy: + automated: + prune: true + selfHeal: true + retry: + limit: 5 + backoff: + duration: 5s + factor: 2 + maxDuration: 3m + managedNamespaceMetadata: + labels: + goldilocks.fairwinds.com/enabled: 'true' + syncOptions: + - CreateNamespace=true diff --git a/crafty/deployment.yaml b/crafty/deployment.yaml new file mode 100644 index 0000000..59ee474 --- /dev/null +++ b/crafty/deployment.yaml @@ -0,0 +1,70 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: crafty + namespace: crafty + labels: + app: crafty +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: crafty + template: + metadata: + labels: + app: crafty + spec: + containers: + - name: crafty + image: registry.gitlab.com/crafty-controller/crafty-4:latest + env: + - name: TZ + value: Asia/Seoul + ports: + - name: https + containerPort: 8443 + protocol: TCP + - name: dynmap + containerPort: 8123 + protocol: TCP + - name: bedrock + containerPort: 19132 + protocol: UDP + resources: + requests: + memory: "512Mi" + cpu: "250m" + limits: + memory: "2Gi" + volumeMounts: + - name: backups + mountPath: /crafty/backups + - name: logs + mountPath: /crafty/logs + - name: servers + mountPath: /crafty/servers + - name: config + mountPath: /crafty/app/config + - name: import + mountPath: /crafty/import + securityContext: + allowPrivilegeEscalation: false + volumes: + - name: backups + persistentVolumeClaim: + claimName: crafty-backups + - name: logs + persistentVolumeClaim: + claimName: crafty-logs + - name: servers + persistentVolumeClaim: + claimName: crafty-servers + - name: config + persistentVolumeClaim: + claimName: crafty-config + - name: import + persistentVolumeClaim: + claimName: crafty-import diff --git a/crafty/ingress.yaml b/crafty/ingress.yaml new file mode 100644 index 0000000..889a639 --- /dev/null +++ b/crafty/ingress.yaml @@ -0,0 +1,25 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: crafty-ingress + namespace: crafty + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + traefik.ingress.kubernetes.io/router.tls: "true" +spec: + ingressClassName: traefik + tls: + - hosts: + - crafty0213.kro.kr + secretName: crafty-tls + rules: + - host: crafty0213.kro.kr + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: crafty + port: + number: 8443 diff --git a/crafty/kustomization.yaml b/crafty/kustomization.yaml new file mode 100644 index 0000000..162d985 --- /dev/null +++ b/crafty/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - pvc.yaml + - deployment.yaml + - service.yaml + - ingress.yaml diff --git a/crafty/pvc.yaml b/crafty/pvc.yaml new file mode 100644 index 0000000..0522014 --- /dev/null +++ b/crafty/pvc.yaml @@ -0,0 +1,64 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: crafty-backups + namespace: crafty +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 10Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: crafty-logs + namespace: crafty +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: crafty-servers + namespace: crafty +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 20Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: crafty-config + namespace: crafty +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: crafty-import + namespace: crafty +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 5Gi diff --git a/crafty/service.yaml b/crafty/service.yaml new file mode 100644 index 0000000..0503be6 --- /dev/null +++ b/crafty/service.yaml @@ -0,0 +1,57 @@ +apiVersion: v1 +kind: Service +metadata: + name: crafty + namespace: crafty + labels: + app: crafty +spec: + type: ClusterIP + selector: + app: crafty + ports: + - name: https + port: 8443 + targetPort: 8443 + protocol: TCP + - name: dynmap + port: 8123 + targetPort: 8123 + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + name: crafty-minecraft + namespace: crafty + labels: + app: crafty +spec: + type: LoadBalancer + selector: + app: crafty + ports: + - name: bedrock + port: 19132 + targetPort: 19132 + protocol: UDP + - name: minecraft-1 + port: 25565 + targetPort: 25565 + protocol: TCP + - name: minecraft-2 + port: 25566 + targetPort: 25566 + protocol: TCP + - name: minecraft-3 + port: 25567 + targetPort: 25567 + protocol: TCP + - name: minecraft-4 + port: 25568 + targetPort: 25568 + protocol: TCP + - name: minecraft-5 + port: 25569 + targetPort: 25569 + protocol: TCP