Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(playit): implementation #4445

Merged
merged 3 commits into from
Feb 1, 2025
Merged

feat(playit): implementation #4445

merged 3 commits into from
Feb 1, 2025

Conversation

tyriis
Copy link
Owner

@tyriis tyriis commented Feb 1, 2025

No description provided.

@tyriis-automation
Copy link
Contributor

tyriis-automation bot commented Feb 1, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 7 0 0.03s
✅ REPOSITORY gitleaks yes no 3.13s
✅ YAML prettier 7 0 0.42s
✅ YAML yamllint 7 0 0.42s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

sonarqubecloud bot commented Feb 1, 2025

@tyriis-automation
Copy link
Contributor

--- HelmRelease: gaming-public/minecraft-public-velocity-proxy Deployment: gaming-public/minecraft-public-velocity-proxy

+++ HelmRelease: gaming-public/minecraft-public-velocity-proxy Deployment: gaming-public/minecraft-public-velocity-proxy

@@ -23,12 +23,13 @@

   template:
     metadata:
       labels:
         app.kubernetes.io/component: velocity
         app.kubernetes.io/instance: minecraft-public-velocity-proxy
         app.kubernetes.io/name: minecraft-public-velocity-proxy
+        ingress.home.arpa/playit: allow
     spec:
       enableServiceLinks: false
       serviceAccountName: default
       automountServiceAccountToken: true
       securityContext:
         fsGroup: 1000
--- HelmRelease: networking/playit Deployment: networking/playit

+++ HelmRelease: networking/playit Deployment: networking/playit

@@ -0,0 +1,73 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: playit
+  labels:
+    app.kubernetes.io/component: plait
+    app.kubernetes.io/instance: playit
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: playit
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: plait
+      app.kubernetes.io/name: playit
+      app.kubernetes.io/instance: playit
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: plait
+        app.kubernetes.io/instance: playit
+        app.kubernetes.io/name: playit
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: false
+      securityContext:
+        fsGroup: 65534
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 65534
+        runAsNonRoot: true
+        runAsUser: 65534
+        seccompProfile:
+          type: RuntimeDefault
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      containers:
+      - env:
+        - name: TZ
+          value: Europe/Vienna
+        image: ghcr.io/playit-cloud/playit-agent:0.15.26@sha256:3d08eb4a627a6d167f3cce497d8e2ec8f9e7d2df4e96f0599ca41e4b957c852c
+        name: playit
+        ports:
+        - containerPort: 8080
+          name: http
+          protocol: TCP
+        resources:
+          requests:
+            cpu: 10m
+            memory: 150Mi
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        volumeMounts:
+        - mountPath: /config/playit.toml
+          name: playit-toml
+          subPath: playit.toml
+      volumes:
+      - name: playit-toml
+        secret:
+          secretName: playit
+

@tyriis-automation
Copy link
Contributor

--- kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/playit

+++ kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/playit

@@ -0,0 +1,36 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: apps-sync
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+    substitution.flux.home.arpa/enabled: 'true'
+  name: playit
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: playit
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  dependsOn:
+  - name: apps-external-secrets-stores
+  interval: 30m
+  path: ./kubernetes/talos-flux/apps/networking/playit/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: home-ops
+  targetNamespace: networking
+  timeout: 5m
+  wait: true
+
--- kubernetes/talos-flux/apps/gaming-public/minecraft-java/velocity-proxy Kustomization: flux-system/minecraft-public-velocity-proxy HelmRelease: gaming-public/minecraft-public-velocity-proxy

+++ kubernetes/talos-flux/apps/gaming-public/minecraft-java/velocity-proxy Kustomization: flux-system/minecraft-public-velocity-proxy HelmRelease: gaming-public/minecraft-public-velocity-proxy

@@ -83,12 +83,14 @@

               allowPrivilegeEscalation: false
               capabilities:
                 drop:
                 - ALL
               readOnlyRootFilesystem: true
         pod:
+          labels:
+            ingress.home.arpa/playit: allow
           securityContext:
             fsGroup: 1000
             runAsGroup: 1000
             runAsNonRoot: true
             runAsUser: 1000
             seccompProfile:
--- kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit ExternalSecret: networking/playit

+++ kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit ExternalSecret: networking/playit

@@ -0,0 +1,34 @@

+---
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  labels:
+    app.kubernetes.io/name: playit
+    kustomize.toolkit.fluxcd.io/name: playit
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: playit
+  namespace: networking
+spec:
+  dataFrom:
+  - extract:
+      key: infra/techtales/network/playit
+  refreshInterval: 1m
+  secretStoreRef:
+    kind: ClusterSecretStore
+    name: vault-backend
+  target:
+    creationPolicy: Owner
+    name: playit
+    template:
+      data:
+        playit.toml: |
+          api_url = "https://api.playit.cloud/agent"
+          ping_target_addresses = []
+          control_address = "control.playit.gg"
+          refresh_from_api = true
+          api_refresh_rate = 5000
+          ping_interval = 5000
+          secret_key = "{{ .PLAYIT_SECRET_KEY }}"
+          mappings = []
+      engineVersion: v2
+
--- kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit CiliumNetworkPolicy: networking/playit

+++ kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit CiliumNetworkPolicy: networking/playit

@@ -0,0 +1,24 @@

+---
+apiVersion: cilium.io/v2
+kind: CiliumNetworkPolicy
+metadata:
+  labels:
+    app.kubernetes.io/name: playit
+    kustomize.toolkit.fluxcd.io/name: playit
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: playit
+  namespace: networking
+spec:
+  egress:
+  - toEntities:
+    - world
+  - toEndpoints:
+    - matchExpressions:
+      - key: io.kubernetes.pod.namespace
+        operator: Exists
+      matchLabels:
+        ingress.home.arpa/playit: allow
+  endpointSelector:
+    matchLabels:
+      app.kubernetes.io/name: playit
+
--- kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit CiliumClusterwideNetworkPolicy: networking/playit-to-app

+++ kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit CiliumClusterwideNetworkPolicy: networking/playit-to-app

@@ -0,0 +1,19 @@

+---
+apiVersion: cilium.io/v2
+kind: CiliumClusterwideNetworkPolicy
+metadata:
+  labels:
+    app.kubernetes.io/name: playit
+    kustomize.toolkit.fluxcd.io/name: playit
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: playit-to-app
+  namespace: networking
+spec:
+  endpointSelector:
+    matchLabels:
+      ingress.home.arpa/playit: allow
+  ingress:
+  - fromEndpoints:
+    - matchLabels:
+        app.kubernetes.io/name: playit
+
--- kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit HelmRelease: networking/playit

+++ kubernetes/talos-flux/apps/networking/playit/app Kustomization: flux-system/playit HelmRelease: networking/playit

@@ -0,0 +1,84 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: playit
+    kustomize.toolkit.fluxcd.io/name: playit
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: playit
+  namespace: networking
+spec:
+  chart:
+    spec:
+      chart: app-template
+      interval: 15m
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s-charts
+        namespace: flux-system
+      version: 3.6.1
+  install:
+    createNamespace: false
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    controllers:
+      plait:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            env:
+              TZ: Europe/Vienna
+            image:
+              repository: ghcr.io/playit-cloud/playit-agent
+              tag: 0.15.26@sha256:3d08eb4a627a6d167f3cce497d8e2ec8f9e7d2df4e96f0599ca41e4b957c852c
+            nameOverride: playit
+            ports:
+            - containerPort: 8080
+              name: http
+              protocol: TCP
+            probes:
+              liveness:
+                enabled: false
+              readiness:
+                enabled: false
+              startup:
+                enabled: false
+            resources:
+              requests:
+                cpu: 10m
+                memory: 150Mi
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+        replicas: 1
+    defaultPodOptions:
+      automountServiceAccountToken: false
+      securityContext:
+        fsGroup: 65534
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 65534
+        runAsNonRoot: true
+        runAsUser: 65534
+        seccompProfile:
+          type: RuntimeDefault
+    persistence:
+      playit-toml:
+        globalMounts:
+        - path: /config/playit.toml
+          readOnly: false
+          subPath: playit.toml
+        name: playit
+        type: secret
+

@tyriis tyriis merged commit 246cd05 into main Feb 1, 2025
16 checks passed
@tyriis tyriis deleted the feature/playit branch February 1, 2025 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant