Compare commits
12 Commits
claude/git
...
60f5f8e6f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60f5f8e6f0 | ||
| b8c7e59005 | |||
| 65ac8d6f01 | |||
| 35844e0dbd | |||
| b1e307151e | |||
| 12b07219c7 | |||
| 9fd32c4415 | |||
| ad670fb344 | |||
|
|
6f6ca50987 | ||
|
|
c7be58c1f7 | ||
|
|
a1f5a393cd | ||
|
|
710340d8be |
26
apps/fc-devicemgmt/1password-item.yaml
Normal file
26
apps/fc-devicemgmt/1password-item.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Runtime secrets for FlowerCore.DeviceManagement.
|
||||||
|
#
|
||||||
|
# OnePasswordItem operator syncs this item into a Kubernetes Secret with the
|
||||||
|
# same name. Expected fields:
|
||||||
|
# DB-Password
|
||||||
|
# mtls-ca.pem
|
||||||
|
# mtls-client.crt
|
||||||
|
# mtls-client.key
|
||||||
|
# mtls-chain.pem
|
||||||
|
#
|
||||||
|
# Do not add literal secret values to this repo. Runtime pods consume the
|
||||||
|
# synced Secret through env vars and read-only mounts.
|
||||||
|
apiVersion: onepassword.com/v1
|
||||||
|
kind: OnePasswordItem
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-runtime
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt
|
||||||
|
app.kubernetes.io/component: secrets
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
itemPath: "vaults/IAmWorkin/items/FlowerCore DeviceManagement Runtime"
|
||||||
33
apps/fc-devicemgmt/argocd-application.yaml
Normal file
33
apps/fc-devicemgmt/argocd-application.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Explicit ArgoCD Application shape for bootstrap/review.
|
||||||
|
#
|
||||||
|
# The live bluejay-infra ApplicationSet already discovers apps/* directories
|
||||||
|
# and creates this same Application name (`infra-fc-devicemgmt`) automatically.
|
||||||
|
# Keep repoURL on the internal Gitea ClusterIP URL; ArgoCD does not trust the
|
||||||
|
# external step-ca HTTPS endpoint.
|
||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: infra-fc-devicemgmt
|
||||||
|
namespace: argocd
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: http://gitea-clusterip.gitea.svc.cluster.local:3000/bluejay/bluejay-infra.git
|
||||||
|
targetRevision: main
|
||||||
|
path: apps/fc-devicemgmt
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
|
- ServerSideApply=true
|
||||||
30
apps/fc-devicemgmt/certificate-web.yaml
Normal file
30
apps/fc-devicemgmt/certificate-web.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Certificate for devices.iamworkin.lan.
|
||||||
|
#
|
||||||
|
# Preflight gate: FlowerCore.DNS / pfSense must contain an explicit A record:
|
||||||
|
# devices.iamworkin.lan -> 10.0.56.200
|
||||||
|
# before this Certificate is synced. step-ca ACME cannot see the CoreDNS
|
||||||
|
# wildcard, so missing pfSense DNS produces cert-manager HTTP-01 backoff
|
||||||
|
# (feedback_pfsense_dns_required_for_acme).
|
||||||
|
apiVersion: cert-manager.io/v1
|
||||||
|
kind: Certificate
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-web-tls
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
annotations:
|
||||||
|
flowercore.io/dns-preflight: "devices.iamworkin.lan must resolve to 10.0.56.200 before ACME sync"
|
||||||
|
spec:
|
||||||
|
secretName: fc-devicemgmt-web-tls
|
||||||
|
issuerRef:
|
||||||
|
name: step-ca-acme
|
||||||
|
kind: ClusterIssuer
|
||||||
|
dnsNames:
|
||||||
|
- devices.iamworkin.lan
|
||||||
|
duration: 720h
|
||||||
|
renewBefore: 240h
|
||||||
81
apps/fc-devicemgmt/clusterrole-operator.yaml
Normal file
81
apps/fc-devicemgmt/clusterrole-operator.yaml
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- devices.flowercore.io
|
||||||
|
resources:
|
||||||
|
- '*'
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- create
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- devices.flowercore.io
|
||||||
|
resources:
|
||||||
|
- devices/status
|
||||||
|
- devices/finalizers
|
||||||
|
- devicegroups/status
|
||||||
|
- devicegroups/finalizers
|
||||||
|
- devicepolicies/status
|
||||||
|
- devicepolicies/finalizers
|
||||||
|
- remotecommands/status
|
||||||
|
- remotecommands/finalizers
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- apps
|
||||||
|
resources:
|
||||||
|
- deployments
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- pods
|
||||||
|
- services
|
||||||
|
- configmaps
|
||||||
|
- secrets
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- create
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- batch
|
||||||
|
resources:
|
||||||
|
- jobs
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- create
|
||||||
|
- update
|
||||||
|
- patch
|
||||||
|
- delete
|
||||||
|
- apiGroups:
|
||||||
|
- networking.k8s.io
|
||||||
|
resources:
|
||||||
|
- networkpolicies
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
19
apps/fc-devicemgmt/clusterrolebinding-operator.yaml
Normal file
19
apps/fc-devicemgmt/clusterrolebinding-operator.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
namespace: fc-devicemgmt
|
||||||
109
apps/fc-devicemgmt/deployment-operator.yaml
Normal file
109
apps/fc-devicemgmt/deployment-operator.yaml
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# FlowerCore.DeviceManagement Operator.
|
||||||
|
#
|
||||||
|
# KubeOps controller for devices.flowercore.io resources. Operator-created
|
||||||
|
# children must set OwnerReferences + traceability labels/annotations per
|
||||||
|
# k8s-pod-ownership-and-traceability-standard.md. RBAC below grants
|
||||||
|
# apps/deployments/get so the process can resolve its own Deployment UID.
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
annotations:
|
||||||
|
flowercore.io/traceability-standard: k8s-pod-ownership-and-traceability-standard
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: fc-devicemgmt-operator
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "8080"
|
||||||
|
prometheus.io/path: "/metrics"
|
||||||
|
flowercore.io/audit-trace-id: "runtime-activity-trace"
|
||||||
|
spec:
|
||||||
|
serviceAccountName: fc-devicemgmt-operator
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1654
|
||||||
|
fsGroupChangePolicy: OnRootMismatch
|
||||||
|
containers:
|
||||||
|
- name: operator
|
||||||
|
image: localhost/fc-devicemgmt-operator:v20260512-cx5
|
||||||
|
imagePullPolicy: Never
|
||||||
|
ports:
|
||||||
|
- name: metrics
|
||||||
|
containerPort: 8080
|
||||||
|
env:
|
||||||
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
|
value: "Production"
|
||||||
|
- name: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
|
||||||
|
value: "false"
|
||||||
|
- name: POD_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.name
|
||||||
|
- name: POD_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: FLOWERCORE_KUBERNETES_OWNER_DEPLOYMENT
|
||||||
|
value: "fc-devicemgmt-operator"
|
||||||
|
- name: FlowerCore__Service__Name
|
||||||
|
value: "FlowerCore.DeviceManagement.Operator"
|
||||||
|
- name: FlowerCore__DeviceManagement__DefaultTenantId
|
||||||
|
value: "system"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 10
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 20
|
||||||
|
periodSeconds: 30
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1654
|
||||||
|
runAsGroup: 1654
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: logs
|
||||||
|
mountPath: /app/logs
|
||||||
|
volumes:
|
||||||
|
- name: tmp
|
||||||
|
emptyDir: {}
|
||||||
|
- name: logs
|
||||||
|
emptyDir: {}
|
||||||
135
apps/fc-devicemgmt/deployment-web.yaml
Normal file
135
apps/fc-devicemgmt/deployment-web.yaml
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
# FlowerCore.DeviceManagement Web.
|
||||||
|
#
|
||||||
|
# Source repo is expected to ship FlowerCore.DeviceManagement.Web in a later
|
||||||
|
# Sprint 9+ lane. This manifest is static-valid without requiring the image to
|
||||||
|
# exist yet; import localhost/fc-devicemgmt-web:<tag> to all schedulable RKE2
|
||||||
|
# nodes before letting ArgoCD sync a live rollout.
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-web
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
annotations:
|
||||||
|
flowercore.io/traceability-standard: k8s-pod-ownership-and-traceability-standard
|
||||||
|
spec:
|
||||||
|
replicas: 2
|
||||||
|
revisionHistoryLimit: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: "8080"
|
||||||
|
prometheus.io/path: "/metrics"
|
||||||
|
flowercore.io/audit-trace-id: "runtime-activity-trace"
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1654
|
||||||
|
fsGroupChangePolicy: OnRootMismatch
|
||||||
|
containers:
|
||||||
|
- name: web
|
||||||
|
image: localhost/fc-devicemgmt-web:v20260512-cx5
|
||||||
|
imagePullPolicy: Never
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
env:
|
||||||
|
- name: ASPNETCORE_URLS
|
||||||
|
value: "http://+:8080"
|
||||||
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
|
value: "Production"
|
||||||
|
- name: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
|
||||||
|
value: "false"
|
||||||
|
- name: FlowerCore__Service__Name
|
||||||
|
value: "FlowerCore.DeviceManagement.Web"
|
||||||
|
- name: FlowerCore__DeviceManagement__DefaultTenantId
|
||||||
|
value: "system"
|
||||||
|
- name: FlowerCore__Database__Provider
|
||||||
|
value: "MySql"
|
||||||
|
- name: FlowerCore__Database__Host
|
||||||
|
value: "mysql.fc-mysql.svc"
|
||||||
|
- name: FlowerCore__Database__Database
|
||||||
|
value: "flowercore_devicemgmt"
|
||||||
|
- name: FlowerCore__Database__User
|
||||||
|
value: "fc_devicemgmt"
|
||||||
|
- name: FlowerCore__Database__Password
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: fc-devicemgmt-runtime
|
||||||
|
key: DB-Password
|
||||||
|
- name: FlowerCore__DeviceManagement__AgentMtls__CaPath
|
||||||
|
value: "/secrets/devicemgmt-mtls/mtls-ca.pem"
|
||||||
|
- name: FlowerCore__DeviceManagement__AgentMtls__ClientCertificatePath
|
||||||
|
value: "/secrets/devicemgmt-mtls/mtls-client.crt"
|
||||||
|
- name: FlowerCore__DeviceManagement__AgentMtls__ClientKeyPath
|
||||||
|
value: "/secrets/devicemgmt-mtls/mtls-client.key"
|
||||||
|
- name: FlowerCore__EventBus__Redis__Configuration
|
||||||
|
value: "redis.fc-redis.svc:6379"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 768Mi
|
||||||
|
startupProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
failureThreshold: 30
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
periodSeconds: 10
|
||||||
|
failureThreshold: 3
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 30
|
||||||
|
failureThreshold: 3
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1654
|
||||||
|
runAsGroup: 1654
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: logs
|
||||||
|
mountPath: /app/logs
|
||||||
|
- name: devicemgmt-mtls
|
||||||
|
mountPath: /secrets/devicemgmt-mtls
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: tmp
|
||||||
|
emptyDir: {}
|
||||||
|
- name: logs
|
||||||
|
emptyDir: {}
|
||||||
|
- name: devicemgmt-mtls
|
||||||
|
secret:
|
||||||
|
secretName: fc-devicemgmt-runtime
|
||||||
|
defaultMode: 0400
|
||||||
55
apps/fc-devicemgmt/ingressroute-web.yaml
Normal file
55
apps/fc-devicemgmt/ingressroute-web.yaml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# LAN ingress for FlowerCore.DeviceManagement Web.
|
||||||
|
#
|
||||||
|
# RKE2 Traefik has no built-in ACME resolver configured. Keep TLS certificate
|
||||||
|
# ownership in cert-manager Certificate/fc-devicemgmt-web-tls.
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-web
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
routes:
|
||||||
|
- match: Host(`devices.iamworkin.lan`)
|
||||||
|
kind: Rule
|
||||||
|
services:
|
||||||
|
- name: fc-devicemgmt-web
|
||||||
|
port: 80
|
||||||
|
tls:
|
||||||
|
secretName: fc-devicemgmt-web-tls
|
||||||
|
|
||||||
|
# Future public agent/update host gate (OFF by default):
|
||||||
|
#
|
||||||
|
# Do not enable `update.flowercore.io` here until Authentik OIDC Q-OIDC-1
|
||||||
|
# resolves the public-device-management auth model and route ownership with
|
||||||
|
# UpdateCenter. When enabled, use a separate public IngressRoute with an
|
||||||
|
# explicit Method allowlist, public-host auth middleware, and public TLS
|
||||||
|
# certificate strategy. Leaving this as comments keeps ArgoCD from stealing
|
||||||
|
# live UpdateCenter traffic.
|
||||||
|
#
|
||||||
|
# apiVersion: traefik.io/v1alpha1
|
||||||
|
# kind: IngressRoute
|
||||||
|
# metadata:
|
||||||
|
# name: fc-devicemgmt-web-public
|
||||||
|
# namespace: fc-devicemgmt
|
||||||
|
# annotations:
|
||||||
|
# flowercore.io/public-host-gate: "disabled-until-Q-OIDC-1"
|
||||||
|
# spec:
|
||||||
|
# entryPoints:
|
||||||
|
# - websecure
|
||||||
|
# routes:
|
||||||
|
# - match: Host(`update.flowercore.io`) && (Method(`GET`) || Method(`HEAD`) || Method(`POST`) || Method(`OPTIONS`))
|
||||||
|
# kind: Rule
|
||||||
|
# services:
|
||||||
|
# - name: fc-devicemgmt-web
|
||||||
|
# port: 80
|
||||||
|
# tls:
|
||||||
|
# secretName: fc-devicemgmt-public-tls
|
||||||
13
apps/fc-devicemgmt/namespace.yaml
Normal file
13
apps/fc-devicemgmt/namespace.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# FlowerCore.DeviceManagement namespace.
|
||||||
|
#
|
||||||
|
# ArgoCD discovers this directory as Application `infra-fc-devicemgmt`.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
224
apps/fc-devicemgmt/network-policy.yaml
Normal file
224
apps/fc-devicemgmt/network-policy.yaml
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
# FlowerCore.DeviceManagement NetworkPolicies.
|
||||||
|
#
|
||||||
|
# NetworkPolicies belong in bluejay-infra so ArgoCD owns rebuild state.
|
||||||
|
# Rules include Traefik post-DNAT backend ports per
|
||||||
|
# feedback_netpol_dnat_backend_port and Synology NFS egress for the requested
|
||||||
|
# cold-tier / future artifact path.
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-web-isolation
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
ingress:
|
||||||
|
# LAN edge: only cluster Traefik should reach the Web pod for
|
||||||
|
# devices.iamworkin.lan.
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: traefik-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: traefik
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
# Direct LAN diagnostics are allowed only from FlowerCore LAN/VPN ranges.
|
||||||
|
- from:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.56.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.57.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.58.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.68.0/27
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
egress:
|
||||||
|
# CoreDNS.
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
ports:
|
||||||
|
- port: 53
|
||||||
|
protocol: UDP
|
||||||
|
- port: 53
|
||||||
|
protocol: TCP
|
||||||
|
# Database namespace.
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: fc-mysql
|
||||||
|
ports:
|
||||||
|
- port: 3306
|
||||||
|
protocol: TCP
|
||||||
|
# Redis backplane for multi-replica SignalR / live-status fan-out.
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: fc-redis
|
||||||
|
ports:
|
||||||
|
- port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
# Traefik VIP / in-cluster Traefik for self-callbacks and public URL
|
||||||
|
# generation tests. Include post-DNAT backend ports 8443 + 8080.
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.56.200/32
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: traefik-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: traefik
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
protocol: TCP
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8443
|
||||||
|
protocol: TCP
|
||||||
|
# Agent egress: LAN/VPN devices may run DM Agent in Generic, Kiosk, Pi,
|
||||||
|
# ThinClient, or Server mode. Keep this private-range only.
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.56.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.57.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.58.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.68.0/27
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
protocol: TCP
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 5000
|
||||||
|
protocol: TCP
|
||||||
|
- port: 5001
|
||||||
|
protocol: TCP
|
||||||
|
# Synology NFS cold-tier / artifact mount allowance.
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.58.3/32
|
||||||
|
ports:
|
||||||
|
- port: 2049
|
||||||
|
protocol: TCP
|
||||||
|
- port: 2049
|
||||||
|
protocol: UDP
|
||||||
|
- port: 111
|
||||||
|
protocol: TCP
|
||||||
|
- port: 111
|
||||||
|
protocol: UDP
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-operator-isolation
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: fc-devicemgmt-operator
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: monitoring
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
egress:
|
||||||
|
# CoreDNS.
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
ports:
|
||||||
|
- port: 53
|
||||||
|
protocol: UDP
|
||||||
|
- port: 53
|
||||||
|
protocol: TCP
|
||||||
|
# Kubernetes API for KubeOps reconciliation and Deployment UID lookup.
|
||||||
|
- to: []
|
||||||
|
ports:
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 6443
|
||||||
|
protocol: TCP
|
||||||
|
# Agent egress for operator-initiated probes / fallback command dispatch.
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.56.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.57.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.58.0/24
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.68.0/27
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
protocol: TCP
|
||||||
|
- port: 443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- port: 8443
|
||||||
|
protocol: TCP
|
||||||
|
- port: 5000
|
||||||
|
protocol: TCP
|
||||||
|
- port: 5001
|
||||||
|
protocol: TCP
|
||||||
|
# Synology NFS allowance for future cold-tier/audit archival jobs.
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 10.0.58.3/32
|
||||||
|
ports:
|
||||||
|
- port: 2049
|
||||||
|
protocol: TCP
|
||||||
|
- port: 2049
|
||||||
|
protocol: UDP
|
||||||
|
- port: 111
|
||||||
|
protocol: TCP
|
||||||
|
- port: 111
|
||||||
|
protocol: UDP
|
||||||
22
apps/fc-devicemgmt/service-web.yaml
Normal file
22
apps/fc-devicemgmt/service-web.yaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-web
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-web
|
||||||
|
app.kubernetes.io/component: web
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: fc-devicemgmt-web
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
targetPort: 8080
|
||||||
|
protocol: TCP
|
||||||
12
apps/fc-devicemgmt/serviceaccount-operator.yaml
Normal file
12
apps/fc-devicemgmt/serviceaccount-operator.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: fc-devicemgmt-operator
|
||||||
|
namespace: fc-devicemgmt
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: fc-devicemgmt-operator
|
||||||
|
app.kubernetes.io/component: operator
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/tenant-id: system
|
||||||
|
flowercore.io/created-by: bluejay-infra
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
# Restart kiosk and redeclare capabilities when HDMI connect/disconnect changes DRM state.
|
# Settle DRM for 2s before restarting Chromium, then redeclare capabilities.
|
||||||
SUBSYSTEM=="drm", KERNEL=="card?-HDMI-A-?", ACTION=="change", RUN+="/usr/bin/systemctl restart flowercore-signage-player-pi.service"
|
SUBSYSTEM=="drm", KERNEL=="card?-HDMI-A-?", ACTION=="change", RUN+="/usr/bin/systemctl start flowercore-signage-player-pi-hdmi.service"
|
||||||
SUBSYSTEM=="drm", KERNEL=="card?-HDMI-A-?", ACTION=="change", RUN+="/usr/bin/systemctl start flowercore-signage-detect-display.service"
|
|
||||||
|
|||||||
22
apps/fc-signage-pi-player/tests/display_capability.bats
Normal file
22
apps/fc-signage-pi-player/tests/display_capability.bats
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
APP_ROOT="$(cd "$BATS_TEST_DIRNAME/.." && pwd)"
|
||||||
|
DETECT="$APP_ROOT/scripts/fc-signage-detect-display"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "display detection emits graceful disconnected profile when no hdmi connector is present" {
|
||||||
|
script="$(cat "$DETECT")"
|
||||||
|
[[ "$script" == *"displayConnected: false"* ]]
|
||||||
|
[[ "$script" == *"No HDMI display detected"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "display detection parses edid, falls back to kmsprint, and logs endpoint failures locally" {
|
||||||
|
script="$(cat "$DETECT")"
|
||||||
|
[[ "$script" == *"edid-decode"* ]]
|
||||||
|
[[ "$script" == *"HDR (Static|Dynamic) Metadata Block"* ]]
|
||||||
|
[[ "$script" == *"kmsprint"* ]]
|
||||||
|
[[ "$script" == *"/api/v1/nodes/\${NODE_ID}/capabilities"* ]]
|
||||||
|
[[ "$script" == *"/api/v1/displays/\${NODE_ID}/capability-profile"* ]]
|
||||||
|
[[ "$script" == *"capabilities.log"* ]]
|
||||||
|
}
|
||||||
64
apps/fc-signage-pi-player/tests/identity_bootstrap.bats
Normal file
64
apps/fc-signage-pi-player/tests/identity_bootstrap.bats
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
APP_ROOT="$(cd "$BATS_TEST_DIRNAME/.." && pwd)"
|
||||||
|
BOOTSTRAP="$APP_ROOT/scripts/flowercore-signage-bootstrap.sh"
|
||||||
|
RENEW="$APP_ROOT/scripts/flowercore-signage-renew-cert.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap is idempotent when node is already enrolled" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *'[[ -s "$NODE_JSON" && -s "$CERT_DIR/client.p12" ]]'* ]]
|
||||||
|
[[ "$script" == *"already enrolled"* ]]
|
||||||
|
[[ "$script" == *"exit 0"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap generates a stable node uuid and machine id" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *"uuidgen"* ]]
|
||||||
|
[[ "$script" == *"nodeUuid"* ]]
|
||||||
|
[[ "$script" == *"machineId"* ]]
|
||||||
|
[[ "$script" == *"cut -c1-16"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap posts to the canonical register endpoint" {
|
||||||
|
grep -q '/api/v1/nodes/register' "$BOOTSTRAP"
|
||||||
|
grep -q '"linux-arm64-pi"' "$BOOTSTRAP"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap retries registration once for first-call races" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *"for attempt in 1 2"* ]]
|
||||||
|
[[ "$script" == *"register attempt \$attempt returned"* ]]
|
||||||
|
[[ "$script" == *"sleep 5"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap supports setup-code approval with manual polling fallback" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *"signage-setup-code"* ]]
|
||||||
|
[[ "$script" == *"approve-via-setup-code"* ]]
|
||||||
|
[[ "$script" == *"+ 1800"* ]]
|
||||||
|
[[ "$script" == *"sleep 15"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap generates an ecdsa p256 csr for the signage pi subject" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *"ecparam -genkey -name prime256v1"* ]]
|
||||||
|
[[ "$script" == *'/CN=${NODE_ID}/O=FlowerCore/OU=SignagePlayer-Pi'* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "bootstrap writes pkcs12 bundle with restrictive permissions" {
|
||||||
|
script="$(cat "$BOOTSTRAP")"
|
||||||
|
[[ "$script" == *"openssl pkcs12 -export"* ]]
|
||||||
|
[[ "$script" == *"client.p12.pass"* ]]
|
||||||
|
[[ "$script" == *"chmod 0640"* ]]
|
||||||
|
[[ "$script" == *"chmod 0600"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "renewal only calls renew endpoint inside the thirty-day window and swaps atomically" {
|
||||||
|
script="$(cat "$RENEW")"
|
||||||
|
[[ "$script" == *'-checkend $((30*24*3600))'* ]]
|
||||||
|
[[ "$script" == *"/api/v1/nodes/\${NODE_ID}/renew"* ]]
|
||||||
|
[[ "$script" == *"client.key.new"* ]]
|
||||||
|
[[ "$script" == *'mv "$CERT_DIR/client.p12.new" "$CERT_DIR/client.p12"'* ]]
|
||||||
|
}
|
||||||
68
apps/fc-signage-pi-player/tests/systemd_kiosk_wrapper.bats
Normal file
68
apps/fc-signage-pi-player/tests/systemd_kiosk_wrapper.bats
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
APP_ROOT="$(cd "$BATS_TEST_DIRNAME/.." && pwd)"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "player unit exists" {
|
||||||
|
[ -f "$APP_ROOT/systemd/flowercore-signage-player-pi.service" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "player unit uses simple chromium service with restart backoff" {
|
||||||
|
unit="$(cat "$APP_ROOT/systemd/flowercore-signage-player-pi.service")"
|
||||||
|
[[ "$unit" == *"Type=simple"* ]]
|
||||||
|
[[ "$unit" == *"Restart=always"* ]]
|
||||||
|
[[ "$unit" == *"RestartSec=10s"* ]]
|
||||||
|
[[ "$unit" == *"StartLimitBurst=5"* ]]
|
||||||
|
[[ "$unit" == *"StartLimitIntervalSec=300s"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "player unit caps chromium memory at two gigabytes" {
|
||||||
|
grep -q '^MemoryMax=2G$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
grep -q '^MemoryHigh=1500M$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "player unit condition-gates startup on identity and p12 certificate" {
|
||||||
|
grep -q '^ConditionPathExists=/etc/flowercore/signage-node.json$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
grep -q '^ConditionPathExists=/etc/fc-signage-player/client.p12$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "player unit runs prelaunch checks before chromium" {
|
||||||
|
grep -q '^ExecStartPre=/usr/local/bin/flowercore-signage-prelaunch.sh$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
grep -q '^ExecStart=/usr/local/bin/flowercore-signage-launch.sh$' "$APP_ROOT/systemd/flowercore-signage-player-pi.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "hdmi udev rule routes through the two-second settle service" {
|
||||||
|
rule="$(cat "$APP_ROOT/systemd/99-flowercore-signage-hdmi.rules")"
|
||||||
|
[[ "$rule" == *'KERNEL=="card?-HDMI-A-?"'* ]]
|
||||||
|
[[ "$rule" == *"systemctl start flowercore-signage-player-pi-hdmi.service"* ]]
|
||||||
|
[[ "$rule" != *"systemctl restart flowercore-signage-player-pi.service"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "hdmi responder settles, declares display, then restarts chromium" {
|
||||||
|
responder="$(cat "$APP_ROOT/scripts/flowercore-signage-hdmi-respond.sh")"
|
||||||
|
[[ "$responder" == *"sleep 2"* ]]
|
||||||
|
[[ "$responder" == *"systemctl start flowercore-signage-detect-display.service"* ]]
|
||||||
|
[[ "$responder" == *"systemctl restart flowercore-signage-player-pi.service"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "chromium policy json is valid and disables credential prompts" {
|
||||||
|
command -v jq >/dev/null || skip "jq not installed"
|
||||||
|
jq -e '.AutofillAddressEnabled == false and .AutofillCreditCardEnabled == false and .PasswordManagerEnabled == false' \
|
||||||
|
"$APP_ROOT/chromium-policies/flowercore-signage.json" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "launch script tries embed URL and logs bare-player fallback" {
|
||||||
|
launch="$(cat "$APP_ROOT/scripts/flowercore-signage-launch.sh")"
|
||||||
|
[[ "$launch" == *'/player/${NODE_ID}/embed?token=${CERT_THUMB}'* ]]
|
||||||
|
[[ "$launch" == *"url-divergence.log"* ]]
|
||||||
|
[[ "$launch" == *'/player/${NODE_ID}?token=${CERT_THUMB}'* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "prelaunch script validates required node and cert files" {
|
||||||
|
prelaunch="$(cat "$APP_ROOT/scripts/flowercore-signage-prelaunch.sh")"
|
||||||
|
[[ "$prelaunch" == *"/etc/flowercore/signage-node.json"* ]]
|
||||||
|
[[ "$prelaunch" == *"/etc/fc-signage-player/client.p12"* ]]
|
||||||
|
[[ "$prelaunch" == *"/etc/fc-signage-player/client.p12.pass"* ]]
|
||||||
|
[[ "$prelaunch" == *"exit 1"* ]]
|
||||||
|
}
|
||||||
@@ -18,12 +18,12 @@
|
|||||||
# simultaneous runner pods; single-replica constraint below).
|
# simultaneous runner pods; single-replica constraint below).
|
||||||
#
|
#
|
||||||
# Credentials:
|
# Credentials:
|
||||||
# OnePasswordItem "GitHub Runner Registration Token" → Secret
|
# OnePasswordItem "GitHub PAT (Runner Registration)" → Secret
|
||||||
# github-runner-token with field "credential" used as RUNNER_TOKEN.
|
# github-runner-token with field "credential" used as RUNNER_TOKEN.
|
||||||
# Operator must create/rotate the 1P item manually; registration tokens
|
# Operator must create/rotate the 1P item manually; registration tokens
|
||||||
# expire after 1h — use a fine-grained PAT with admin:org_hook scope
|
# expire after 1h — use a fine-grained PAT with Administration:read/write
|
||||||
# or a re-registration script. See docs/infrastructure/
|
# scope on the target repos, or a re-registration script. See
|
||||||
# self-hosted-runner-fleet.md §Security.
|
# docs/infrastructure/self-hosted-runner-fleet.md §Security.
|
||||||
#
|
#
|
||||||
# Security model:
|
# Security model:
|
||||||
# - No ClusterRole / ClusterRoleBinding — runner has no K8s API access.
|
# - No ClusterRole / ClusterRoleBinding — runner has no K8s API access.
|
||||||
@@ -52,8 +52,10 @@ metadata:
|
|||||||
---
|
---
|
||||||
# 1Password secret sync — creates github-runner-token K8s Secret.
|
# 1Password secret sync — creates github-runner-token K8s Secret.
|
||||||
# Fields expected in the 1Password item:
|
# Fields expected in the 1Password item:
|
||||||
# credential — GitHub runner registration token (or PAT for re-reg script)
|
# credential — GitHub fine-grained PAT (Administration:read/write on
|
||||||
# Item path: IAmWorkin vault > "GitHub Runner Registration Token"
|
# target repos) used by the runner image to mint a fresh
|
||||||
|
# short-lived registration token at pod start.
|
||||||
|
# Item path: IAmWorkin vault > "GitHub PAT (Runner Registration)"
|
||||||
# Operator MUST create this item before the Deployment will start cleanly.
|
# Operator MUST create this item before the Deployment will start cleanly.
|
||||||
apiVersion: onepassword.com/v1
|
apiVersion: onepassword.com/v1
|
||||||
kind: OnePasswordItem
|
kind: OnePasswordItem
|
||||||
@@ -64,7 +66,7 @@ metadata:
|
|||||||
app.kubernetes.io/component: credentials
|
app.kubernetes.io/component: credentials
|
||||||
app.kubernetes.io/part-of: flowercore
|
app.kubernetes.io/part-of: flowercore
|
||||||
spec:
|
spec:
|
||||||
itemPath: vaults/IAmWorkin/items/GitHub Runner Registration Token
|
itemPath: vaults/IAmWorkin/items/GitHub PAT (Runner Registration)
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
@@ -111,7 +113,11 @@ spec:
|
|||||||
# one pod at a time. Each pod re-registers as an ephemeral runner after
|
# one pod at a time. Each pod re-registers as an ephemeral runner after
|
||||||
# completing a job (EPHEMERAL=true restarts the container, not the pod,
|
# completing a job (EPHEMERAL=true restarts the container, not the pod,
|
||||||
# so the PVC stays attached between jobs).
|
# so the PVC stays attached between jobs).
|
||||||
replicas: 0
|
#
|
||||||
|
# 2026-05-16: bumped 0 -> 1 after operator provisioned the
|
||||||
|
# "GitHub PAT (Runner Registration)" 1P item with field=credential.
|
||||||
|
# Unblocks CI fleet-wide (was budget-exhausted on GH-hosted runners).
|
||||||
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app.kubernetes.io/name: github-runner
|
app.kubernetes.io/name: github-runner
|
||||||
@@ -135,6 +141,32 @@ spec:
|
|||||||
runAsUser: 1001
|
runAsUser: 1001
|
||||||
runAsGroup: 1001
|
runAsGroup: 1001
|
||||||
fsGroup: 1001
|
fsGroup: 1001
|
||||||
|
# Sprint 30 Cl-1 pod-env fix (2026-05-21): pre-create + chown
|
||||||
|
# /home/runner/.dotnet + /home/runner/.nuget so the non-root runner
|
||||||
|
# (UID 1001) can host setup-dotnet@v4 + dotnet restore writes without
|
||||||
|
# the per-workflow DOTNET_INSTALL_DIR patch ~25 flipped Linux repos
|
||||||
|
# have been carrying. Runs as root so chown succeeds; the main
|
||||||
|
# container then runs as 1001 against an emptyDir mounted at
|
||||||
|
# /home/runner. The PVC mount at /home/runner/.nuget/packages
|
||||||
|
# (Common runner) still wins at its nested path because Kubernetes
|
||||||
|
# honors the deeper mount.
|
||||||
|
initContainers:
|
||||||
|
- name: setup-runner-home
|
||||||
|
image: busybox:1.36
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
mkdir -p /home/runner/.dotnet /home/runner/.nuget/packages /home/runner/.nuget/NuGet
|
||||||
|
chown -R 1001:1001 /home/runner/.dotnet /home/runner/.nuget
|
||||||
|
chmod -R 755 /home/runner/.dotnet /home/runner/.nuget
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
runAsNonRoot: false
|
||||||
|
volumeMounts:
|
||||||
|
- name: runner-home
|
||||||
|
mountPath: /home/runner
|
||||||
containers:
|
containers:
|
||||||
- name: runner
|
- name: runner
|
||||||
image: myoung34/github-runner:latest
|
image: myoung34/github-runner:latest
|
||||||
@@ -157,12 +189,40 @@ spec:
|
|||||||
# Labels used by workflow files: runs-on: [self-hosted, linux, fc-build-linux]
|
# Labels used by workflow files: runs-on: [self-hosted, linux, fc-build-linux]
|
||||||
- name: LABELS
|
- name: LABELS
|
||||||
value: "self-hosted,linux,fc-build-linux"
|
value: "self-hosted,linux,fc-build-linux"
|
||||||
# Registration token injected from 1Password via OnePasswordItem CRD.
|
# PAT (not pre-minted registration token) — myoung34/github-runner
|
||||||
- name: RUNNER_TOKEN
|
# mints registration tokens itself via GitHub API when ACCESS_TOKEN
|
||||||
|
# is set. Switched from RUNNER_TOKEN -> ACCESS_TOKEN on 2026-05-16
|
||||||
|
# because the 1P "GitHub PAT (Runner Registration)" item stores a
|
||||||
|
# fine-grained PAT, not a short-lived registration token.
|
||||||
|
- name: ACCESS_TOKEN
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: github-runner-token
|
name: github-runner-token
|
||||||
key: credential
|
key: credential
|
||||||
|
# myoung34/github-runner default entrypoint expects root for some
|
||||||
|
# setup steps. With securityContext.runAsUser=1001 the entrypoint
|
||||||
|
# short-circuits with "RUN_AS_ROOT env var is set to true but the
|
||||||
|
# user has been overridden and is not running as root". Tell the
|
||||||
|
# entrypoint we're explicitly NOT root so it skips the root-only
|
||||||
|
# setup steps (cache prewarm + apt updates — both already baked).
|
||||||
|
- name: RUN_AS_ROOT
|
||||||
|
value: "false"
|
||||||
|
# Sprint 30 Cl-1 pod-env fix (2026-05-21): retire the per-workflow
|
||||||
|
# DOTNET_INSTALL_DIR patch by setting it (+ siblings) here so ALL
|
||||||
|
# flipped Linux repos pick it up automatically. setup-dotnet@v4
|
||||||
|
# default writes to /usr/share/dotnet (root-only) or HOME-relative
|
||||||
|
# ~/.dotnet without HOME guard; pin both explicitly to the chowned
|
||||||
|
# emptyDir at /home/runner.
|
||||||
|
- name: DOTNET_INSTALL_DIR
|
||||||
|
value: "/home/runner/.dotnet"
|
||||||
|
- name: DOTNET_CLI_TELEMETRY_OPTOUT
|
||||||
|
value: "1"
|
||||||
|
- name: NUGET_PACKAGES
|
||||||
|
value: "/home/runner/.nuget/packages"
|
||||||
|
- name: DOTNET_NOLOGO
|
||||||
|
value: "1"
|
||||||
|
- name: DOTNET_GENERATE_ASPNET_CERTIFICATE
|
||||||
|
value: "false"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: "500m"
|
cpu: "500m"
|
||||||
@@ -171,6 +231,14 @@ spec:
|
|||||||
cpu: "2000m"
|
cpu: "2000m"
|
||||||
memory: "4Gi"
|
memory: "4Gi"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
# /home/runner emptyDir — owned by the non-root runner thanks
|
||||||
|
# to the setup-runner-home initContainer chown. Hosts .dotnet
|
||||||
|
# (setup-dotnet@v4 target) and provides a writable HOME without
|
||||||
|
# forcing a PVC. The PVC mount below at .nuget/packages wins
|
||||||
|
# at that nested path (deeper mount overrides), so the Common
|
||||||
|
# NuGet cache continues to persist across ephemeral pod restarts.
|
||||||
|
- name: runner-home
|
||||||
|
mountPath: /home/runner
|
||||||
- name: nuget-cache
|
- name: nuget-cache
|
||||||
mountPath: /home/runner/.nuget/packages
|
mountPath: /home/runner/.nuget/packages
|
||||||
- name: tmp
|
- name: tmp
|
||||||
@@ -186,6 +254,8 @@ spec:
|
|||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
volumes:
|
volumes:
|
||||||
|
- name: runner-home
|
||||||
|
emptyDir: {}
|
||||||
- name: nuget-cache
|
- name: nuget-cache
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: github-runner-nuget-cache
|
claimName: github-runner-nuget-cache
|
||||||
@@ -194,3 +264,135 @@ spec:
|
|||||||
# Restart policy: Always — the Deployment controller handles
|
# Restart policy: Always — the Deployment controller handles
|
||||||
# re-registration after each ephemeral job completes.
|
# re-registration after each ephemeral job completes.
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
|
---
|
||||||
|
# Shared.Pos repo-scoped Linux runner. Added 2026-05-20 to unstick the
|
||||||
|
# FlowerCore.Shared.Pos "Build, Test & Publish" workflow, which had been
|
||||||
|
# queued indefinitely after the Sprint 26 Mac POS Phase 1/2 PRs merged
|
||||||
|
# (no fc-build-linux runner was registered to Shared.Pos — GitHub user
|
||||||
|
# accounts have only repo-scoped runners). First concrete instance of the
|
||||||
|
# Sprint 29 Cx-1 Linux-runner-fleet pattern; the full per-repo fleet is
|
||||||
|
# codified by that lane. emptyDir nuget cache (no RWO PVC) so it shares no
|
||||||
|
# volume with the Common runner and needs no node pin.
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: github-runner-sharedpos
|
||||||
|
namespace: github-runner
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: github-runner-sharedpos
|
||||||
|
app.kubernetes.io/component: runner
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
flowercore.io/created-by: argocd
|
||||||
|
spec:
|
||||||
|
# UN-PARKED 2026-05-21: Shared.Pos #5 fixed the non-root setup-dotnet path
|
||||||
|
# (DOTNET_INSTALL_DIR step-scoped). Re-enabled to run the now-fixable build.
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: github-runner-sharedpos
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: github-runner-sharedpos
|
||||||
|
app.kubernetes.io/component: runner
|
||||||
|
app.kubernetes.io/part-of: flowercore
|
||||||
|
flowercore.io/created-by: argocd
|
||||||
|
spec:
|
||||||
|
serviceAccountName: github-runner
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1001
|
||||||
|
runAsGroup: 1001
|
||||||
|
fsGroup: 1001
|
||||||
|
# Sprint 30 Cl-1 pod-env fix (2026-05-21): see github-runner Deployment
|
||||||
|
# above for full rationale. Mirrored on the Shared.Pos runner so the
|
||||||
|
# per-workflow DOTNET_INSTALL_DIR patch can be retired fleet-wide
|
||||||
|
# rather than re-applied per repo as flipped lanes land.
|
||||||
|
initContainers:
|
||||||
|
- name: setup-runner-home
|
||||||
|
image: busybox:1.36
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
mkdir -p /home/runner/.dotnet /home/runner/.nuget/packages /home/runner/.nuget/NuGet
|
||||||
|
chown -R 1001:1001 /home/runner/.dotnet /home/runner/.nuget
|
||||||
|
chmod -R 755 /home/runner/.dotnet /home/runner/.nuget
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 0
|
||||||
|
runAsNonRoot: false
|
||||||
|
volumeMounts:
|
||||||
|
- name: runner-home
|
||||||
|
mountPath: /home/runner
|
||||||
|
containers:
|
||||||
|
- name: runner
|
||||||
|
image: myoung34/github-runner:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: REPO_URL
|
||||||
|
value: "https://github.com/astoltz/FlowerCore.Shared.Pos"
|
||||||
|
- name: RUNNER_NAME_PREFIX
|
||||||
|
value: "rke2-linux-sharedpos"
|
||||||
|
- name: RUNNER_WORKDIR
|
||||||
|
value: "/tmp/runner/work"
|
||||||
|
- name: EPHEMERAL
|
||||||
|
value: "true"
|
||||||
|
- name: LABELS
|
||||||
|
value: "self-hosted,linux,fc-build-linux"
|
||||||
|
- name: ACCESS_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: github-runner-token
|
||||||
|
key: credential
|
||||||
|
- name: RUN_AS_ROOT
|
||||||
|
value: "false"
|
||||||
|
# Sprint 30 Cl-1 pod-env fix (2026-05-21): retire per-workflow patch.
|
||||||
|
- name: DOTNET_INSTALL_DIR
|
||||||
|
value: "/home/runner/.dotnet"
|
||||||
|
- name: DOTNET_CLI_TELEMETRY_OPTOUT
|
||||||
|
value: "1"
|
||||||
|
- name: NUGET_PACKAGES
|
||||||
|
value: "/home/runner/.nuget/packages"
|
||||||
|
- name: DOTNET_NOLOGO
|
||||||
|
value: "1"
|
||||||
|
- name: DOTNET_GENERATE_ASPNET_CERTIFICATE
|
||||||
|
value: "false"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "500m"
|
||||||
|
memory: "1Gi"
|
||||||
|
limits:
|
||||||
|
cpu: "2000m"
|
||||||
|
memory: "4Gi"
|
||||||
|
volumeMounts:
|
||||||
|
# Shared.Pos runner uses emptyDir for nuget cache (no node pin
|
||||||
|
# via RWO PVC). /home/runner emptyDir hosts .dotnet via the
|
||||||
|
# setup-runner-home initContainer chown; the .nuget/packages
|
||||||
|
# emptyDir mount still wins at its nested path.
|
||||||
|
- name: runner-home
|
||||||
|
mountPath: /home/runner
|
||||||
|
- name: nuget-cache
|
||||||
|
mountPath: /home/runner/.nuget/packages
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "pgrep -f Runner.Listener > /dev/null"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 30
|
||||||
|
failureThreshold: 3
|
||||||
|
volumes:
|
||||||
|
- name: runner-home
|
||||||
|
emptyDir: {}
|
||||||
|
- name: nuget-cache
|
||||||
|
emptyDir: {}
|
||||||
|
- name: tmp
|
||||||
|
emptyDir: {}
|
||||||
|
restartPolicy: Always
|
||||||
|
|||||||
@@ -75,6 +75,20 @@ data:
|
|||||||
cluster: "rke2"
|
cluster: "rke2"
|
||||||
role: "agent"
|
role: "agent"
|
||||||
|
|
||||||
|
# Mac mini macOS runner node (INFRA VLAN)
|
||||||
|
- job_name: "macmini-node"
|
||||||
|
scrape_timeout: 15s
|
||||||
|
static_configs:
|
||||||
|
- targets: ["10.0.56.115:9100"]
|
||||||
|
labels:
|
||||||
|
instance: "macmini"
|
||||||
|
host: "macmini.iamworkin.lan"
|
||||||
|
vlan: "infra"
|
||||||
|
arch: "arm64"
|
||||||
|
role: "macos-runner"
|
||||||
|
puppet_managed: "true"
|
||||||
|
puppet_server: "puppet.iamworkin.lan"
|
||||||
|
|
||||||
# In-cluster node-exporter DaemonSet
|
# In-cluster node-exporter DaemonSet
|
||||||
- job_name: "k8s-node-exporter"
|
- job_name: "k8s-node-exporter"
|
||||||
kubernetes_sd_configs:
|
kubernetes_sd_configs:
|
||||||
@@ -697,6 +711,18 @@ data:
|
|||||||
summary: "Print.Web Ollama runner held for >10m ({{ $labels.model }})"
|
summary: "Print.Web Ollama runner held for >10m ({{ $labels.model }})"
|
||||||
description: "Print.Web reports model {{ $labels.model }} with {{ $value | printf \"%.0f\" }}s of keep-alive remaining. Check concurrent requests before the Pi 5 Ollama lane thrashes."
|
description: "Print.Web reports model {{ $labels.model }} with {{ $value | printf \"%.0f\" }}s of keep-alive remaining. Check concurrent requests before the Pi 5 Ollama lane thrashes."
|
||||||
|
|
||||||
|
- name: macmini-runners
|
||||||
|
rules:
|
||||||
|
- alert: MacMiniRunnerOffline
|
||||||
|
expr: (flowercore_github_runner_online{runner=~"macmini-.*"} == 0) or absent(flowercore_github_runner_online{runner=~"macmini-.*"})
|
||||||
|
for: 10m
|
||||||
|
labels:
|
||||||
|
severity: warning
|
||||||
|
service: github-runner
|
||||||
|
annotations:
|
||||||
|
summary: "Mac mini GitHub runner offline ({{ $labels.runner }})"
|
||||||
|
description: "A macmini-* GitHub Actions runner has not reported online for more than 10 minutes. Puppet manages its LaunchDaemon under /Library/LaunchDaemons/io.flowercore.github-runner-<slug>.plist; runners survive reboot and do not require a GUI session."
|
||||||
|
|
||||||
- name: remote-desktop
|
- name: remote-desktop
|
||||||
rules:
|
rules:
|
||||||
- alert: RemoteDesktopWebDown
|
- alert: RemoteDesktopWebDown
|
||||||
@@ -3427,6 +3453,32 @@ data:
|
|||||||
relativeTimeRange: {from: 120, to: 0}
|
relativeTimeRange: {from: 120, to: 0}
|
||||||
datasourceUid: __expr__
|
datasourceUid: __expr__
|
||||||
model: {type: threshold, expression: B, conditions: [{evaluator: {params: [1], type: lt}}], refId: C}
|
model: {type: threshold, expression: B, conditions: [{evaluator: {params: [1], type: lt}}], refId: C}
|
||||||
|
- uid: macmini-runner-offline
|
||||||
|
title: MacMiniRunnerOffline
|
||||||
|
condition: C
|
||||||
|
for: 10m
|
||||||
|
noDataState: Alerting
|
||||||
|
execErrState: OK
|
||||||
|
annotations:
|
||||||
|
summary: Mac mini GitHub runner offline
|
||||||
|
description: "One or more macmini-* GitHub Actions runners have not reported online for more than 10 minutes. LaunchDaemons survive reboot and do not require the bluejay GUI session."
|
||||||
|
runbook: "1. ssh fcadmin@macmini.iamworkin.lan 2. launchctl print system/io.flowercore.github-runner-<slug> 3. Check /Users/fcadmin/Library/Logs/github-runners/<slug>/stderr.log 4. Re-register the repo runner if .runner is missing"
|
||||||
|
labels:
|
||||||
|
severity: warning
|
||||||
|
service: github-runner
|
||||||
|
data:
|
||||||
|
- refId: A
|
||||||
|
relativeTimeRange: {from: 600, to: 0}
|
||||||
|
datasourceUid: prometheus
|
||||||
|
model: {expr: 'min(flowercore_github_runner_online{runner=~"macmini-.*"} or vector(0))', instant: true, refId: A}
|
||||||
|
- refId: B
|
||||||
|
relativeTimeRange: {from: 600, to: 0}
|
||||||
|
datasourceUid: __expr__
|
||||||
|
model: {type: reduce, expression: A, reducer: last, refId: B}
|
||||||
|
- refId: C
|
||||||
|
relativeTimeRange: {from: 600, to: 0}
|
||||||
|
datasourceUid: __expr__
|
||||||
|
model: {type: threshold, expression: B, conditions: [{evaluator: {params: [1], type: lt}}], refId: C}
|
||||||
- uid: high-cpu
|
- uid: high-cpu
|
||||||
title: High CPU (>85%)
|
title: High CPU (>85%)
|
||||||
condition: C
|
condition: C
|
||||||
|
|||||||
@@ -291,6 +291,184 @@ public sealed class FleetManifestLintTests
|
|||||||
violations.Should().BeEmpty();
|
violations.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_MustShipExpectedManifestSet()
|
||||||
|
{
|
||||||
|
var appRoot = Path.Combine(Inventory.BluejayRoot, "apps", "fc-devicemgmt");
|
||||||
|
Directory.Exists(appRoot).Should().BeTrue("Sprint 8 Cx-5 owns apps/fc-devicemgmt.");
|
||||||
|
|
||||||
|
var expectedFiles = new[]
|
||||||
|
{
|
||||||
|
"1password-item.yaml",
|
||||||
|
"argocd-application.yaml",
|
||||||
|
"certificate-web.yaml",
|
||||||
|
"clusterrole-operator.yaml",
|
||||||
|
"clusterrolebinding-operator.yaml",
|
||||||
|
"deployment-operator.yaml",
|
||||||
|
"deployment-web.yaml",
|
||||||
|
"ingressroute-web.yaml",
|
||||||
|
"namespace.yaml",
|
||||||
|
"network-policy.yaml",
|
||||||
|
"service-web.yaml",
|
||||||
|
"serviceaccount-operator.yaml",
|
||||||
|
};
|
||||||
|
|
||||||
|
Directory.GetFiles(appRoot, "*.yaml")
|
||||||
|
.Select(Path.GetFileName)
|
||||||
|
.Should()
|
||||||
|
.BeEquivalentTo(expectedFiles);
|
||||||
|
|
||||||
|
foreach (var expectedFile in expectedFiles)
|
||||||
|
{
|
||||||
|
FcDeviceManagementDocuments()
|
||||||
|
.Should()
|
||||||
|
.Contain(document => document.RelativePath == $"fc-devicemgmt/{expectedFile}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_ObjectsMustCarryStandardTraceabilityLabels()
|
||||||
|
{
|
||||||
|
var requiredLabels = new[]
|
||||||
|
{
|
||||||
|
"app.kubernetes.io/name",
|
||||||
|
"app.kubernetes.io/part-of",
|
||||||
|
"app.kubernetes.io/managed-by",
|
||||||
|
"flowercore.io/tenant-id",
|
||||||
|
"flowercore.io/created-by",
|
||||||
|
};
|
||||||
|
|
||||||
|
var violations = FcDeviceManagementDocuments()
|
||||||
|
.SelectMany(document => requiredLabels
|
||||||
|
.Where(label => string.IsNullOrWhiteSpace(document.Scalar("metadata", "labels", label)))
|
||||||
|
.Select(label => $"{document.Descriptor} is missing metadata.labels['{label}']."))
|
||||||
|
.Concat(FcDeviceManagementDocuments()
|
||||||
|
.Where(document => document.Kind == "Deployment")
|
||||||
|
.SelectMany(document => requiredLabels
|
||||||
|
.Where(label => string.IsNullOrWhiteSpace(document.Scalar("spec", "template", "metadata", "labels", label)))
|
||||||
|
.Select(label => $"{document.Descriptor} pod template is missing metadata.labels['{label}'].")))
|
||||||
|
.Concat(FcDeviceManagementDocuments()
|
||||||
|
.Where(document => document.Kind == "Deployment")
|
||||||
|
.Where(document => string.IsNullOrWhiteSpace(document.Scalar("spec", "template", "metadata", "annotations", "flowercore.io/audit-trace-id")))
|
||||||
|
.Select(document => $"{document.Descriptor} pod template is missing flowercore.io/audit-trace-id."))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
violations.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_IngressMustUseCertManagerAndKeepPublicHostDisabled()
|
||||||
|
{
|
||||||
|
var appText = string.Join(
|
||||||
|
Environment.NewLine,
|
||||||
|
Directory.GetFiles(Path.Combine(Inventory.BluejayRoot, "apps", "fc-devicemgmt"), "*.yaml")
|
||||||
|
.Select(File.ReadAllText));
|
||||||
|
|
||||||
|
appText.Should().NotContain("certResolver");
|
||||||
|
appText.Should().Contain("update.flowercore.io");
|
||||||
|
appText.Should().Contain("disabled-until-Q-OIDC-1");
|
||||||
|
|
||||||
|
FcDeviceManagementDocuments()
|
||||||
|
.Where(document => document.Kind == "IngressRoute")
|
||||||
|
.SelectMany(document => document.MappingSequence("spec", "routes"))
|
||||||
|
.Select(route => ManifestNodeExtensions.Scalar(route, "match") ?? string.Empty)
|
||||||
|
.Should()
|
||||||
|
.Contain(match => match.Contains("Host(`devices.iamworkin.lan`)", StringComparison.Ordinal))
|
||||||
|
.And.NotContain(match => match.Contains("Host(`update.flowercore.io`)", StringComparison.Ordinal));
|
||||||
|
|
||||||
|
var certificate = FcDeviceManagementDocuments()
|
||||||
|
.Single(document => document.Kind == "Certificate" && document.Name == "fc-devicemgmt-web-tls");
|
||||||
|
|
||||||
|
certificate.Scalar("spec", "issuerRef", "name").Should().Be("step-ca-acme");
|
||||||
|
certificate.Scalar("spec", "issuerRef", "kind").Should().Be("ClusterIssuer");
|
||||||
|
ManifestNodeExtensions.ScalarSequence(certificate.Root, "spec", "dnsNames")
|
||||||
|
.Should()
|
||||||
|
.ContainSingle("devices.iamworkin.lan");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_OperatorRbacMustCoverDevicesAndOwnerLookup()
|
||||||
|
{
|
||||||
|
var clusterRole = FcDeviceManagementDocuments()
|
||||||
|
.Single(document => document.Kind == "ClusterRole" && document.Name == "fc-devicemgmt-operator");
|
||||||
|
var allScalars = clusterRole.AllScalars().ToList();
|
||||||
|
|
||||||
|
allScalars.Should().Contain("devices.flowercore.io");
|
||||||
|
allScalars.Should().Contain("*");
|
||||||
|
allScalars.Should().Contain("deployments");
|
||||||
|
allScalars.Should().Contain("get");
|
||||||
|
|
||||||
|
var operatorDeployment = FcDeviceManagementDocuments()
|
||||||
|
.Single(document => document.Kind == "Deployment" && document.Name == "fc-devicemgmt-operator");
|
||||||
|
|
||||||
|
operatorDeployment.AllScalars().Should().Contain("FLOWERCORE_KUBERNETES_OWNER_DEPLOYMENT");
|
||||||
|
operatorDeployment.AllScalars().Should().Contain("fc-devicemgmt-operator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_RuntimeSecretsMustUseOnePasswordItemPattern()
|
||||||
|
{
|
||||||
|
var item = FcDeviceManagementDocuments()
|
||||||
|
.Single(document => document.Kind == "OnePasswordItem" && document.Name == "fc-devicemgmt-runtime");
|
||||||
|
|
||||||
|
item.Scalar("spec", "itemPath")
|
||||||
|
.Should()
|
||||||
|
.Be("vaults/IAmWorkin/items/FlowerCore DeviceManagement Runtime");
|
||||||
|
|
||||||
|
var appText = string.Join(
|
||||||
|
Environment.NewLine,
|
||||||
|
Directory.GetFiles(Path.Combine(Inventory.BluejayRoot, "apps", "fc-devicemgmt"), "*.yaml")
|
||||||
|
.Select(File.ReadAllText));
|
||||||
|
|
||||||
|
FcDeviceManagementDocuments().Should().NotContain(document => document.Kind == "Secret");
|
||||||
|
appText.Should().Contain("secretKeyRef:");
|
||||||
|
appText.Should().Contain("secretName: fc-devicemgmt-runtime");
|
||||||
|
appText.Should().NotContain("stringData:");
|
||||||
|
appText.Should().NotContain("from-literal");
|
||||||
|
appText.Should().NotContain("tls.key:");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_NetworkPoliciesMustAllowLanAgentsSynologyAndDnatPorts()
|
||||||
|
{
|
||||||
|
var policies = FcDeviceManagementDocuments()
|
||||||
|
.Where(document => document.Kind == "NetworkPolicy")
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
policies.Should().HaveCount(2);
|
||||||
|
|
||||||
|
var combinedScalars = policies.SelectMany(policy => policy.AllScalars()).ToList();
|
||||||
|
combinedScalars.Should().Contain("10.0.56.0/24");
|
||||||
|
combinedScalars.Should().Contain("10.0.57.0/24");
|
||||||
|
combinedScalars.Should().Contain("10.0.58.0/24");
|
||||||
|
combinedScalars.Should().Contain("10.0.68.0/27");
|
||||||
|
combinedScalars.Should().Contain("10.0.58.3/32");
|
||||||
|
|
||||||
|
var combinedEgressPorts = policies.SelectMany(policy => policy.EgressPorts()).ToHashSet(StringComparer.Ordinal);
|
||||||
|
combinedEgressPorts.Should().Contain(new[] { "80", "443", "8080", "8443", "2049", "111" });
|
||||||
|
|
||||||
|
var traefikVipPolicies = policies
|
||||||
|
.Where(policy => policy.AllScalars().Any(value => value.Contains("10.0.56.200", StringComparison.Ordinal)))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
traefikVipPolicies.Should().ContainSingle();
|
||||||
|
traefikVipPolicies[0].EgressPorts().Should().Contain(new[] { "80", "443", "8080", "8443" });
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FcDeviceManagement_ArgocdApplicationMustMatchApplicationSetDiscoveryConventions()
|
||||||
|
{
|
||||||
|
var application = FcDeviceManagementDocuments()
|
||||||
|
.Single(document => document.Kind == "Application" && document.Name == "infra-fc-devicemgmt");
|
||||||
|
|
||||||
|
application.Namespace.Should().Be("argocd");
|
||||||
|
application.Scalar("spec", "source", "repoURL")
|
||||||
|
.Should()
|
||||||
|
.Be("http://gitea-clusterip.gitea.svc.cluster.local:3000/bluejay/bluejay-infra.git");
|
||||||
|
application.Scalar("spec", "source", "path").Should().Be("apps/fc-devicemgmt");
|
||||||
|
application.Scalar("spec", "destination", "namespace").Should().Be("fc-devicemgmt");
|
||||||
|
}
|
||||||
|
|
||||||
private static IEnumerable<string> ProbeViolations(
|
private static IEnumerable<string> ProbeViolations(
|
||||||
ManifestDocument document,
|
ManifestDocument document,
|
||||||
YamlMappingNode container,
|
YamlMappingNode container,
|
||||||
@@ -314,6 +492,13 @@ public sealed class FleetManifestLintTests
|
|||||||
$"{document.Descriptor} container '{containerName}' still uses {probeKey}.httpGet on /health.",
|
$"{document.Descriptor} container '{containerName}' still uses {probeKey}.httpGet on /health.",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IReadOnlyList<ManifestDocument> FcDeviceManagementDocuments()
|
||||||
|
{
|
||||||
|
return Inventory.Documents
|
||||||
|
.Where(document => document.RelativePath.StartsWith("fc-devicemgmt/", StringComparison.Ordinal))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class ManifestInventory
|
internal sealed class ManifestInventory
|
||||||
|
|||||||
@@ -174,10 +174,13 @@ public sealed class PiSignagePlayerArtifactTests
|
|||||||
public void HdmiRule_RestartsPlayerAndRunsCapabilityDetection()
|
public void HdmiRule_RestartsPlayerAndRunsCapabilityDetection()
|
||||||
{
|
{
|
||||||
var rule = Read("systemd/99-flowercore-signage-hdmi.rules");
|
var rule = Read("systemd/99-flowercore-signage-hdmi.rules");
|
||||||
|
var responder = Read("scripts/flowercore-signage-hdmi-respond.sh");
|
||||||
|
|
||||||
rule.Should().Contain("KERNEL==\"card?-HDMI-A-?\"");
|
rule.Should().Contain("KERNEL==\"card?-HDMI-A-?\"");
|
||||||
rule.Should().Contain("restart flowercore-signage-player-pi.service");
|
rule.Should().Contain("start flowercore-signage-player-pi-hdmi.service");
|
||||||
rule.Should().Contain("start flowercore-signage-detect-display.service");
|
responder.Should().Contain("sleep 2");
|
||||||
|
responder.Should().Contain("start flowercore-signage-detect-display.service");
|
||||||
|
responder.Should().Contain("restart flowercore-signage-player-pi.service");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
Reference in New Issue
Block a user