def patch_aws_node()

in projects/enable-irsa/src/main.py [0:0]


def patch_aws_node(Context: str, **kwargs):
    while True:
        response = choice("Do you want to patch the aws-node Daemonset(Yes/No)? This will trigger a rolling restart of the networking plugin: ")
        if response == 'yes':
            break
        if response == 'no':
            exit(1)
        else:
            print('Please enter "Yes" or "No".')
    print('Patching aws-node daemonset')
    if 'Clientset' in kwargs:
        api_client = kwargs['Clientset']
        AppsV1 = client.AppsV1Api(api_client)
    else:
        AppsV1 = client.AppsV1Api(api_client=config.new_client_from_config(context=Context))

    patch = {
        "spec": {
            "template": {
                "metadata": {
                    "annotations": {
                        "irsa": "enabled"
                    }
                }
            }
        }
    }
    try:
        AppsV1.patch_namespaced_daemon_set_with_http_info(name='aws-node', namespace='kube-system', body=patch)
    except ApiException:
        print('An error occurred while patching the aws-node Daemonset')
        exit(1)