Skip to content

Commit 35c09c7

Browse files
Merge pull request #279 from openshift-bot/synchronize-upstream
NO-ISSUE: Synchronize From Upstream Repositories
2 parents 62db4c6 + 2c3dff1 commit 35c09c7

File tree

25 files changed

+740
-133
lines changed

25 files changed

+740
-133
lines changed

cmd/operator-controller/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import (
6565
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
6666
"github.com/operator-framework/operator-controller/internal/operator-controller/finalizers"
6767
"github.com/operator-framework/operator-controller/internal/operator-controller/resolve"
68+
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/convert"
6869
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/preflights/crdupgradesafety"
6970
"github.com/operator-framework/operator-controller/internal/operator-controller/scheme"
7071
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
@@ -407,8 +408,9 @@ func run() error {
407408
}
408409

409410
helmApplier := &applier.Helm{
410-
ActionClientGetter: acg,
411-
Preflights: preflights,
411+
ActionClientGetter: acg,
412+
Preflights: preflights,
413+
BundleToHelmChartFn: convert.RegistryV1ToHelmChart,
412414
}
413415

414416
cm := contentmanager.NewManager(clientRestConfigMapper, mgr.GetConfig(), mgr.GetRESTMapper())

commitchecker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
expectedMergeBase: 1573846c2525313a388666f54b7ca73097252893
1+
expectedMergeBase: a6de9f94e085989a086459f2b5325a5cd27424b0
22
upstreamBranch: main
33
upstreamOrg: operator-framework
44
upstreamRepo: operator-controller
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
## Description
2+
3+
!!! note
4+
This feature is still in *alpha* the `SingleOwnNamespaceInstallSupport` feature-gate must be enabled to make use of it.
5+
See the instructions below on how to enable it.
6+
7+
---
8+
9+
A component of OLMv0's multi-tenancy feature is its support of four [*installModes*](https://olm.operatorframework.io/docs/advanced-tasks/operator-scoping-with-operatorgroups/#targetnamespaces-and-their-relationship-to-installmodes):
10+
for operator installation:
11+
12+
- *OwnNamespace*: If supported, the operator can be configured to watch for events in the namespace it is deployed in.
13+
- *SingleNamespace*: If supported, the operator can be configured to watch for events in a single namespace that the operator is not deployed in.
14+
- *MultiNamespace*: If supported, the operator can be configured to watch for events in more than one namespace.
15+
- *AllNamespaces*: If supported, the operator can be configured to watch for events in all namespaces.
16+
17+
OLMv1 will not attempt multi-tenancy (see [design decisions document](../../project/olmv1_design_decisions.md)) and will think of operators
18+
as globally installed, i.e. in OLMv0 parlance, as installed in *AllNamespaces* mode. However, there are operators that
19+
were intended only for the *SingleNamespace* and *OwnNamespace* install modes. In order to make these operators installable in v1 while they
20+
transition to the new model, v1 is adding support for these two new *installModes*. It should be noted that, in line with v1's no multi-tenancy policy,
21+
users will not be able to install the same operator multiple times, and that in future iterations of the registry bundle format will not
22+
include *installModes*.
23+
24+
## Demos
25+
26+
### SingleNamespace Install
27+
28+
[![SingleNamespace Install Demo](https://asciinema.org/a/w1IW0xWi1S9cKQFb9jnR07mgh.svg)](https://asciinema.org/a/w1IW0xWi1S9cKQFb9jnR07mgh)
29+
30+
### OwnNamespace Install
31+
32+
[![OwnNamespace Install Demo](https://asciinema.org/a/Rxx6WUwAU016bXFDW74XLcM5i.svg)](https://asciinema.org/a/Rxx6WUwAU016bXFDW74XLcM5i)
33+
34+
## Enabling the Feature-Gate
35+
36+
!!! tip
37+
38+
This guide assumes OLMv1 is already installed. If that is not the case,
39+
you can follow the [getting started](../../getting-started/olmv1_getting_started.md) guide to install OLMv1.
40+
41+
---
42+
43+
Patch the `operator-controller` `Deployment` adding `--feature-gates=SingleOwnNamespaceInstallSupport=true` to the
44+
controller container arguments:
45+
46+
```terminal title="Enable SingleOwnNamespaceInstallSupport feature-gate"
47+
kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=SingleOwnNamespaceInstallSupport=true"}]'
48+
```
49+
50+
Wait for `Deployment` rollout:
51+
52+
```terminal title="Wait for Deployment rollout"
53+
kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
54+
```
55+
56+
## Configuring the `ClusterExtension`
57+
58+
A `ClusterExtension` can be configured to install bundle in `Single-` or `OwnNamespace` mode through the
59+
`olm.operatorframework.io/watch-namespace: <namespace>` annotation. The *installMode* is inferred in the following way:
60+
61+
- *AllNamespaces*: `<namespace>` is empty, or the annotation is not present
62+
- *OwnNamespace*: `<namespace>` is the install namespace (i.e. `.spec.namespace`)
63+
- *SingleNamespace*: `<namespace>` not the install namespace
64+
65+
### Examples
66+
67+
``` terminal title="SingleNamespace install mode example"
68+
kubectl apply -f - <<EOF
69+
apiVersion: olm.operatorframework.io/v1
70+
kind: ClusterExtension
71+
metadata:
72+
name: argocd
73+
annotations:
74+
olm.operatorframework.io/watch-namespace: argocd-watch
75+
spec:
76+
namespace: argocd
77+
serviceAccount:
78+
name: argocd-installer
79+
source:
80+
sourceType: Catalog
81+
catalog:
82+
packageName: argocd-operator
83+
version: 0.2.1 # Update to version 0.2.1
84+
EOF
85+
```
86+
87+
``` terminal title="OwnNamespace install mode example"
88+
kubectl apply -f - <<EOF
89+
apiVersion: olm.operatorframework.io/v1
90+
kind: ClusterExtension
91+
metadata:
92+
name: argocd
93+
annotations:
94+
olm.operatorframework.io/watch-namespace: argocd
95+
spec:
96+
namespace: argocd
97+
serviceAccount:
98+
name: argocd-installer
99+
source:
100+
sourceType: Catalog
101+
catalog:
102+
packageName: argocd-operator
103+
version: 0.2.1 # Update to version 0.2.1
104+
EOF
105+
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/BurntSushi/toml v1.4.0
88
github.com/Masterminds/semver/v3 v3.3.1
99
github.com/blang/semver/v4 v4.0.0
10-
github.com/containerd/containerd v1.7.25
10+
github.com/containerd/containerd v1.7.26
1111
github.com/containers/image/v5 v5.33.1
1212
github.com/fsnotify/fsnotify v1.8.0
1313
github.com/go-logr/logr v1.4.2
@@ -70,7 +70,7 @@ require (
7070
github.com/containerd/log v0.1.0 // indirect
7171
github.com/containerd/platforms v0.2.1 // indirect
7272
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
73-
github.com/containerd/ttrpc v1.2.5 // indirect
73+
github.com/containerd/ttrpc v1.2.7 // indirect
7474
github.com/containerd/typeurl/v2 v2.2.0 // indirect
7575
github.com/containers/common v0.61.0 // indirect
7676
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
8787
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
8888
github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0=
8989
github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0=
90-
github.com/containerd/containerd v1.7.25 h1:khEQOAXOEJalRO228yzVsuASLH42vT7DIo9Ss+9SMFQ=
91-
github.com/containerd/containerd v1.7.25/go.mod h1:tWfHzVI0azhw4CT2vaIjsb2CoV4LJ9PrMPaULAr21Ok=
90+
github.com/containerd/containerd v1.7.26 h1:3cs8K2RHlMQaPifLqgRyI4VBkoldNdEw62cb7qQga7k=
91+
github.com/containerd/containerd v1.7.26/go.mod h1:m4JU0E+h0ebbo9yXD7Hyt+sWnc8tChm7MudCjj4jRvQ=
9292
github.com/containerd/containerd/api v1.8.0 h1:hVTNJKR8fMc/2Tiw60ZRijntNMd1U+JVMyTRdsD2bS0=
9393
github.com/containerd/containerd/api v1.8.0/go.mod h1:dFv4lt6S20wTu/hMcP4350RL87qPWLVa/OHOwmmdnYc=
9494
github.com/containerd/continuity v0.4.4 h1:/fNVfTJ7wIl/YPMHjf+5H32uFhl63JucB34PlCpMKII=
@@ -103,8 +103,8 @@ github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpS
103103
github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw=
104104
github.com/containerd/stargz-snapshotter/estargz v0.16.3 h1:7evrXtoh1mSbGj/pfRccTampEyKpjpOnS3CyiV1Ebr8=
105105
github.com/containerd/stargz-snapshotter/estargz v0.16.3/go.mod h1:uyr4BfYfOj3G9WBVE8cOlQmXAbPN9VEQpBBeJIuOipU=
106-
github.com/containerd/ttrpc v1.2.5 h1:IFckT1EFQoFBMG4c3sMdT8EP3/aKfumK1msY+Ze4oLU=
107-
github.com/containerd/ttrpc v1.2.5/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
106+
github.com/containerd/ttrpc v1.2.7 h1:qIrroQvuOL9HQ1X6KHe2ohc7p+HP/0VE6XPU7elJRqQ=
107+
github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
108108
github.com/containerd/typeurl/v2 v2.2.0 h1:6NBDbQzr7I5LHgp34xAXYF5DOTQDn05X58lsPEmzLso=
109109
github.com/containerd/typeurl/v2 v2.2.0/go.mod h1:8XOOxnyatxSWuG8OfsZXVnAF4iZfedjS/8UHSPJnX4g=
110110
github.com/containers/common v0.61.0 h1:j/84PTqZIKKYy42OEJsZmjZ4g4Kq2ERuC3tqp2yWdh4=

hack/demo/generate-asciidemo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
trap cleanup SIGINT SIGTERM EXIT
44

55
SCRIPTPATH="$( cd -- "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
6+
export DEMO_RESOURCE_DIR="${SCRIPTPATH}/resources"
67

78
check_prereq() {
89
prog=$1
@@ -80,7 +81,6 @@ for prereq in "asciinema curl"; do
8081
check_prereq ${prereq}
8182
done
8283

83-
8484
curl https://raw.githubusercontent.com/zechris/asciinema-rec_script/main/bin/asciinema-rec_script -o ${WKDIR}/asciinema-rec_script
8585
chmod +x ${WKDIR}/asciinema-rec_script
8686
screencast=${WKDIR}/${DEMO_NAME}.cast ${WKDIR}/asciinema-rec_script ${SCRIPTPATH}/${DEMO_SCRIPT}

hack/demo/own-namespace-demo.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Welcome to the OwnNamespace install mode demo
5+
#
6+
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
7+
8+
# enable 'SingleOwnNamespaceInstallSupport' feature gate
9+
kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=SingleOwnNamespaceInstallSupport=true"}]'
10+
11+
# wait for operator-controller to become available
12+
kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
13+
14+
# create install namespace
15+
kubectl create ns argocd-system
16+
17+
# create installer service account
18+
kubectl create serviceaccount -n argocd-system argocd-installer
19+
20+
# give installer service account admin privileges (not for production environments)
21+
kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer
22+
23+
# install cluster extension in own namespace install mode (watch-namespace == install namespace == argocd-system)
24+
cat ${DEMO_RESOURCE_DIR}/own-namespace-demo.yaml
25+
26+
# apply cluster extension
27+
kubectl apply -f ${DEMO_RESOURCE_DIR}/own-namespace-demo.yaml
28+
29+
# wait for cluster extension installation to succeed
30+
kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s"
31+
32+
# check argocd-operator controller deployment pod template olm.targetNamespaces annotation
33+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.metadata.annotations.olm\.targetNamespaces}"
34+
35+
# check for argocd-operator rbac in watch namespace
36+
kubectl get roles,rolebindings -n argocd-system -o name
37+
38+
# get controller service-account name
39+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.spec.serviceAccount}"
40+
41+
# check service account for role binding is the same as controller service-account
42+
rolebinding=$(kubectl get rolebindings -n argocd-system -o name | grep 'argocd-operator' | head -n 1)
43+
kubectl get -n argocd-system $rolebinding -o jsonpath='{.subjects}' | jq .[0]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: olm.operatorframework.io/v1
2+
kind: ClusterExtension
3+
metadata:
4+
name: argocd-operator
5+
annotations:
6+
# watch namespace is the same as intall namespace
7+
olm.operatorframework.io/watch-namespace: argocd-system
8+
spec:
9+
namespace: argocd-system
10+
serviceAccount:
11+
name: argocd-installer
12+
source:
13+
sourceType: Catalog
14+
catalog:
15+
packageName: argocd-operator
16+
version: 0.6.0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: olm.operatorframework.io/v1
2+
kind: ClusterExtension
3+
metadata:
4+
name: argocd-operator
5+
annotations:
6+
# watch-namespace is different from install namespace
7+
olm.operatorframework.io/watch-namespace: argocd
8+
spec:
9+
namespace: argocd-system
10+
serviceAccount:
11+
name: argocd-installer
12+
source:
13+
sourceType: Catalog
14+
catalog:
15+
packageName: argocd-operator
16+
version: 0.6.0

hack/demo/single-own-namespace.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Welcome to the SingleNamespace install mode demo
5+
#
6+
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
7+
8+
# enable 'SingleOwnNamespaceInstallSupport' feature gate
9+
kubectl patch deployment -n olmv1-system operator-controller-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--feature-gates=SingleOwnNamespaceInstallSupport=true"}]'
10+
11+
# wait for operator-controller to become available
12+
kubectl rollout status -n olmv1-system deployment/operator-controller-controller-manager
13+
14+
# create install namespace
15+
kubectl create ns argocd-system
16+
17+
# create installer service account
18+
kubectl create serviceaccount -n argocd-system argocd-installer
19+
20+
# give installer service account admin privileges (not for production environments)
21+
kubectl create clusterrolebinding argocd-installer-crb --clusterrole=cluster-admin --serviceaccount=argocd-system:argocd-installer
22+
23+
# create watch namespace
24+
kubectl create namespace argocd
25+
26+
# install cluster extension in single namespace install mode (watch namespace != install namespace)
27+
cat ${DEMO_RESOURCE_DIR}/single-namespace-demo.yaml
28+
29+
# apply cluster extension
30+
kubectl apply -f ${DEMO_RESOURCE_DIR}/single-namespace-demo.yaml
31+
32+
# wait for cluster extension installation to succeed
33+
kubectl wait --for=condition=Installed clusterextension/argocd-operator --timeout="60s"
34+
35+
# check argocd-operator controller deployment pod template olm.targetNamespaces annotation
36+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.metadata.annotations.olm\.targetNamespaces}"
37+
38+
# check for argocd-operator rbac in watch namespace
39+
kubectl get roles,rolebindings -n argocd -o name
40+
41+
# get controller service-account name
42+
kubectl get deployments -n argocd-system argocd-operator-controller-manager -o jsonpath="{.spec.template.spec.serviceAccount}"
43+
44+
# check service account for role binding is the controller deployment service account
45+
rolebinding=$(kubectl get rolebindings -n argocd -o name | grep 'argocd-operator' | head -n 1)
46+
kubectl get -n argocd $rolebinding -o jsonpath='{.subjects}' | jq .[0]

0 commit comments

Comments
 (0)