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

fix: add roles to redis-ha service accounts to enable run-as non-root users in OpenShift #4800

Merged
merged 4 commits into from
Nov 10, 2020
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
36 changes: 18 additions & 18 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"AccountService"
],
"summary": "CreateToken creates a token",
"operationId": "CreateTokenMixin10",
"operationId": "CreateTokenMixin7",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -157,7 +157,7 @@
"AccountService"
],
"summary": "DeleteToken deletes a token",
"operationId": "DeleteTokenMixin10",
"operationId": "DeleteTokenMixin7",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -188,7 +188,7 @@
"ApplicationService"
],
"summary": "List returns list of applications",
"operationId": "List",
"operationId": "ListMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -239,7 +239,7 @@
"ApplicationService"
],
"summary": "Create creates an application",
"operationId": "Create",
"operationId": "CreateMixin10",
"parameters": [
{
"name": "body",
Expand All @@ -266,7 +266,7 @@
"ApplicationService"
],
"summary": "Update updates an application",
"operationId": "Update",
"operationId": "UpdateMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -400,7 +400,7 @@
"ApplicationService"
],
"summary": "Get returns an application by name",
"operationId": "GetMixin1",
"operationId": "GetMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -452,7 +452,7 @@
"ApplicationService"
],
"summary": "Delete deletes an application",
"operationId": "Delete",
"operationId": "DeleteMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"ClusterService"
],
"summary": "List returns list of clusters",
"operationId": "ListMixin5",
"operationId": "ListMixin1",
"parameters": [
{
"type": "string",
Expand All @@ -1189,7 +1189,7 @@
"ClusterService"
],
"summary": "Create creates a cluster",
"operationId": "CreateMixin5",
"operationId": "CreateMixin1",
"parameters": [
{
"name": "body",
Expand All @@ -1216,7 +1216,7 @@
"ClusterService"
],
"summary": "Update updates a cluster",
"operationId": "UpdateMixin5",
"operationId": "Update",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1250,7 +1250,7 @@
"ClusterService"
],
"summary": "Get returns a cluster by server address",
"operationId": "GetMixin5",
"operationId": "GetMixin1",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1278,7 +1278,7 @@
"ClusterService"
],
"summary": "Delete deletes a cluster",
"operationId": "DeleteMixin5",
"operationId": "DeleteMixin1",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1358,7 +1358,7 @@
"GPGKeyService"
],
"summary": "List all available repository certificates",
"operationId": "ListMixin2",
"operationId": "List",
"parameters": [
{
"type": "string",
Expand All @@ -1381,7 +1381,7 @@
"GPGKeyService"
],
"summary": "Create one or more GPG public keys in the server's configuration",
"operationId": "CreateMixin2",
"operationId": "Create",
"parameters": [
{
"description": "Raw key data of the GPG key(s) to create",
Expand All @@ -1407,7 +1407,7 @@
"GPGKeyService"
],
"summary": "Delete specified GPG public key from the server's configuration",
"operationId": "DeleteMixin2",
"operationId": "Delete",
"parameters": [
{
"type": "string",
Expand All @@ -1432,7 +1432,7 @@
"GPGKeyService"
],
"summary": "Get information about specified GPG public key from the server",
"operationId": "GetMixin2",
"operationId": "Get",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1948,7 +1948,7 @@
"RepositoryService"
],
"summary": "Get returns a repository or its credentials",
"operationId": "Get",
"operationId": "GetMixin2",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -2235,7 +2235,7 @@
"SettingsService"
],
"summary": "Get returns Argo CD settings",
"operationId": "GetMixin8",
"operationId": "GetMixin4",
"responses": {
"200": {
"description": "A successful response.",
Expand Down
7 changes: 0 additions & 7 deletions docs/operator-manual/high_availability.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ A set HA of manifests are provided for users who wish to run Argo CD in a highly

!!! note
The HA installation will require at least three different nodes due to pod anti-affinity roles in the specs.


In OpenShift clusters, `argocd-redis-ha` service accounts need to be granted `nonroot` Security Context Constraints (SCC) by running the following OpenShift commands which allow Redis containers to run as non-root users.
```shell
$ oc adm policy add-scc-to-user nonroot -z argocd-redis-ha
$ oc adm policy add-scc-to-user nonroot -z argocd-redis-ha-haproxy
```

## Scaling Up

Expand Down
6 changes: 4 additions & 2 deletions manifests/ha/base/redis-ha/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Redis HA Manifests

The Redis HA manifests are taken from the upstream helm chart, and tweaked slightly to add
Argo CD labels.
Argo CD labels. We also add roles to redis-ha service accounts to enable run-as non-root users
in OpenShift.
* `chart` is a helm chart that references the upstream redis-ha chart. To update redis, update the
version in `chart/requirements.yaml` with a later version of the chart.
* `overlays` is a directory containing kustomize overlays for Argo CD, namely label modifications
* `overlays` is a directory containing kustomize overlays for Argo CD, namely label modifications and
role additions.
* `generate.sh` is a script to regenerate the final kustomize
15 changes: 15 additions & 0 deletions manifests/ha/base/redis-ha/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Kustomization

resources:
- chart/upstream.yaml
- overlays/redis-haproxy.yaml

patchesJson6902:
- target:
Expand Down Expand Up @@ -33,6 +34,20 @@ patchesJson6902:
name: argocd-redis-ha
namespace: argocd
path: overlays/remove-namespace.yaml
- target:
group: rbac.authorization.k8s.io
version: v1
kind: Role
name: argocd-redis-ha
namespace: argocd
path: overlays/add-openshift-nonroot-scc.yaml
- target:
group: rbac.authorization.k8s.io
version: v1
kind: Role
name: argocd-redis-haproxy
namespace: argocd
path: overlays/add-openshift-nonroot-scc.yaml
- target:
group: rbac.authorization.k8s.io
version: v1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- op: add
path: /rules/-
value:
apiGroups:
- security.openshift.io
resourceNames:
- nonroot
resources:
- securitycontextconstraints
verbs:
- use
28 changes: 28 additions & 0 deletions manifests/ha/base/redis-ha/overlays/redis-haproxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
rules: []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-redis-haproxy
subjects:
- kind: ServiceAccount
name: argocd-redis-haproxy

44 changes: 44 additions & 0 deletions manifests/ha/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,25 @@ metadata:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- nonroot
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: application-controller
Expand Down Expand Up @@ -2045,6 +2064,14 @@ rules:
- endpoints
verbs:
- get
- apiGroups:
- security.openshift.io
resourceNames:
- nonroot
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down Expand Up @@ -2142,6 +2169,23 @@ rules:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-redis-haproxy
subjects:
- kind: ServiceAccount
name: argocd-redis-haproxy
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: application-controller
Expand Down
44 changes: 44 additions & 0 deletions manifests/ha/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,25 @@ metadata:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- nonroot
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: application-controller
Expand Down Expand Up @@ -2045,6 +2064,14 @@ rules:
- endpoints
verbs:
- get
- apiGroups:
- security.openshift.io
resourceNames:
- nonroot
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down Expand Up @@ -2091,6 +2118,23 @@ rules:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: redis
app.kubernetes.io/name: argocd-redis-haproxy
app.kubernetes.io/part-of: argocd
name: argocd-redis-haproxy
namespace: argocd
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-redis-haproxy
subjects:
- kind: ServiceAccount
name: argocd-redis-haproxy
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: application-controller
Expand Down