5 min read #OpenCloud#Tech

OpenCloud · OpenShift

OpenCloud on OpenShift under restricted-v2

If you run OpenShift, new applications either run under the default `restricted-v2` constraint or need a justified exception. Since 9.0.0, the OpenCloud Helm chart works within this constraint: the platform assigns user and group IDs, and no additional Security Context Constraint is needed. A test environment replicates OpenShift's rules and checks on every chart change that OpenCloud is admitted and that violations are rejected.

In large companies and public agencies, the team that needs a new application often doesn't decide where it runs. The existing platform does, and that platform is often OpenShift. A platform team operates the clusters, has set rules for all workloads and agreed them with information security. Every new application has to fit these rules. If it requires a fixed user ID, root privileges or extra Linux capabilities, it needs an exception: a request, a justification, an approval and documentation that comes back up in every audit. An installation turns into an approval process.

A file platform meant to run on your own servers must not create that overhead. If you run OpenCloud yourself, you want to keep control of your data without more work than a cloud service would cause. Part of that is OpenCloud adapting to the platform, and not the other way around.

Security Context Constraints and restricted-v2

OpenShift admits pods through Security Context Constraints (SCCs). Ordinary workloads fall under restricted-v2, the strictest of the bundled SCCs. It forbids a process from escalating its privileges, drops all Linux capabilities, and requires a non-root user and the RuntimeDefault seccomp profile. That largely matches the Kubernetes restricted Pod Security Standard.

One difference trips up many Helm charts: on OpenShift, every namespace has a range of user IDs, and the platform assigns each pod its UID and fsGroup from that range. If a pod requests an ID outside the range, such as the common 1000, it is rejected. Admitted pods run with a UID that doesn't even exist in the image, and with group 0. Software that expects a specific user fails. The platform team can then only grant it a more permissive SCC such as anyuid, and that is exactly the exception everyone wants to avoid.

New values in the Helm chart

Until now the security settings were hard-coded in the chart's templates, including fsGroup: 1000 for all pods. Since the change, they live in two values: podSecurityContext for the pod and containerSecurityContext for the containers. The defaults meet the restricted Pod Security Standard, so OpenCloud also runs in Kubernetes namespaces that enforce it. containerSecurityContext deliberately sets no UID, because the OpenCloud image already ships with a numeric non-root user.

For OpenShift, you set podSecurityContext to null. An empty {} is not enough, because Helm merges values and would keep the fsGroup from the defaults. Some containers use images that start as root or specify their user only by name: the collaborative editing server (yjs), the init container for a custom theme, the init containers that wait for the NATS streams, and the pod for helm test. By default these containers set a UID. For OpenShift it is removed with null, so the platform assigns it. The chart includes the required settings as an example file that you pass to helm install after your own values.

After that, all OpenCloud pods run under restricted-v2. The chart ships no SCC of its own, and the platform team doesn't have to grant one. You can verify this with the pods' openshift.io/scc annotation.

CI tests against a replicated OpenShift

The release notes cite customer feedback as the reason for the change. To keep compatibility intact through future changes, the chart's test suite checks it on every pull request and on the main branch. It installs OpenCloud in a lightweight Kubernetes cluster (k3d) that replicates the rules of restricted-v2. The namespace enforces the restricted Pod Security Standard. A ValidatingAdmissionPolicy covers the part Kubernetes doesn't know about: it rejects any runAsUser and any fsGroup outside a fixed range, for pods as well as for Deployments, StatefulSets, Jobs and CronJobs. The OpenCloud pods get a UID from this range, just as OpenShift would assign one.

The checks run in both directions. All pods must run with the assigned UID, and the id command inside the containers must confirm it. Then the web interface's end-to-end tests run against the installation. A test pod that follows all rules must be admitted. Four others must be rejected, and for the expected reason: one with a foreign UID at pod level, one with a foreign UID in the container, one with a foreign fsGroup, and one that doesn't disable privilege escalation. The admitted pod makes sure the rejections don't come from a rule that denies everything. Migration jobs, the theme container and the helm test pod, which a fresh install doesn't create, go through the same check in a server-side dry run.

Limitations

The replica is not OpenShift. It doesn't cover the selection and priority of multiple SCCs, SELinux labels or Routes. The chart creates Ingress objects, from which OpenShift generates Routes itself. After installation, check that the Route and TLS termination look as expected.

What has been adapted is OpenCloud itself. Services OpenCloud depends on, such as Keycloak, PostgreSQL, NATS or OpenSearch, you run on OpenShift with the operators and charts the platform provides for them. The experimental LeilFS mount needs a privileged container and doesn't belong on OpenShift.

According to the feature overview in the documentation, running on Kubernetes, OpenShift included, is part of the Professional and Premium subscriptions.

Sources