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
Scaffold a requirements.yml file for collection dependencies (#2652)
* Scaffold a requirements.yml file for collection dependencies
Users will now install the operator_sdk.util and community.kubernetes
collections at operator build time rather than them being baked into
the base image. This allows us to put version pins to ensure
compatibility of user Ansible content even when updating the base image.
This should make it safer and easier for users to update to newer
versions of the base image, as well as make it more transparent where
the Ansible content they execute is coming from. It also allows us to
push new features and bugfixes out to users via the collections without
having to continually re-release the base image with new content.
This will be a breaking change for existing users of the collection
however. In order to continue working, users will have to add a
requirements.yml to their projects and add an install step to their
build/Dockerfile.
* Update docs
* Ensure permissions on installed collections are properly set for execution in-cluster
* Update changelog and migration guide
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,10 @@
18
18
- Add Prometheus metrics support to Helm-based operators. ([#2603](https://github.com/operator-framework/operator-sdk/pull/2603))
19
19
20
20
### Changed
21
-
- Ansible scaffolding has been rewritten to be simpler and make use of newer features of Ansible and Molecule.
22
-
- The Kubernetes modules have migrated to the [Kubernetes Ansible collection](https://github.com/ansible-collections/kubernetes). All scaffolded code now references modules from this collection instead of Ansible Core. No immediate action is required for existing users of the modules from core, though it is recommended they switch to using the collection to continue to get non-critical bugfixes and features. The collection is now installed by default in the base image. ([#2646](https://github.com/operator-framework/operator-sdk/pull/2646))
21
+
- The base image now includes version 0.10.3 of the OpenShift Python client. This should fix hanging in Python3
22
+
- The Kubernetes modules have migrated to the [Kubernetes Ansible collection](https://github.com/ansible-collections/kubernetes). All scaffolded code now references modules from this collection instead of Ansible Core. No immediate action is required for existing users of the modules from core, though it is recommended they switch to using the collection to continue to get non-critical bugfixes and features. To install the collection, users will need to add the install step to their `build/Dockerfile`. New projects will have a `requirements.yml` scaffolded that includes the `community.kubernetes` collection, as well as the corresponding install step in the `build/Dockerfile`. ([#2646](https://github.com/operator-framework/operator-sdk/pull/2646))
23
+
-**Breaking change**`The operator_sdk.util` collection is no longer installed by default in the base image. Existing projects will need to install it in the `build/Dockerfile`. New projects will have a `requirements.yml` scaffolded that includes the `operator_sdk.util` collection, as well as the corresponding install step in the `build/Dockerfile`. ([#2652](https://github.com/operator-framework/operator-sdk/pull/2652))
24
+
- Ansible scaffolding has been rewritten to be simpler and make use of newer features of Ansible and Molecule. ([#2425](https://github.com/operator-framework/operator-sdk/pull/2425))
23
25
- No longer generates the build/test-framework directory or molecule/test-cluster scenario
24
26
- Adds new `cluster` scenario that can be used to test against an existing cluster
25
27
- There is no longer any Ansible templating done in the `deploy/` directory, any templates used for testing will be located in `molecule/templates/` instead.
Copy file name to clipboardExpand all lines: doc/ansible/dev/testing_guide.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,15 @@ To begin, you sould have:
15
15
without modification. Your top-level project structure should look like this:
16
16
```
17
17
.
18
-
├── build
19
-
├── deploy
20
-
├── molecule
21
-
├── roles
18
+
├── build/
19
+
├── deploy/
20
+
├── molecule/
21
+
├── roles/
22
22
├── playbook.yml (optional)
23
+
├── requirements.yml
23
24
└── watches.yaml
24
25
```
26
+
- The Ansible content specified in `requirements.yml` will also need to be installed. You can install them with `ansible-galaxy collection install -r requirements.yml`
25
27
26
28
### Molecule scenarios
27
29
If you look into the `molecule` directory, you will see four directories (`default`, `test-local`, `cluster`, `templates`).
Copy file name to clipboardExpand all lines: doc/migration/version-upgrade-guide.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -973,6 +973,25 @@ With:
973
973
- name: {{your operator name which is the value of metadata.name in this file}}
974
974
```
975
975
976
+
#### Migration to Ansible collections
977
+
978
+
The core Ansible Kubernetes modules have been moved to the [`community.kubernetes` Ansible collection][kubernetes-ansible-collection]. Future development of the modules will occur there, with only critical bugfixes going into the modules in core. Additionally, the `operator_sdk.util` collection is no longer installed by default in the base image. Instead, users should add a `requirements.yml` to their project root, with the following content:
979
+
980
+
```yaml
981
+
collections:
982
+
- community.kubernetes
983
+
- operator_sdk.util
984
+
```
985
+
986
+
Users should then add the following stages to their `build/Dockerfile`:
987
+
988
+
```
989
+
COPY requirements.yml ${HOME}/requirements.yml
990
+
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
0 commit comments