nextcloud / nextcloud/helm

Feature: add HARP/ExApps support

Open
#776 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go Template
Stars
534
Forks
314
Avg merge
42m
Merged PRs (30d)
1

Description

Description of the change

I tried to add a StatefulSet with HARP to run exapps on kubernetes.
My tests were successful.

StatefulSet code:

apiVersion: v1
kind: ConfigMap
metadata:
  name: docker-daemon-config
data:
  daemon.json: |
    {
      "memory": "512m"
    }
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: clouduvet
  name: clouduvet-harp
spec:
  serviceName: harp
  replicas: 1
  selector:
    matchLabels:
      app: clouduvet
  template:
    metadata:
      labels:
        app: clouduvet
    spec:
      volumes:
        - name: docker-config
          configMap:
            name: docker-daemon-config
      restartPolicy: Always
      securityContext:
        fsGroup: 1000
      containers:
        - name: appapi-harp
          image: ghcr.io/nextcloud/nextcloud-appapi-harp:release
          imagePullPolicy: Always
          env:
            - name: DOCKER_HOST
              value: unix:///run/user/1000/docker.sock
            - name: HP_SHARED_KEY
              valueFrom:
                secretKeyRef:
                  name: harp-shared-key
                  key: shared-key
            - name: NC_INSTANCE_URL
              value: "http://nextcloud.nextcloud.svc.cluster.local"
          resources:
            requests:
              cpu: "250m"
              memory: "512Mi"
            limits:
              cpu: "250m"
              memory: "512Mi"
          #securityContext:
          #  privileged: true
#---
#apiVersion: v1
#kind: Pod
#metadata:
#  name: appapi-harp
#  labels:
#    app: appapi-harp
#spec:
#  restartPolicy: Always
#  hostNetwork: false
#  containers:
#    - name: appapi-harp
#      image: ghcr.io/nextcloud/nextcloud-appapi-harp:release
#      imagePullPolicy: IfNotPresent
#      env:
#        - name: HP_SHARED_KEY
#          valueFrom:
#            secretKeyRef:
#              name: harp-shared-key
#              key: shared-key
#        - name: NC_INSTANCE_URL
#          value: "http://nextcloud.nextcloud.svc.cluster.local"
#      ports:
#        - containerPort: 8780
#        - containerPort: 8782
#      volumeMounts:
#        - name: docker-sock
#          mountPath: /var/run/docker.sock
#        - name: certs
#          mountPath: /certs
#  volumes:
#    - name: docker-sock
#      hostPath:
#        path: /var/run/docker.sock
#        type: Socket
#    - name: certs
#      hostPath:
#        path: /absolute/path/to/certs  # Change to absolute path on host
#        type: Directory

It allowed me to expose a docker rootless using harp. I put that here mostly so others may be able to reference it, feel free to use it :)
You also need to change the service and the ingress.

Benefits

ExApps support.

Possible drawbacks

The StatefulState approach is losely based on what I've done for gitlab runners on my cluster, it might not be the best approach.
I cannot guarantee that the manifest I provided can be used across every clusters.

Additional information

I am willing to create a pull request for this change. However, I'd appreciate some guidance on how to expose the docker socket of the host node in a manner that is compatible with a maximum of setups.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reviewing the existing Helm service and ingress templates and the chart's Kubernetes configuration, then compare the proposed StatefulSet and Docker rootless/socket exposure across supported setups. Done means ExApps can be deployed with working service and ingress configuration without relying on one cluster-specific manifest.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, helm, kubernetes
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.