sassoftware / viya4-ark

SAS Viya Administration Resource Kit for Containerized Deployments. Tools and utilities to help SAS Customers with SAS Viya running in containers.
Apache License 2.0
34 stars 13 forks source link

Update sas_kubectl to handle renamed "APIVERSION" column in `kubectl api-resources` response at v1.20.0 #64

Closed seanankenbruck closed 3 years ago

seanankenbruck commented 3 years ago

Hi viya4-ark team, receiving a ValueError when attempting to execute the pre-install tool but the log doesn't show any errors. Any chance someone could point to what exactly is missing or where I need to look based on the following output?

Gathering facts...................................DONE

Traceback (most recent call last):
  File "viya-ark.py", line 139, in <module>
    main(sys.argv[1:])
  File "viya-ark.py", line 77, in main
    command.run(argv[1:])
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/pre_install_report.py", line 98, in run
    main(argv)
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/pre_install_report.py", line 246, in main
    sas_pre_check_report.check_details(kubectl, ingress_port, ingress_host, ingress_controller, output_dir)
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/library/pre_install_check.py", line 137, in check_details
    self._check_permissions(permissions_check)
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/library/pre_install_check.py", line 409, in _check_permissions
    permissions_check.check_rbac_role()
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/library/pre_install_check_permissions.py", line 450, in check_rbac_role
    found = self.utils.get_rbac_group_cmd()
  File "/usr/csuser/clouddrive/viya4-ark/pre_install_report/library/pre_install_utils.py", line 97, in get_rbac_group_cmd
    data: KubernetesApiResources = self._kubectl.api_resources(False)
  File "/usr/csuser/clouddrive/viya4-ark/viya_ark_library/k8s/sas_kubectl.py", line 143, in api_resources
    apigroup_index: int = api_resource_headers.index(_HEADER_APIGROUP_)
ValueError: substring not found
lasiva commented 3 years ago

Would it be possible to attach the log? Please run the tool with the -d option again. Thanks

seanankenbruck commented 3 years ago

Please find it attached.

viya_pre_install_log_2021-01-22T16_31_56.log

lasiva commented 3 years ago

Thanks for the logs. It looks like we are missing some expected Headers when we issue the command "kubectl api-resources -o wide" against your cluster. Could you please attach the output from this command? Does your kubeconfig have admin level access to this cluster?

seanankenbruck commented 3 years ago

kubectl api-resources -o wide output is attached.

api-resources.txt

sasjowood commented 3 years ago

It appears Kubernetes has updated the response from kubectl api-resources to return the column "APIVERSION" instead of "APIGROUP" at v1.20.0 (see https://github.com/kubernetes/kubernetes/pull/95253). Would it be possible to check the version of kubectl being used where the report is being run (kubectl version --client)? If that version, is v1.20.0 or newer, backleveling the version to a 1.19.* release should allow you to run the report successfully while we update to align with the new kubectl output.

seanankenbruck commented 3 years ago

Downgrading the kubectl client version worked. However, using Azure CloudShell I cannot modify /usr/local/bin files so I had to prepend a self-contained version of kubectl to my PATH variable. After the downgrade:

kubectl version --short
Client Version: v1.18.8
Server Version: v1.19.3

this change did resolve the error and the tool ran successfully.

Gathering facts...................................DONE

Created: /usr/csuser/clouddrive/viya4-ark/viya_pre_install_report_2021-01-22T21_25_02.html
Created: viya_pre_install_log_2021-01-22T21_25_02.log

Thanks for the quick response and resolution.

kevinlinglesas commented 3 years ago

Issue addressed in release 1.1.0.