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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spec:
annotations:
reloader.stakater.com/auto: "true"
pod:
labels:
ingress.home.arpa/playit: allow
securityContext:
fsGroup: 1000
runAsGroup: 1000
Expand Down
1 change: 1 addition & 0 deletions kubernetes/talos-flux/apps/networking/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ resources:
- ./adguard-home/flux-sync.yaml
- ./cloudflared/flux-sync.yaml
- ./external-dns/flux-sync.yaml
- ./playit/flux-sync.yaml
- ./redirect-service/flux-sync.yaml
- ./unifi/flux-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/externalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: &name playit
spec:
refreshInterval: 1m
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
target:
name: *name
creationPolicy: Owner
template:
engineVersion: v2
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 = []
dataFrom:
- extract:
key: infra/techtales/network/playit
80 changes: 80 additions & 0 deletions kubernetes/talos-flux/apps/networking/playit/app/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: &app playit
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.6.1
sourceRef:
kind: HelmRepository
name: bjw-s-charts
namespace: flux-system
interval: 15m
install:
createNamespace: false
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
defaultPodOptions:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
fsGroup: 65534
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault

controllers:
plait:
replicas: 1
annotations:
reloader.stakater.com/auto: "true"
containers:
app:
nameOverride: *app
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
env:
TZ: ${SETTING_TZ}
image:
repository: ghcr.io/playit-cloud/playit-agent
tag: 0.15.26@sha256:3d08eb4a627a6d167f3cce497d8e2ec8f9e7d2df4e96f0599ca41e4b957c852c
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
cpu: 10m
memory: 150Mi
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false

persistence:
playit-toml:
type: secret
name: playit
globalMounts:
- path: /config/playit.toml
subPath: playit.toml
readOnly: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: home-automation
resources:
- external-secret.yaml
- networkpolicy.yaml
- helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/cilium.io/ciliumnetworkpolicy_v2.json
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: playit
spec:
endpointSelector:
matchLabels:
app.kubernetes.io/name: playit

egress:
- toEntities:
- world # TODO: get concrete info on what ports are required
- toEndpoints:
- matchLabels:
ingress.home.arpa/playit: allow
matchExpressions:
- key: io.kubernetes.pod.namespace
operator: Exists # any namespace

# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/cilium.io/ciliumnetworkpolicy_v2.json
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: playit-to-app
spec:
endpointSelector:
matchLabels:
ingress.home.arpa/playit: allow

ingress:
- fromEndpoints:
- matchLabels:
app.kubernetes.io/name: playit
24 changes: 24 additions & 0 deletions kubernetes/talos-flux/apps/networking/playit/flux-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &appname playit
namespace: flux-system
labels:
substitution.flux.home.arpa/enabled: "true"
spec:
targetNamespace: networking
commonMetadata:
labels:
app.kubernetes.io/name: *appname
interval: 30m
path: ./kubernetes/talos-flux/apps/networking/playit/app
prune: true
sourceRef:
kind: GitRepository
name: home-ops
wait: true
timeout: 5m
dependsOn:
- name: apps-external-secrets-stores