Skip to content

Commit

Permalink
Merge pull request #71 from IBM/develop
Browse files Browse the repository at this point in the history
Merge develop to main for v1.1.1 release
  • Loading branch information
freemanlatrell committed Jan 12, 2024
2 parents 2444fa1 + 5b3a736 commit 003e09f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ jobs:
OCP_NAMESPACE=molecule-${GITHUB_REF_NAME}-${RUNNER_OS} molecule test --all
env:
OPENSHIFT_SERVER: ${{ secrets.OPENSHIFT_SERVER }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
ZOSCB_RELEASE: ibm-zoscb.${{ vars.ZOSCB_RELEASE }}
29 changes: 13 additions & 16 deletions ibm/operator_collection_sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ If your local environment is also offline, then you must download the required A
ansible-playbook ibm.operator_collection_sdk.create_offline_requirements
```

**Note:** Offline Python dependencies are currently not supported in the v2.2.2 release of the IBM z/OS Cloud Broker, so the `requirements.txt` file will be removed in the Operator Collection once it has been converted to execute offline.


# Usage Examples
**Note:** To execute this playbook, it is required that your are in the root directory of the collection that you are developing, with a valid `galaxy.yml` and `operator-config.yml` file in the same directory
Expand Down Expand Up @@ -204,23 +202,22 @@ Enter your ZosEndpoint name:
[kubernetes]:https://github.com/kubernetes-client/python#installation
[broker]:https://ibm.biz/ibm-zoscb-install

## Configure extra-vars file to bypass prompts
If you find yourself inputting vars_prompts frequently, append `--extra-vars <vars>.json` to your playbook command/alias

```bash
ansible-playbook create_credential_secret.yml --extra-vars vars.json
```
## Configure ocsdk-extra-vars file to bypass prompts
If you find yourself inputting vars_prompts frequently, create an `ocsdk-extra-vars.yaml` file. If `create_operator.yml` detects this file, it will automatically use it.

Example `vars.json` file:
Example `ocsdk-extra-vars.yaml` file:

```yaml
zosendpoint_type: remote
zosendpoint_name: my-endpoint
zosendpoint_host: 1.2.3.4
zosendpoint_port: '22'
username: user
ssh_key: ~/.ssh/id_rsa
passphrase: my_ssh_passphrase
```
{
username: "testuser",
operator_name: "racf",
ssh_key: "~/.ssh/id_rsa",
secret_name: "test-secret"
}
```

Note: We do not recommend explicitly specifying passphrases in this file as they should be passed through the vars prompt. If the passphrase is specified however, we recommend that the `ocsdk-extra-vars.yaml` file be added to your `.gitignore` file to prevent the exposure of your passphrase on Github.

## Suppress playbook warning messages
Set the following environment variables to suppress the WARNING messages listed below when executing playbooks within the IBM Operator Collection SDK collection.
Expand Down
2 changes: 1 addition & 1 deletion ibm/operator_collection_sdk/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace: ibm
name: operator_collection_sdk

# The version of the collection. Must be compatible with semantic versioning
version: 1.1.0
version: 1.1.1

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
name: ibm-zoscb
source: ibm-operator-catalog
sourceNamespace: openshift-marketplace
startingCSV: ibm-zoscb.v2.2.2
startingCSV: "{{ zoscb_release }}"

- name: Validate Subscription installed successfully
kubernetes.core.k8s_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ provisioner:
zosendpoint_name: ibmcloud-vm
openshift_token: ${OPENSHIFT_TOKEN}
openshift_server: ${OPENSHIFT_SERVER}
zoscb_release: ${ZOSCB_RELEASE:-ibm-zoscb.v2.2.4}
scenario:
test_sequence:
- prepare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
name: ibm-zoscb
source: ibm-operator-catalog
sourceNamespace: openshift-marketplace
startingCSV: ibm-zoscb.v2.2.2
startingCSV: "{{ zoscb_release }}"

- name: Validate Subscription installed successfully
kubernetes.core.k8s_info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ provisioner:
secret_name: "test-secret"
openshift_token: ${OPENSHIFT_TOKEN}
openshift_server: ${OPENSHIFT_SERVER}
zoscb_release: ${ZOSCB_RELEASE:-ibm-zoscb.v2.2.4}
skip_credential_check: true
scenario:
test_sequence:
Expand Down
28 changes: 20 additions & 8 deletions ibm/operator_collection_sdk/playbooks/redeploy_operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
vars:
path: "{{ local_directory }}"
namespace: "{{ target_namespace }}"
redeploy: true

- name: Get SubOperatorConfig
kubernetes.core.k8s_info:
Expand Down Expand Up @@ -90,23 +91,32 @@
wait_sleep: 5
wait_timeout: 140

- name: Set OperatorCollection name
ansible.builtin.set_fact:
operatorcollection_name: "{{ operator_name + '.' + operator_domain + '.' + operator_version }}"

- name: Create OperatorCollection
kubernetes.core.k8s:
state: present
definition:
apiVersion: zoscb.ibm.com/v2beta2
kind: OperatorCollection
metadata:
name: "{{ oc_results.resources[0].metadata.name }}"
name: "{{ operatorcollection_name }}"
namespace: "{{ target_namespace }}"
labels: "{{ oc_results.resources[0].metadata.labels }}"
spec: "{{ oc_results.resources[0].spec }}"
labels:
managed-by: ibm-zos-cloud-broker
operator-domain: "{{ operator_domain }}"
operator-name: "{{ operator_name }}"
operator-version: "{{ operator_version }}"
spec:
skipSignatureVerification: true

- name: Validate OperatorCollection installed successfully
kubernetes.core.k8s_info:
api_version: zoscb.ibm.com/v2beta2
kind: OperatorCollection
name: "{{ oc_results.resources[0].metadata.name }}"
name: "{{ operatorcollection_name }}"
namespace: "{{ target_namespace }}"
register: updated_oc_results
until: "updated_oc_results.resources[0].status.phase is defined and updated_oc_results.resources[0].status.phase == 'Successful'"
Expand All @@ -120,16 +130,18 @@
apiVersion: zoscb.ibm.com/v2beta2
kind: SubOperatorConfig
metadata:
name: "{{ soc_results.resources[0].metadata.name }}"
name: "{{ operatorcollection_name }}-soc"
namespace: "{{ target_namespace }}"
labels: "{{ soc_results.resources[0].metadata.labels }}"
spec: "{{ soc_results.resources[0].spec }}"
spec:
credentialType: "{{ soc_results.resources[0].spec.credentialType }}"
mapping: "{{ soc_results.resources[0].spec.mapping }}"
operatorCollection: "{{ operatorcollection_name }}"

- name: Validate SubOperatorConfig installed successfully
kubernetes.core.k8s_info:
api_version: zoscb.ibm.com/v2beta2
kind: SubOperatorConfig
name: "{{ soc_results.resources[0].metadata.name }}"
name: "{{ operatorcollection_name }}-soc"
namespace: "{{ target_namespace }}"
register: updated_soc_results
until: "updated_soc_results.resources[0].status.phase is defined and updated_soc_results.resources[0].status.phase == 'Successful'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

- name: Read operator-config.yml
ansible.builtin.set_fact:
operator_config: "{{ lookup('template', '{{ oc_file_results.files[0].path }}')|from_yaml }}"
operator_config: "{{ lookup('template', '{{ oc_file_results.files[0].path }}')| from_yaml | to_json | from_json }}"

- name: Set operator variables
ansible.builtin.set_fact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
msg: "OperatorCollection doesn't exist"
when: soc_results.resources | length > 0 and oc_results.resources | length == 0

- name: Copy local build to manager pod
- name: Copy local build to manager pod using existing collection path
ansible.builtin.command: oc cp {{ find_result.files[0].path }} "{{ pod_results.resources[0].metadata.namespace }}/{{ pod_results.resources[0].metadata.name }}":"{{ oc_results.resources[0].status.config.collectionPath }}"
when: soc_results.resources | length > 0 and oc_results.resources | length > 0
when: soc_results.resources | length > 0 and oc_results.resources | length > 0 and (redeploy is not defined or redeploy is false)

- name: Create directory on pod if doesn't exist
ansible.builtin.command: oc exec -i -n "{{ pod_results.resources[0].metadata.namespace }}" "{{ pod_results.resources[0].metadata.name }}" -- mkdir -p /opt/collections/suboperator/{{ operator_name }}/{{ operator_version }}
when: soc_results.resources | length == 0
when: soc_results.resources | length == 0 and (redeploy is not defined or redeploy is false)

- name: Copy local build to manager pod during initial operator creation
- name: Copy local build to manager pod using new collection path
ansible.builtin.command: oc cp {{ find_result.files[0].path }} "{{ pod_results.resources[0].metadata.namespace }}/{{ pod_results.resources[0].metadata.name }}":/opt/collections/suboperator/{{ operator_name }}/{{ operator_version }}/{{ find_result.files[0].path | basename }}
when: soc_results.resources | length == 0
when: soc_results.resources | length == 0 or (redeploy is defined and redeploy is true)

0 comments on commit 003e09f

Please sign in to comment.