Skip to content

Commit 14bbab4

Browse files
Merge pull request #53795 from michaelryanpeter/osdocs-4624-olm-4.12-catalog-source-psa
OSDOCS-4624: [OLM][4.12] Document PSA changes to the CatalogSource
2 parents 65e53ec + 1f7e3a9 commit 14bbab4

12 files changed

+220
-23
lines changed

modules/olm-accessing-images-private-registries.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ spec:
128128
secrets: <1>
129129
- "<secret_name_1>"
130130
- "<secret_name_2>"
131+
grpcPodConfig:
132+
securityContextConfig: <security_mode> <2>
131133
image: <registry>:<port>/<namespace>/<image>:<tag>
132134
displayName: My Operator Catalog
133135
publisher: <publisher_name>
@@ -136,6 +138,7 @@ spec:
136138
interval: 30m
137139
----
138140
<1> Add a `spec.secrets` section and specify any required secrets.
141+
<2> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
139142

140143
. If any Operator or Operand images that are referenced by a subscribed Operator require access to a private registry, you can either provide access to all namespaces in the cluster, or individual target tenant namespaces.
141144

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/admin/olm-managing-custom-catalogs.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="olm-catalog-sources-and-psa_{context}"]
7+
= Catalog sources and pod security admission
8+
9+
_Pod security admission_ was introduced in {product-title} 4.11 to ensure pod security standards. Catalog sources built using the SQLite-based catalog format and a version of the `opm` CLI tool released before {product-title} 4.11 cannot run under restricted pod security enforcement.
10+
11+
In {product-title} {product-version}, namespaces do not have restricted pod security enforcement by default and the default catalog source security mode is set to `legacy`.
12+
13+
Default restricted enforcement for all namespaces is planned for inclusion in a future {product-title} release. When restricted enforcement occurs, the security context of the pod specification for catalog source pods must match the restricted pod security standard. If your catalog source image requires a different pod security standard, the pod security admissions label for the namespace must be explicitly set.
14+
15+
[NOTE]
16+
====
17+
If you do not want to run your SQLite-based catalog source pods as restricted, you do not need to update your catalog source in {product-title} {product-version}.
18+
19+
However, it is recommended that you take action now to ensure your catalog sources run under restricted pod security enforcement. If you do not take action to ensure your catalog sources run under restricted pod security enforcement, your catalog sources might not run in future {product-title} releases.
20+
====
21+
22+
As a catalog author, you can enable compatibility with restricted pod security enforcement by completing either of the following actions:
23+
24+
* Migrate your catalog to the file-based catalog format.
25+
* Update your catalog image with a version of the `opm` CLI tool released with {product-title} 4.11 or later.
26+
27+
[NOTE]
28+
====
29+
The SQLite database catalog format is deprecated, but still supported by Red Hat. In a future release, the SQLite database format will not be supported, and catalogs will need to migrate to the file-based catalog format. As of {product-title} 4.11, the default Red Hat-provided Operator catalog is released in the file-based catalog format. File-based catalogs are compatible with restricted pod security enforcement.
30+
====
31+
32+
If you do not want to update your SQLite database catalog image or migrate your catalog to the file-based catalog format, you can configure your catalog to run with elevated permissions.

modules/olm-catalogsource.adoc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ spec:
4141
priority: -400 <6>
4242
publisher: Example Org
4343
sourceType: grpc <7>
44+
grpcPodConfig:
45+
securityContextConfig: <security_mode> <8>
4446
updateStrategy:
45-
registryPoll: <8>
47+
registryPoll: <9>
4648
interval: 30m0s
4749
status:
4850
connectionState:
4951
address: example-catalog.{global_ns}.svc:50051
5052
lastConnect: 2021-08-26T18:14:31Z
51-
lastObservedState: READY <9>
52-
latestImageRegistryPoll: 2021-08-26T18:46:25Z <10>
53-
registryService: <11>
53+
lastObservedState: READY <10>
54+
latestImageRegistryPoll: 2021-08-26T18:46:25Z <11>
55+
registryService: <12>
5456
createdAt: 2021-08-26T16:16:37Z
5557
port: 50051
5658
protocol: grpc
@@ -72,8 +74,9 @@ Set the `olm.catalogImageTemplate` annotation to your index image name and use o
7274
* `grpc` with an `address` field: OLM attempts to contact the gRPC API at the given address. This should not be used in most cases.
7375
* `configmap`: OLM parses config map data and runs a pod that can serve the gRPC API over it.
7476
--
75-
<8> Automatically check for new versions at a given interval to stay up-to-date.
76-
<9> Last observed state of the catalog connection. For example:
77+
<8> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
78+
<9> Automatically check for new versions at a given interval to stay up-to-date.
79+
<10> Last observed state of the catalog connection. For example:
7780
+
7881
--
7982
* `READY`: A connection is successfully established.
@@ -82,8 +85,8 @@ Set the `olm.catalogImageTemplate` annotation to your index image name and use o
8285
--
8386
+
8487
See link:https://grpc.github.io/grpc/core/md_doc_connectivity-semantics-and-api.html[States of Connectivity] in the gRPC documentation for more details.
85-
<10> Latest time the container registry storing the catalog image was polled to ensure the image is up-to-date.
86-
<11> Status information for the catalog's Operator Registry service.
88+
<11> Latest time the container registry storing the catalog image was polled to ensure the image is up-to-date.
89+
<12> Status information for the catalog's Operator Registry service.
8790
====
8891

8992
Referencing the `name` of a `CatalogSource` object in a subscription instructs OLM where to search to find a requested Operator:

modules/olm-creating-catalog-from-index.adoc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,21 @@ metadata:
5050
namespace: {namespace} <2>
5151
spec:
5252
sourceType: grpc
53-
image: <registry>/<namespace>/{index-image}:{tag} <3>
53+
grpcPodConfig:
54+
securityContextConfig: <security_mode> <3>
55+
image: <registry>/<namespace>/{index-image}:{tag} <4>
5456
displayName: My Operator Catalog
55-
publisher: <publisher_name> <4>
57+
publisher: <publisher_name> <5>
5658
updateStrategy:
57-
registryPoll: <5>
59+
registryPoll: <6>
5860
interval: 30m
5961
----
6062
<1> If you mirrored content to local files before uploading to a registry, remove any backslash (`/`) characters from the `metadata.name` field to avoid an "invalid resource name" error when you create the object.
6163
<2> If you want the catalog source to be available globally to users in all namespaces, specify the `{namespace}` namespace. Otherwise, you can specify a different namespace for the catalog to be scoped and available only for that namespace.
62-
<3> Specify your index image.
63-
<4> Specify your name or an organization name publishing the catalog.
64-
<5> Catalog sources can automatically check for new versions to keep up to date.
64+
<3> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
65+
<4> Specify your index image.
66+
<5> Specify your name or an organization name publishing the catalog.
67+
<6> Catalog sources can automatically check for new versions to keep up to date.
6568
endif::[]
6669
ifndef::olm-restricted-networks[]
6770
[source,yaml,subs="attributes+"]
@@ -76,18 +79,21 @@ metadata:
7679
"<registry>/<namespace>/<index_image_name>:v{kube_major_version}.{kube_minor_version}.{kube_patch_version}"
7780
spec:
7881
sourceType: grpc
79-
image: <registry>/<namespace>/<index_image_name>:<tag> <3>
82+
grpcPodConfig:
83+
securityContextConfig: <security_mode> <3>
84+
image: <registry>/<namespace>/<index_image_name>:<tag> <4>
8085
displayName: My Operator Catalog
81-
publisher: <publisher_name> <4>
86+
publisher: <publisher_name> <5>
8287
updateStrategy:
83-
registryPoll: <5>
88+
registryPoll: <6>
8489
interval: 30m
8590
----
8691
<1> If you want the catalog source to be available globally to users in all namespaces, specify the `{namespace}` namespace. Otherwise, you can specify a different namespace for the catalog to be scoped and available only for that namespace.
8792
<2> Optional: Set the `olm.catalogImageTemplate` annotation to your index image name and use one or more of the Kubernetes cluster version variables as shown when constructing the template for the image tag.
88-
<3> Specify your index image.
89-
<4> Specify your name or an organization name publishing the catalog.
90-
<5> Catalog sources can automatically check for new versions to keep up to date.
93+
<3> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
94+
<4> Specify your index image.
95+
<5> Specify your name or an organization name publishing the catalog.
96+
<6> Catalog sources can automatically check for new versions to keep up to date.
9197
endif::[]
9298

9399
.. Use the file to create the `CatalogSource` object:

modules/olm-dependency-resolution-preferences.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ metadata:
2222
namespace: "operators"
2323
spec:
2424
sourceType: grpc
25+
grpcPodConfig:
26+
securityContextConfig: <security_mode> <1>
2527
image: example.com/my/operator-index:v1
2628
displayName: "My Operators"
2729
priority: 100
2830
----
31+
<1> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
2932

3033
A `CatalogSource` object has a `priority` field, which is used by the resolver to know how to prefer options for a dependency.
3134

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/admin/olm-managing-custom-catalogs.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="olm-migrating-sqlite-catalog-to-fbc_{context}"]
7+
= Migrating SQLite database catalogs to the file-based catalog format
8+
9+
You can update your deprecated SQLite database format catalogs to the file-based catalog format.
10+
11+
.Prerequisites
12+
13+
* SQLite database catalog source
14+
* Cluster administrator permissions
15+
* Latest version of the `opm` CLI tool released with {product-title} {product-version} on workstation
16+
17+
.Procedure
18+
19+
. Migrate your SQLite database catalog to a file-based catalog by running the following command:
20+
+
21+
[source,terminal]
22+
----
23+
$ opm migrate <registry_image> <fbc_directory>
24+
----
25+
26+
. Generate a Dockerfile for your file-based catalog by running the following command:
27+
+
28+
[source,terminal,subs="attributes+"]
29+
----
30+
$ opm generate dockerfile <fbc_directory> \
31+
--binary-image \
32+
registry.redhat.io/openshift4/ose-operator-registry:v{product-version}
33+
----
34+
35+
.Next steps
36+
37+
* The generated Dockerfile can be built, tagged, and pushed to your registry.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/admin/olm-managing-custom-catalogs.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="olm-sqlite-catalog-elevated-privileges_{context}"]
7+
= Configuring catalogs to run with elevated permissions
8+
9+
If you do not want to update your SQLite database catalog image or migrate your catalog to the file-based catalog format, you can perform the following actions to ensure your catalog source runs when the default pod security enforcement changes to restricted:
10+
11+
* Manually set the catalog security mode to legacy in your catalog source definition. This action ensures your catalog runs with legacy permissions even if the default catalog security mode changes to restricted.
12+
* Label the catalog source namespace for baseline or privileged pod security enforcement.
13+
14+
[NOTE]
15+
====
16+
The SQLite database catalog format is deprecated, but still supported by Red Hat. In a future release, the SQLite database format will not be supported, and catalogs will need to migrate to the file-based catalog format. File-based catalogs are compatible with restricted pod security enforcement.
17+
====
18+
19+
.Prerequisites
20+
21+
* SQLite database catalog source
22+
* Cluster administrator permissions
23+
* Target namespace that supports running pods with the elevated pod security admission standard of `baseline` or `privileged`
24+
25+
.Procedure
26+
27+
. Edit the `CatalogSource` definition by setting the `spec.grpcPodConfig.securityContextConfig` label to `legacy`, as shown in the following example:
28+
+
29+
.Example `CatalogSource` definition
30+
[source,yaml]
31+
----
32+
apiVersion: operators.coreos.com/v1alpha1
33+
kind: CatalogSource
34+
metadata:
35+
name: my-catsrc
36+
namespace: my-ns
37+
spec:
38+
sourceType: grpc
39+
grpcPodConfig:
40+
securityContextConfig: legacy
41+
image: my-image:latest
42+
----
43+
+
44+
[TIP]
45+
====
46+
In {product-title} {product-version}, the `spec.grpcPodConfig.securityContextConfig` field is set to `legacy` by default. In a future release of {product-title}, it is planned that the default setting will change to `restricted`. If your catalog cannot run under restricted enforcement, it is recommended that you manually set this field to `legacy`.
47+
====
48+
49+
. Edit your `<namespace>.yaml` file to add elevated pod security admission standards to your catalog source namespace, as shown in the following example:
50+
+
51+
.Example `<namespace>.yaml` file
52+
[source,yaml]
53+
----
54+
apiVersion: v1
55+
kind: Namespace
56+
metadata:
57+
...
58+
labels:
59+
security.openshift.io/scc.podSecurityLabelSync: "false" <1>
60+
openshift.io/cluster-monitoring: "true"
61+
pod-security.kubernetes.io/enforce: baseline <2>
62+
name: "<namespace_name>"
63+
----
64+
<1> Turn off pod security label synchronization by adding the `security.openshift.io/scc.podSecurityLabelSync=false` label to the namespace.
65+
<2> Apply the pod security admission `pod-security.kubernetes.io/enforce` label. Set the label to `baseline` or `privileged`. Use the `baseline` pod security profile unless other workloads in the namespace require a `privileged` profile.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/admin/olm-managing-custom-catalogs.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="olm-updating-sqlite-catalog-to-a-new-opm-version_{context}"]
7+
= Rebuilding SQLite database catalog images
8+
9+
You can rebuild your SQLite database catalog image with the latest version of the `opm` CLI tool that is released with your version of {product-title}.
10+
11+
.Prerequisites
12+
13+
* SQLite database catalog source
14+
* Cluster administrator permissions
15+
* Latest version of the `opm` CLI tool released with {product-title} {product-version} on workstation
16+
17+
.Procedure
18+
19+
* Run the following command to rebuild your catalog with a more recent version of the `opm` CLI tool:
20+
+
21+
[source,terminal,subs="attributes+"]
22+
----
23+
$ opm index add --binary-image \
24+
registry.redhat.io/openshift4/ose-operator-registry:v{product-version} \
25+
--from-index <your_registry_image> \
26+
--bundles "" -t \<your_registry_image>
27+
----

modules/osdk-publish-catalog.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,15 @@ spec:
7878
displayName: My Test
7979
publisher: Company
8080
sourceType: grpc
81-
image: quay.io/example/memcached-catalog:v0.0.1 <1>
81+
grpcPodConfig:
82+
securityContextConfig: <security_mode> <1>
83+
image: quay.io/example/memcached-catalog:v0.0.1 <2>
8284
updateStrategy:
8385
registryPoll:
8486
interval: 10m
8587
----
86-
<1> Set `image` to the image pull spec you used previously with the `CATALOG_IMG` argument.
88+
<1> Specify the value of `legacy` or `restricted`. If the field is not set, the default value is `legacy`. In a future {product-title} release, it is planned that the default value will be `restricted`. If your catalog cannot run with `restricted` permissions, it is recommended that you manually set this field to `legacy`.
89+
<2> Set `image` to the image pull spec you used previously with the `CATALOG_IMG` argument.
8790

8891
. Check the catalog source:
8992
+

modules/sbo-deploying-a-postgresql-database-operator-power-z.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ $ oc get subs -n openshift-operators
8282
NAME PACKAGE SOURCE CHANNEL
8383
postgresql-operator-dev4devs-com postgresql-operator-dev4devs-com ibm-multiarch-catalog alpha
8484
rh-service-binding-operator rh-service-binding-operator redhat-operators stable
85-
----
85+
----

0 commit comments

Comments
 (0)