Skip to content

Commit

Permalink
fix: (IAC-1108) Revert the Multi-tenancy related changes (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
riragh authored Sep 19, 2023
1 parent ece3ef4 commit 11f375c
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 137 deletions.
16 changes: 4 additions & 12 deletions docs/user/Multi-Tenancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,12 @@ Step 3. Onboard tenants. Run the following command:
-e JUMP_SVR_PRIVATE_KEY=$HOME/.ssh/id_rsa \
playbooks/playbook.yaml --tags "multi-tenancy,onboard"
```
**Notes:**
- As part of the setup in the above `Onboard tenants` step, for every onboarded tenant,
**Note:** As part of setup in the above `Onboard tenants` step, for every onboarded tenant,

>- A CAS server directory containing the configuration artifacts is created under the `/site-config` folder.
For example, if you have tenant with the ID `acme`, then a CAS server directory named `cas-acme-default` will be created.
>
>- Starting with SAS Viya Platform cadence 2023.03, each tenant will require their own copy of certain Kubernetes resources. Hence a new directory for each tenant containing all the `sas-programming-environment` files will be created under `$deploy/site-config/multi-tenant/`. For example, if you have a tenant with the ID `acme`, then a directory named `$deploy/site-config/multi-tenant/acme` will be created.
>
>- The base `kustomization.yaml` file will be updated to add a reference to the tenant directories in the resources block. And the changes will be applied to create the tenant-specific resources before running the `sas-tenant-onboard` job. A short delay is introduced here to allow the apply commands to finish.
- A CAS server directory containing the configuration artifacts is created under the `/site-config` folder.
For example,if you have tenant with the ID `acme`, then a CAS server directory named `cas-acme-default` will be created.

- Starting with SAS Viya Platform cadence 2023.07, the `sas-tenant-onboard-job` continues to run until the conclusion of the rolling restart of all SAS Viya services. The `Onboard tenants` command run above does not wait for the conclusion of the rolling restart of all SAS Viya services. The action concludes after the `sas-tenant-onboard-job` has reached `Running` state. User should continue to monitor the status of `sas-tenant-onboard-job` manually.

- It is recommended that User proceeds with the `cas-onboard` command below if it was not applied together with the `multi-tenancy,onboard` action.
- Starting with SAS Viya Platform cadence 2023.03, each tenant will require their own copy of certain Kubernetes resources. Hence a new directory for each tenant containing all the `sas-programming-environment` files will be created under `$deploy/site-config/multi-tenant/`. For example, if you have a tenant with the ID `acme`, then a directory named `$deploy/site-config/multi-tenant/acme` will be created.

Step 4. Add or update CAS customizations for tenants as needed and then run following command to onboard the CAS servers:

Expand All @@ -135,7 +128,6 @@ Step 4. Add or update CAS customizations for tenants as needed and then run foll
**Note:**
- If there are no additional CAS customizations required for tenants then run 'onboard' and 'cas-onboard' tags together in Step 3 and skip Step 4.
- The tenant CAS servers might take several mins to stabilize after the cas-onboard command above has completed successfully.
- The successful conclusion of the `sas-tenant-onboard-job` is a clear indication that administrators can sign on to the new tenant, or run another instance of the sas-tenant-job.

## Log In and Validate an Onboarded Tenant
After the onboard and cas-onboard steps are complete see the steps [here](https://go.documentation.sas.com/doc/en/itopscdc/default/caltenants/p0emzq13c0zbhxn1hktsdlmig934.htm#n05u0e3vmr5lcqn1l5xa2rhkdu6x) to login and validate an onboarded tenant.
Expand Down
1 change: 1 addition & 0 deletions playbooks/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
name: vdm
tags:
- viya
- multi-tenancy
- name: Monitoring role - namespace
include_role:
name: monitoring
Expand Down
10 changes: 0 additions & 10 deletions roles/multi-tenancy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ V4_CFG_CR_HOST: '{{ V4_CFG_CR_URL | regex_replace("^https?:\/\/(.*)\/?", "\1") }
V4_CFG_CR_USER: null
V4_CFG_CR_PASSWORD: null

# Deployment Operator
V4_DEPLOYMENT_OPERATOR_ENABLED: true
V4_DEPLOYMENT_OPERATOR_SCOPE: cluster
V4_DEPLOYMENT_OPERATOR_NAMESPACE: sasoperator
V4_DEPLOYMENT_OPERATOR_CRB: sasoperator

## Below the line deployment -- internal use only
## Setting true enables using custom du for below the line testing
V4_CFG_BELOW_THE_LINE: false

# Multi-tenant is enabled within SAS Viya deployment
V4MT_ENABLE: false

Expand Down
39 changes: 0 additions & 39 deletions roles/multi-tenancy/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@
- cas-onboard
- offboard

# Deploy the Software for tenant pod-templates
- name: Include Deployment assets - onboard
include_tasks: ../../vdm/tasks/assets.yaml
tags:
- onboard

- name: Include SASDeployment Custom Resource - onboard
include_tasks: ../../vdm/tasks/sasdeployment_custom_resource.yaml
tags:
- onboard

- name: Include Deploy - onboard
include_tasks: ../../vdm/tasks/deploy.yaml
when:
- DEPLOY
tags:
- onboard

- name: Multi-tenant role - onboard offboard
include_tasks: multi-tenant-onboard-offboard.yaml
tags:
Expand All @@ -44,24 +26,3 @@
tags:
- cas-onboard
- offboard

# Deploy the Software for cas-onboard
- name: Include Deployment assets - cas onboard
include_tasks: ../../vdm/tasks/assets.yaml
tags:
- cas-onboard
- offboard

- name: Include SASDeployment Custom Resource - cas onboard
include_tasks: ../../vdm/tasks/sasdeployment_custom_resource.yaml
tags:
- cas-onboard
- offboard

- name: Include Deploy - cas onboard
include_tasks: ../../vdm/tasks/deploy.yaml
when:
- DEPLOY
tags:
- cas-onboard
- offboard
26 changes: 1 addition & 25 deletions roles/multi-tenancy/tasks/multi-tenant-onboard-offboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: Check tenant pod-templates are created
ansible.builtin.shell: |
kubectl --kubeconfig {{ KUBECONFIG }} get podtemplate -n {{ NAMESPACE }} | egrep '{{ V4MT_TENANT_IDS | replace(",", "|") | replace(" ", "") }}'
register: podtemplate_status
until: podtemplate_status.stdout | length > 0
failed_when: podtemplate_status.stderr | length > 0
retries: 5
delay: 90
tags:
- onboard

# Apply the service account role
- name: Apply service account role
ansible.builtin.shell: |
Expand Down Expand Up @@ -193,7 +182,7 @@
ansible.builtin.shell: |
kubectl --kubeconfig {{ KUBECONFIG }} get pods -n {{ NAMESPACE }} --sort-by=.metadata.creationTimestamp | tac | grep sas-tenant-onboard | awk '{print $3}'
register: pod_status
until: pod_status.stdout_lines[0] == "Running" or pod_status.stdout_lines[0] in pod_fail_list
until: pod_status.stdout_lines[0] == "Completed" or pod_status.stdout_lines[0] in pod_fail_list
retries: "{{ V4MT_ONBOARD_RETRY | int }}"
delay: "{{ V4MT_ONBOARD_DELAY | int }}"
tags:
Expand All @@ -218,16 +207,3 @@
tags:
- onboard
- offboard

- name: Sleep for 120 seconds
debug:
msg:
- "Sleeping for 120 seconds before continuing with cas-onboard steps"
tags:
- onboard

- name: Sleep for 120 seconds and continue with cas-onboard steps
ansible.builtin.wait_for:
timeout: 120
tags:
- onboard
2 changes: 0 additions & 2 deletions roles/multi-tenancy/tasks/multi-tenant-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
tags:
- onboard
- offboard

- name: Add env variable for pod templates in sas-tenant-job
lineinfile:
Expand All @@ -213,4 +212,3 @@
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
tags:
- onboard
- offboard
37 changes: 37 additions & 0 deletions roles/multi-tenancy/tasks/onboard-offboard-cas-servers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@
tags:
- offboard

## Add tenant specific pod templates
- name: Check if tenant resources are present
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
line: "- site-config/multi-tenant/{{ item | trim }}"
state: present
check_mode: true
register: result
with_items: "{{ V4MT_TENANT_IDS.split(',') }}"
when: V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
tags:
- cas-onboard

- name: Add tenant directories to resources
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
insertafter: "resources:"
line: "- site-config/multi-tenant/{{ item | trim }}"
state: present
with_items: "{{ V4MT_TENANT_IDS.split(',') }}"
when:
- result.changed
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
tags:
- cas-onboard

# On offboard remove all the tenant pod template resources
- name: Remove all tenant resources
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
regexp: .*site-config/multi-tenant/{{ item | trim }}.*$
state: absent
with_items: "{{ V4MT_TENANT_IDS.split(',') }}"
when: V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
tags:
- offboard

# Offboard CAS servers
- name: Kubectl delete cas servers for tenants
ansible.builtin.shell: |
Expand Down
40 changes: 0 additions & 40 deletions roles/multi-tenancy/tasks/tenant-pod-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,3 @@
with_items: "{{ result.files }}"
loop_control:
loop_var: outer_item

## Add tenant specific pod templates
- name: Check if tenant resources are present
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
line: "- site-config/multi-tenant/{{ tenant | trim }}"
state: present
check_mode: true
register: result
when:
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
- V4MT_TENANT_IDS is search(tenant)
tags:
- onboard

- name: Add tenant directories to resources
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
insertafter: "resources:"
line: "- site-config/multi-tenant/{{ tenant | trim }}"
state: present
when:
- result.changed
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
- V4MT_TENANT_IDS is search(tenant)
tags:
- onboard

# On offboard remove all the tenant pod template resources
- name: Remove all tenant resources
lineinfile:
path: "{{ DEPLOY_DIR }}/kustomization.yaml"
regexp: '.*site-config/multi-tenant/{{ tenant | trim }}.*$'
state: absent
# with_items: "{{ V4MT_TENANT_IDS.split(',') }}"
when:
- V4_CFG_CADENCE_VERSION is version('2023.03', ">=") or V4_CFG_CADENCE_NAME|lower == "fast"
- V4MT_TENANT_IDS is search(tenant)
tags:
- offboard
1 change: 0 additions & 1 deletion roles/vdm/tasks/assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- install
- uninstall
- update
- onboard
- cas-onboard
- offboard

Expand Down
2 changes: 0 additions & 2 deletions roles/vdm/tasks/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
tags:
- install
- update
- onboard
- cas-onboard

- name: Deploy - Apply SAS Viya deployment
Expand All @@ -22,7 +21,6 @@
tags:
- install
- update
- onboard
- cas-onboard
block:
- name: Deploy - Gather all resource files
Expand Down
3 changes: 3 additions & 0 deletions roles/vdm/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- install
- uninstall
- update
- multi-tenancy

- name: Base overlays
overlay_facts:
Expand Down Expand Up @@ -241,6 +242,7 @@
- install
- uninstall
- update
- multi-tenancy

- name: Include Deploy
include_tasks: deploy.yaml
Expand All @@ -250,6 +252,7 @@
- install
- uninstall
- update
- multi-tenancy

- name: Include Deployment Operator - Uninstall
include_tasks: deployment_operator.yaml
Expand Down
6 changes: 0 additions & 6 deletions roles/vdm/tasks/sasdeployment_custom_resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
- install
- uninstall
- update
- onboard
- cas-onboard
- offboard

Expand All @@ -23,7 +22,6 @@
- install
- uninstall
- update
- onboard
- cas-onboard
- offboard
block:
Expand All @@ -44,7 +42,6 @@
- install
- uninstall
- update
- onboard
- cas-onboard
- offboard
block:
Expand Down Expand Up @@ -80,7 +77,6 @@
tags:
- install
- update
- onboard
- cas-onboard
- offboard
block:
Expand Down Expand Up @@ -112,7 +108,6 @@
tags:
- install
- update
- onboard
- cas-onboard
- offboard
block:
Expand Down Expand Up @@ -145,7 +140,6 @@
tags:
- install
- update
- onboard
- cas-onboard
- offboard
block:
Expand Down

0 comments on commit 11f375c

Please sign in to comment.