1
0
forked from k-space/kube
kube/nextcloud/application.yaml

334 lines
9.7 KiB
YAML
Raw Normal View History

2023-07-29 21:14:56 +00:00
---
apiVersion: codemowers.cloud/v1beta1
kind: SecretClaim
metadata:
2024-08-23 17:38:01 +00:00
name: dragonfly-auth
2023-07-29 21:14:56 +00:00
spec:
size: 32
mapping:
2024-08-23 17:38:01 +00:00
- key: REDIS_PASSWORD
2023-07-29 21:14:56 +00:00
value: "%(plaintext)s"
2024-08-23 17:38:01 +00:00
- key: REDIS_URI
value: "redis://:%(plaintext)s@dragonfly"
2023-07-29 21:14:56 +00:00
---
2024-08-23 17:38:01 +00:00
apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
2023-07-29 21:14:56 +00:00
metadata:
2024-08-23 17:38:01 +00:00
name: dragonfly
2023-07-29 21:14:56 +00:00
spec:
2024-08-23 17:38:01 +00:00
authentication:
passwordFromSecret:
key: REDIS_PASSWORD
name: dragonfly-auth
replicas: 3
2024-08-24 20:31:22 +00:00
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: dragonfly
2024-08-24 20:31:22 +00:00
app.kubernetes.io/part-of: dragonfly
2024-08-23 17:38:01 +00:00
resources:
limits:
2024-08-24 20:31:22 +00:00
cpu: 600m
memory: 500Mi
requests:
cpu: 100m
memory: 30Mi
2023-07-29 21:14:56 +00:00
---
2024-07-27 00:15:41 +00:00
apiVersion: codemowers.cloud/v1beta1
kind: OIDCClient
2023-07-29 21:14:56 +00:00
metadata:
name: nextcloud
spec:
displayName: Nextcloud
uri: https://nextcloud.k-space.ee
redirectUris:
- https://nextcloud.k-space.ee/apps/oidc_login/oidc
allowedGroups:
- k-space:floor
grantTypes:
- authorization_code
- refresh_token
responseTypes:
- code
availableScopes:
- openid
- profile
pkce: false
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nextcloud
labels:
app.kubernetes.io/name: nextcloud
spec:
2024-08-24 20:31:22 +00:00
revisionHistoryLimit: 0
2023-07-29 21:14:56 +00:00
serviceName: nextcloud
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nextcloud
template:
metadata:
labels:
app.kubernetes.io/name: nextcloud
spec:
enableServiceLinks: false
initContainers:
- name: setup-php-config
image: nextcloud@sha256:072d9d3b8428d6b31fe7ed603737d4173f0ca85c0f1d0d8607fd4741fdfa49a9
command: [ "/bin/sh","-c" ]
args: ["cp -r /usr/local/etc/php/conf.d/. /config/"]
volumeMounts:
- mountPath: /config
name: php-config
2023-07-29 21:14:56 +00:00
containers:
- name: nextcloud
image: nextcloud@sha256:072d9d3b8428d6b31fe7ed603737d4173f0ca85c0f1d0d8607fd4741fdfa49a9
2024-08-24 20:31:22 +00:00
resources:
limits:
cpu: 4000m
memory: 2Gi
requests:
cpu: 400m
memory: 500Mi
readinessProbe:
exec:
command:
- /usr/local/bin/php
- /var/www/html/cron.php
initialDelaySeconds: 1
periodSeconds: 300
timeoutSeconds: 30
2023-07-29 21:14:56 +00:00
env:
- name: OIDC_CLIENT_ID
valueFrom:
secretKeyRef:
name: oidc-client-nextcloud-owner-secrets
key: OIDC_CLIENT_ID
- name: OIDC_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: oidc-client-nextcloud-owner-secrets
key: OIDC_CLIENT_SECRET
2024-07-27 00:15:41 +00:00
- name: OIDC_IDP_AUTH_URI
2023-07-29 21:14:56 +00:00
valueFrom:
secretKeyRef:
name: oidc-client-nextcloud-owner-secrets
2024-07-27 00:15:41 +00:00
key: OIDC_IDP_AUTH_URI
- name: OIDC_IDP_URI
2023-07-29 21:14:56 +00:00
valueFrom:
secretKeyRef:
name: oidc-client-nextcloud-owner-secrets
2024-07-27 00:15:41 +00:00
key: OIDC_IDP_URI
2023-07-29 21:14:56 +00:00
- name: UPLOAD_LIMIT
value: 10G
- name: MYSQL_USER
value: kspace_nextcloud
- name: MYSQL_DATABASE
value: kspace_nextcloud
- name: MYSQL_HOST
value: mariadb.infra.k-space.ee
- name: NEXTCLOUD_ADMIN_USER
value: admin
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: nextcloud.k-space.ee nextcloud # This is for reference - these values are not actually changed by env after installation.
2023-07-29 21:14:56 +00:00
- name: OBJECTSTORE_S3_HOST
value: 172.20.9.2
2023-07-29 21:14:56 +00:00
- name: OBJECTSTORE_S3_PORT
value: "9000"
- name: OBJECTSTORE_S3_BUCKET
value: kspace-nextcloud
- name: OBJECTSTORE_S3_SSL
value: "false"
- name: OBJECTSTORE_S3_KEY
value: kspace-nextcloud
- name: OBJECTSTORE_S3_REGION
value: us-west-1
- name: OBJECTSTORE_S3_USEPATH_STYLE
value: "true"
- name: TRUSTED_PROXIES
value: 0.0.0.0/0
- name: MAIL_FROM_ADDRESS
value: nextcloud@k-space.ee
- name: SMTP_HOST
value: mail.k-space.ee
- name: MAIL_DOMAIN
value: k-space.ee
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-admin-secrets
key: password
- name: REDIS_HOST
2024-08-23 17:38:01 +00:00
value: dragonfly
2023-07-29 21:14:56 +00:00
- name: REDIS_HOST_PASSWORD
valueFrom:
secretKeyRef:
2024-08-23 17:38:01 +00:00
name: dragonfly-auth
2023-07-29 21:14:56 +00:00
key: REDIS_PASSWORD
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-imported-secrets
key: MYSQL_PASSWORD
- name: OBJECTSTORE_S3_SECRET
valueFrom:
secretKeyRef:
name: nextcloud-imported-secrets
key: OBJECTSTORE_S3_SECRET
ports:
- containerPort: 80
name: http
volumeMounts:
- mountPath: /var/www/html
name: data
- mountPath: /var/www/html/config/oidc.config.php
name: config
subPath: oidc.config.php
2024-02-04 18:42:19 +00:00
- mountPath: /var/www/html/config/override.config.php
name: config
subPath: override.config.php
- name: php-config
mountPath: /usr/local/etc/php/conf.d/
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
2023-07-29 21:14:56 +00:00
volumes:
- name: php-config
emptyDir: {}
2023-07-29 21:14:56 +00:00
- name: config
projected:
sources:
- configMap:
name: nextcloud-config
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: "OnRootMismatch"
sysctls:
- name: net.ipv4.ip_unprivileged_port_start
value: "0"
2023-07-29 21:14:56 +00:00
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: nextcloud
spec:
ports:
- port: 80
protocol: TCP
targetPort: http
selector:
app.kubernetes.io/name: nextcloud
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nextcloud
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
traefik.ingress.kubernetes.io/router.middlewares: nextcloud-nextcloud-block-external-cron@kubernetescrd
2023-07-29 21:14:56 +00:00
spec:
rules:
- host: nextcloud.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: nextcloud
port:
number: 80
tls:
- hosts:
- "*.k-space.ee"
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: nextcloud-block-external-cron
spec:
replacePathRegex:
regex: /cron.php
replacement: /
---
2023-07-29 21:14:56 +00:00
apiVersion: v1
kind: ConfigMap
metadata:
name: nextcloud-config
data:
2024-02-04 18:42:19 +00:00
override.config.php: |-
<?php
$CONFIG = array (
'skeletondirectory' => '',
'default_phone_region' => 'EE',
2024-02-04 18:42:19 +00:00
);
2023-07-29 21:14:56 +00:00
oidc.config.php: |-
<?php
$CONFIG = array (
'allow_user_to_change_display_name' => false,
'lost_password_link' => 'disabled',
2024-07-27 00:15:41 +00:00
'oidc_login_provider_url' => getenv('OIDC_IDP_URI'),
2023-07-29 21:14:56 +00:00
'oidc_login_client_id' => getenv('OIDC_CLIENT_ID'),
'oidc_login_client_secret' => getenv('OIDC_CLIENT_SECRET'),
2024-02-04 22:50:17 +00:00
'oidc_login_auto_redirect' => true,
2024-07-27 00:15:41 +00:00
'oidc_login_logout_url' => getenv('OIDC_IDP_URI'),
2023-07-29 21:14:56 +00:00
'oidc_login_end_session_redirect' => false,
'oidc_login_default_quota' => '250000000000',
'oidc_login_button_text' => 'Log in with OpenID',
'oidc_login_hide_password_form' => true,
'oidc_login_use_id_token' => false,
'oidc_login_attributes' => array (
'id' => 'sub',
'name' => 'name',
'mail' => 'email',
//'quota' => 'ownCloudQuota',
'home' => 'homeDirectory',
2024-02-04 22:02:21 +00:00
//'ldap_uid' => 'sub',
2023-07-29 21:14:56 +00:00
//'groups' => 'ownCloudGroups',
//'login_filter' => 'realm_access_roles',
//'photoURL' => 'picture',
//'is_admin' => 'ownCloudAdmin',
),
//'oidc_login_default_group' => 'oidc',
'oidc_login_filter_allowed_values' => null,
'oidc_login_use_external_storage' => false,
'oidc_login_scope' => 'openid profile',
'oidc_login_proxy_ldap' => false,
2024-02-04 19:05:53 +00:00
'oidc_login_disable_registration' => false,
2023-07-29 21:14:56 +00:00
'oidc_login_redir_fallback' => false,
'oidc_login_alt_login_page' => 'assets/login.php',
'oidc_login_tls_verify' => true,
'oidc_create_groups' => false,
'oidc_login_webdav_enabled' => false,
'oidc_login_password_authentication' => false,
'oidc_login_public_key_caching_time' => 86400,
'oidc_login_min_time_between_jwks_requests' => 10,
'oidc_login_well_known_caching_time' => 86400,
'oidc_login_update_avatar' => false,
'oidc_login_skip_proxy' => false,
'oidc_login_code_challenge_method' => '',
);