You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@
26
26
27
27
- The SDK will no longer run `defaulter-gen` on running `operator-sdk generate k8s`. Defaulting for CRDs should be handled with mutating admission webhooks. ([#1288](https://github.com/operator-framework/operator-sdk/pull/1288))
28
28
-**Breaking Change**: The `test cluster` subcommand and the corresponding `--enable-tests` flag for the `build` subcommand have been removed ([#1414](https://github.com/operator-framework/operator-sdk/pull/1414))
29
+
-**Breaking Change**: The `--cluster-scoped` flag for `operator-sdk new` has been removed so it won't scaffold a cluster-scoped operator. Read the [operator scope](https://github.com/operator-framework/operator-sdk/blob/master/doc/operator-scope.md) documentation on the changes needed to run a cluster-scoped operator. ([#1434](https://github.com/operator-framework/operator-sdk/pull/1434))
Copy file name to clipboardexpand all lines: doc/ansible/user-guide.md
+2-14
Original file line number
Diff line number
Diff line change
@@ -39,20 +39,7 @@ layout][layout_doc] doc.
39
39
40
40
#### Operator scope
41
41
42
-
A namespace-scoped operator (the default) watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. Namespace-scoped operators are preferred because of their flexibility. They enable decoupled upgrades, namespace isolation for failures and monitoring, and differing API definitions. However, there are use cases where a cluster-scoped operator may make sense. For example, the [cert-manager](https://github.com/jetstack/cert-manager) operator is often deployed with cluster-scoped permissions and watches so that it can manage issuing certificates for an entire cluster.
43
-
44
-
If you'd like to create your memcached-operator project to be cluster-scoped use the following `operator-sdk new` command instead:
45
-
```
46
-
$ operator-sdk new memcached-operator --cluster-scoped --api-version=cache.example.com/v1alpha1 --kind=Memcached --type=ansible
47
-
```
48
-
49
-
Using `--cluster-scoped` will scaffold the new operator with the following modifications:
50
-
*`deploy/operator.yaml` - Set `WATCH_NAMESPACE=""` instead of setting it to the pod's namespace
51
-
*`deploy/role.yaml` - Use `ClusterRole` instead of `Role`
52
-
*`deploy/role_binding.yaml`:
53
-
* Use `ClusterRoleBinding` instead of `RoleBinding`
54
-
* Use `ClusterRole` instead of `Role` for roleRef
55
-
* Set the subject namespace to `REPLACE_NAMESPACE`. This must be changed to the namespace in which the operator is deployed.
42
+
Read the [operator scope][operator_scope] documentation on how to run your operator as namespace-scoped vs cluster-scoped.
Copy file name to clipboardexpand all lines: doc/helm/user-guide.md
+2-14
Original file line number
Diff line number
Diff line change
@@ -66,21 +66,8 @@ If `--helm-chart-version` is not set, the SDK will fetch the latest available ve
66
66
67
67
### Operator scope
68
68
69
-
A namespace-scoped operator (the default) watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. Namespace-scoped operators are preferred because of their flexibility. They enable decoupled upgrades, namespace isolation for failures and monitoring, and differing API definitions. However, there are use cases where a cluster-scoped operator may make sense. For example, the [cert-manager](https://github.com/jetstack/cert-manager) operator is often deployed with cluster-scoped permissions and watches so that it can manage issuing certificates for an entire cluster.
69
+
Read the [operator scope][operator_scope] documentation on how to run your operator as namespace-scoped vs cluster-scoped.
70
70
71
-
If you'd like to create your nginx-operator project to be cluster-scoped use the following `operator-sdk new` command instead:
72
-
73
-
```sh
74
-
operator-sdk new nginx-operator --cluster-scoped --api-version=example.com/v1alpha1 --kind=Nginx --type=helm
75
-
```
76
-
77
-
Using `--cluster-scoped` will scaffold the new operator with the following modifications:
78
-
*`deploy/operator.yaml` - Set `WATCH_NAMESPACE=""` instead of setting it to the pod's namespace
79
-
*`deploy/role.yaml` - Use `ClusterRole` instead of `Role`
80
-
*`deploy/role_binding.yaml`:
81
-
* Use `ClusterRoleBinding` instead of `RoleBinding`
82
-
* Use `ClusterRole` instead of `Role` for roleRef
83
-
* Set the subject namespace to `REPLACE_NAMESPACE`. This must be changed to the namespace in which the operator is deployed.
A namespace-scoped operator watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. Namespace-scoped operators are preferred because of their flexibility. They enable decoupled upgrades, namespace isolation for failures and monitoring, and differing API definitions.
4
+
5
+
However, there are use cases where a cluster-scoped operator may make sense. For example, the [cert-manager](https://github.com/jetstack/cert-manager) operator is often deployed with cluster-scoped permissions and watches so that it can manage issuing certificates for an entire cluster.
6
+
7
+
The SDK scaffolds operators to be namespaced by default but with a few modifications to the default manifests the operator can be run as cluster-scoped.
8
+
9
+
*`deploy/operator.yaml`:
10
+
* Set `WATCH_NAMESPACE=""` to watch all namespaces instead of setting it to the pod's namespace
11
+
*`deploy/role.yaml`:
12
+
* Use `ClusterRole` instead of `Role`
13
+
*`deploy/role_binding.yaml`:
14
+
* Use `ClusterRoleBinding` instead of `RoleBinding`
15
+
* Use `ClusterRole` instead of `Role` for `roleRef`
16
+
* Set the subject namespace to the namespace in which the operator is deployed.
17
+
18
+
### CRD scope
19
+
20
+
Additionally the CustomResourceDefinition (CRD) scope can also be changed for cluster-scoped operators so that there is only a single instance (for a given name) of the CRD to manage across the cluster.
21
+
22
+
For each CRD that needs to be cluster-scoped, update its manifest to be cluster-scoped.
Copy file name to clipboardexpand all lines: doc/user-guide.md
+2-15
Original file line number
Diff line number
Diff line change
@@ -57,20 +57,7 @@ The Operator SDK uses [vendoring][go_vendoring] to supply dependencies to operat
57
57
58
58
#### Operator scope
59
59
60
-
A namespace-scoped operator (the default) watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. Namespace-scoped operators are preferred because of their flexibility. They enable decoupled upgrades, namespace isolation for failures and monitoring, and differing API definitions. However, there are use cases where a cluster-scoped operator may make sense. For example, the [cert-manager](https://github.com/jetstack/cert-manager) operator is often deployed with cluster-scoped permissions and watches so that it can manage issuing certificates for an entire cluster.
61
-
62
-
If you'd like to create your memcached-operator project to be cluster-scoped use the following `operator-sdk new` command instead:
63
-
```sh
64
-
$ operator-sdk new memcached-operator --cluster-scoped
65
-
```
66
-
67
-
Using `--cluster-scoped` will scaffold the new operator with the following modifications:
68
-
*`deploy/operator.yaml` - Set `WATCH_NAMESPACE=""` instead of setting it to the pod's namespace
69
-
*`deploy/role.yaml` - Use `ClusterRole` instead of `Role`
70
-
*`deploy/role_binding.yaml`:
71
-
* Use `ClusterRoleBinding` instead of `RoleBinding`
72
-
* Use `ClusterRole` instead of `Role` for roleRef
73
-
* Set the subject namespace to `REPLACE_NAMESPACE`. This must be changed to the namespace in which the operator is deployed.
60
+
Read the [operator scope][operator_scope] documentation on how to run your operator as namespace-scoped vs cluster-scoped.
74
61
75
62
### Manager
76
63
The main program for the operator `cmd/manager/main.go` initializes and runs the [Manager][manager_go_doc].
@@ -557,7 +544,7 @@ func main() {
557
544
558
545
When the operator is not running in a cluster, the Manager will return an error on starting since it can't detect the operator's namespace in order to create the configmap for leader election. You can override this namespace by setting the Manager's `LeaderElectionNamespace` option.
0 commit comments