Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws eks update-kubeconfig fails with error TypeError: 'NoneType' object is not iterable #4843

Closed
TechnicalMercenary opened this issue Jan 15, 2020 · 20 comments · Fixed by #7796
Labels
customization Issues related to CLI customizations (located in /awscli/customizations) eks-kubeconfig feature-request A feature should be added or improved. has-pr This issue has a PR associated with it. p2 This is a standard priority issue

Comments

@TechnicalMercenary
Copy link

I just received a new MacBook with MacOS Catalina. I used the latest AWS CLI Bundle to install the AWS CLI on the MBP.

`gregory.bonk@greg-bonk-mbp:~/workspace$ unzip awscli-bundle.zip
Archive: awscli-bundle.zip
inflating: awscli-bundle/install
inflating: awscli-bundle/packages/PyYAML-5.2.tar.gz
inflating: awscli-bundle/packages/pyasn1-0.4.8.tar.gz
inflating: awscli-bundle/packages/docutils-0.15.2.tar.gz
inflating: awscli-bundle/packages/botocore-1.14.3.tar.gz
inflating: awscli-bundle/packages/s3transfer-0.3.0.tar.gz
inflating: awscli-bundle/packages/urllib3-1.25.7.tar.gz
inflating: awscli-bundle/packages/python-dateutil-2.8.0.tar.gz
inflating: awscli-bundle/packages/virtualenv-16.7.8.tar.gz
inflating: awscli-bundle/packages/colorama-0.4.1.tar.gz
inflating: awscli-bundle/packages/jmespath-0.9.4.tar.gz
inflating: awscli-bundle/packages/futures-3.3.0.tar.gz
inflating: awscli-bundle/packages/awscli-1.17.3.tar.gz
inflating: awscli-bundle/packages/rsa-3.4.2.tar.gz
inflating: awscli-bundle/packages/six-1.14.0.tar.gz
inflating: awscli-bundle/packages/setup/setuptools_scm-3.3.3.tar.gz
inflating: awscli-bundle/packages/setup/wheel-0.33.6.tar.gz

gregory.bonk@greg-bonk-mbp:~/workspace$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Running cmd: /usr/local/opt/python@2/bin/python2.7 virtualenv.py --no-download --python /usr/local/opt/python@2/bin/python2.7 /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-binary :all: --no-cache-dir --no-index --find-links file://. setuptools_scm-3.3.3.tar.gz
Running cmd: /usr/local/aws/bin/pip install --no-binary :all: --no-cache-dir --no-index --find-links file://. wheel-0.33.6.tar.gz
Running cmd: /usr/local/aws/bin/pip install --no-binary :all: --no-build-isolation --no-cache-dir --no-index --find-links file:///Users/gregory.bonk/workspace/devops-application/infrastructure/awscli-bundle/packages awscli-1.17.3.tar.gz`

Checking the install I see this...

gregory.bonk@greg-bonk-mbp:~/workspace$ which aws /usr/local/bin/aws gregory.bonk@greg-bonk-mbp:~/workspace/$ /usr/local/bin/aws --version aws-cli/1.17.3 Python/2.7.17 Darwin/19.2.0 botocore/1.14.3

Then when running a command to get an EKS cluster configuration...

aws eks update-kubeconfig --name my-eks --region us-west-2

This is the error...

'NoneType' object is not iterable

In the debug I see that there is a response, coming back. Appears to be something with parsing it ?

https://gist.github.com/TechnicalMercenary/48f15680f1fcd506b256e84157f08e30

@TechnicalMercenary
Copy link
Author

After deleting my existing ~/.kube/config file I ran the update-kubeconfig again and now it works perfectly fine.

Perhaps it was an issue with my config's format or something ? Here's what it used to look like...

$ cat ~/.kube/config
apiVersion: v1
clusters: null
contexts: null
current-context: arn:aws:eks:us-west-2:3456345634:cluster/my-eks
kind: Config
preferences: {}
users: null

@gbonk
Copy link

gbonk commented Mar 3, 2020

I've stumbled upon this again, and I'm going to speculate that the AWS CLI needs to be able to handle config files a little more robustly.

Here's a couple of flows that I've come up with that causes this to fail....

Flow 1

// Start with fresh file
rm ~/.kube/config

// Update with the context you want
aws eks update-kubeconfig --name my-cluster --region us-west-2

// Use KubeCtl to delete the context
kubectl config delete-context arn:aws:eks:us-west-2:000000000000:cluster/my-cluster

// RE-Apply the Config
aws eks update-kubeconfig --name my-cluster --region us-west-2

Tried to insert into contexts, which is a <type 'NoneType'> not a <type 'list'>

Here is my context file before the Re-Apply

clusters:
- cluster:
    certificate-authority-data: {...snip...}.sk1.us-west-2.eks.amazonaws.com
  name: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
contexts: null
current-context: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - my-cluster
      command: aws
      env: null

Flow 2

// Start with fresh file
rm ~/.kube/config

// Update with the context you want
aws eks update-kubeconfig --name my-cluster --region us-west-2

// Use KubeCtl to delete the context
kubectl config delete-cluster arn:aws:eks:us-west-2:000000000000:cluster/my-cluster

// RE-Apply the Config
aws eks update-kubeconfig --name my-cluster --region us-west-2

'NoneType' object is not iterable

Config before re-apply

apiVersion: v1
clusters: null
contexts:
- context:
    cluster: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
    user: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
  name: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
current-context: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-west-2:000000000000:cluster/my-cluster
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - my-cluster
      command: aws
      env: null

@Raffo
Copy link

Raffo commented May 29, 2020

Apparently, the AWS CLI will need to take into account the changed behavior, see how the upstream kubernetes issue was closed: kubernetes/kubernetes#88524

@Jean-Baptiste-Lasselle
Copy link

Jean-Baptiste-Lasselle commented Jun 10, 2020

thanks all, i had same issue, solved it with rm ~/.kube/config as well

@kdaily
Copy link
Member

kdaily commented Sep 23, 2020

Thanks for the report and the detailed descriptions on how to get it to fail. I'll confer with the EKS team on how to handle this, as it is a CLI customization.

@kdaily kdaily added the customization Issues related to CLI customizations (located in /awscli/customizations) label Nov 12, 2020
@Bioblaze
Copy link

Any update on this?

@mjaromi
Copy link

mjaromi commented Feb 25, 2021

The problem is that if you have only one definition of a cluster, context or user in the ~/.kube/config file and you delete one of them then kubectl will set deleted type to null instead of [].

Then if you try to update-kubeconfig using aws cli command you will see an error:

  • if contexts: null: Tried to insert into contexts,which is a <class 'NoneType'> not a <class 'list'>
  • if users: null: Tried to insert into users,which is a <class 'NoneType'> not a <class 'list'>
  • if clusters: null: 'NoneType' object is not iterable

Simple workaround for above cases is to replace all null with [] then run aws cli update-kubeconfig command, like this:

sed -i 's/: null/: []/g' ~/.kube/config && \
aws eks --region ${AWS_REGION} update-kubeconfig --name ${EKS_CLUSTER_NAME}

@josedelrio85
Copy link

Same to me, solved it with rm ~/.kube/config and applied again aws eks update-kubeconfig

@adesokanayo
Copy link

Thanks. This solved it for me too rm ~/.kube/config . The error is too generic.

@kdaily kdaily added the feature-request A feature should be added or improved. label Aug 11, 2021
@connorlay
Copy link

I ran into this issue on a Linux machine running Pop_OS. I had previously setup kubectl when installing minikube and encountered the same cryptic error message when running aws eks update-kubeconfig. Deleting ~/.kube/config fixed it for me locally.

@koyama-yoshihito
Copy link

My colleague stumbled on this issue.
It worked with rm ~/.kube/config!
Thank you!

@mariuskimmina
Copy link

Just ran into the same Issue - deleting the ~/.kube/config file also worked for me, thanks.
A better check/output would be appreciated

@AndrusGerman
Copy link

It seems to me that aws-cli should take into account having an older ~/.kube/config configuration, a warning should help identify the problem for beginners more easily

@lvlts
Copy link

lvlts commented Apr 29, 2022

EDIT: nevermind, had a rogue KUBECONFIG environment variable pointing somewhere else

aws-cli/2.6.0 Python/3.9.11 Linux/5.10.102.1-microsoft-standard-WSL2 exe/x86_64.arch prompt/off

I don't have a ~/.kube/config as it's the first run of this tool, I still get this error:

2022-04-29 10:44:45,525 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli/clidriver.py", line 459, in main
  File "awscli/clidriver.py", line 594, in __call__
  File "awscli/customizations/commands.py", line 191, in __call__
  File "awscli/customizations/eks/update_kubeconfig.py", line 134, in _run_main
  File "awscli/customizations/eks/kubeconfig.py", line 270, in insert_cluster_user_pair
  File "awscli/customizations/eks/kubeconfig.py", line 217, in insert_entry
awscli.customizations.eks.kubeconfig.KubeconfigError: Tried to insert into users,which is a <class 'NoneType'> not a <class 'list'>

Tried to insert into users,which is a <class 'NoneType'> not a <class 'list'>

@tiarebalbi
Copy link

the problem is still happening... Is there any plans to fix this issue

@OliverRC
Copy link

OliverRC commented Jun 8, 2022

This happened when setting up an EKS cluster after using MiniKube. Removing the kube config works but seems like the AWS CLI should be more robust.

@malikdraz
Copy link

I have just come across this issue. As @TechnicalMercenary temporary fix is by removing the .kube/config file and running the command again.

However, AWS should consider fixing this issue.

@tim-finnigan tim-finnigan added has-pr This issue has a PR associated with it. p2 This is a standard priority issue labels Nov 15, 2022
@w7089
Copy link

w7089 commented Mar 27, 2023

happened to me as well, removing .kube/config didn't help. Using the latest aws cli version

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

mergify bot pushed a commit to aws/aws-cdk that referenced this issue Apr 10, 2023
…cdk/lambda-layer-awscli (#25012)

Bumps [awscli](https://github.com/aws/aws-cli) from 1.27.104 to 1.27.109.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst">awscli's changelog</a>.</em></p>
<blockquote>
<h1>1.27.109</h1>
<ul>
<li>api-change:<code>dlm</code>: Updated timestamp format for GetLifecyclePolicy API</li>
<li>api-change:<code>docdb</code>: This release adds a new parameter 'DBClusterParameterGroupName' to 'RestoreDBClusterFromSnapshot' API to associate the name of the DB cluster parameter group while performing restore.</li>
<li>api-change:<code>fsx</code>: Amazon FSx for Lustre now supports creating data repository associations on Persistent_1 and Scratch_2 file systems.</li>
<li>api-change:<code>lambda</code>: This release adds a new Lambda InvokeWithResponseStream API to support streaming Lambda function responses. The release also adds a new InvokeMode parameter to Function Url APIs to control whether the response will be streamed or buffered.</li>
<li>api-change:<code>quicksight</code>: This release has two changes: adding the OR condition to tag-based RLS rules in CreateDataSet and UpdateDataSet; adding RefreshSchedule and Incremental RefreshProperties operations for users to programmatically configure SPICE dataset ingestions.</li>
<li>api-change:<code>redshift-data</code>: Update documentation of API descriptions as needed in support of temporary credentials with IAM identity.</li>
<li>api-change:<code>servicecatalog</code>: Updates description for property</li>
</ul>
<h1>1.27.108</h1>
<ul>
<li>api-change:<code>cloudformation</code>: Including UPDATE_COMPLETE as a failed status for DeleteStack waiter.</li>
<li>api-change:<code>greengrassv2</code>: Add support for SUCCEEDED value in coreDeviceExecutionStatus field. Documentation updates for Greengrass V2.</li>
<li>api-change:<code>proton</code>: This release adds support for the AWS Proton service sync feature. Service sync enables managing an AWS Proton service (creating and updating instances) and all of it's corresponding service instances from a Git repository.</li>
<li>api-change:<code>rds</code>: Adds and updates the SDK examples</li>
</ul>
<h1>1.27.107</h1>
<ul>
<li>bugfix:eks: Fix eks kubeconfig validations closes <code>[#6564](aws/aws-cli#6564) &lt;https://github.com/aws/aws-cli/issues/6564&gt;</code><strong>, fixes <code>[#4843](aws/aws-cli#4843) &lt;https://github.com/aws/aws-cli/issues/4843&gt;</code></strong>, fixes <code>[#5532](aws/aws-cli#5532) &lt;https://github.com/aws/aws-cli/issues/5532&gt;</code>__</li>
<li>api-change:<code>apprunner</code>: App Runner adds support for seven new vCPU and memory configurations.</li>
<li>api-change:<code>config</code>: This release adds resourceType enums for types released in March 2023.</li>
<li>api-change:<code>ecs</code>: This is a document only updated to add information about Amazon Elastic Inference (EI).</li>
<li>api-change:<code>identitystore</code>: Documentation updates for Identity Store CLI command reference.</li>
<li>api-change:<code>ivs-realtime</code>: Fix ParticipantToken ExpirationTime format</li>
<li>api-change:<code>network-firewall</code>: AWS Network Firewall now supports IPv6-only subnets.</li>
<li>api-change:<code>servicecatalog</code>: removed incorrect product type value</li>
<li>api-change:<code>vpc-lattice</code>: This release removes the entities in the API doc model package for auth policies.</li>
</ul>
<h1>1.27.106</h1>
<ul>
<li>api-change:<code>amplifyuibuilder</code>: Support StorageField and custom displays for data-bound options in form builder. Support non-string operands for predicates in collections. Support choosing client to get token from.</li>
<li>api-change:<code>autoscaling</code>: Documentation updates for Amazon EC2 Auto Scaling</li>
<li>api-change:<code>dataexchange</code>: This release updates the value of MaxResults.</li>
<li>api-change:<code>ec2</code>: C6in, M6in, M6idn, R6in and R6idn bare metal instances are powered by 3rd Generation Intel Xeon Scalable processors and offer up to 200 Gbps of network bandwidth.</li>
<li>api-change:<code>elastic-inference</code>: Updated public documentation for the Describe and Tagging APIs.</li>
<li>api-change:<code>sagemaker-runtime</code>: Update sagemaker-runtime command to latest version</li>
<li>api-change:<code>sagemaker</code>: Amazon SageMaker Asynchronous Inference now allows customer's to receive failure model responses in S3 and receive success/failure model responses in SNS notifications.</li>
<li>api-change:<code>wafv2</code>: This release rolls back association config feature for webACLs that protect CloudFront protections.</li>
</ul>
<h1>1.27.105</h1>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aws/aws-cli/commit/300c55450414e611a461accc8d15857703c19e7a"><code>300c554</code></a> Merge branch 'release-1.27.109'</li>
<li><a href="https://github.com/aws/aws-cli/commit/0f39d4d98e418390fa46f9408a704d8e6ee17642"><code>0f39d4d</code></a> Bumping version to 1.27.109</li>
<li><a href="https://github.com/aws/aws-cli/commit/8c3681ff072698869446a23d15ade9b1124868dc"><code>8c3681f</code></a> Merge commit '23360bea246fc1d11ebd8c216fd29e5aa29695df' into stage-release-de...</li>
<li><a href="https://github.com/aws/aws-cli/commit/83b647ea31156d5c9cb848259fde52e7631776c4"><code>83b647e</code></a> Update changelog based on model updates</li>
<li><a href="https://github.com/aws/aws-cli/commit/746f66ed34139cf3832ff59052a1a4312de44c4f"><code>746f66e</code></a> Merge branch 'release-1.27.108'</li>
<li><a href="https://github.com/aws/aws-cli/commit/3d21d242ffc04df36e42234c5a2947844d7d7096"><code>3d21d24</code></a> Merge branch 'release-1.27.108' into develop</li>
<li><a href="https://github.com/aws/aws-cli/commit/2a7efe33c452a87877553d3f5fb56880aad19ea2"><code>2a7efe3</code></a> Bumping version to 1.27.108</li>
<li><a href="https://github.com/aws/aws-cli/commit/c52959e85c73f4701eef2f253cbf89e3419c8303"><code>c52959e</code></a> Update changelog based on model updates</li>
<li><a href="https://github.com/aws/aws-cli/commit/98e06f77e460e2cbf86ec8b5fe1231eefb0eba59"><code>98e06f7</code></a> Merge branch 'release-1.27.107'</li>
<li><a href="https://github.com/aws/aws-cli/commit/1f6b68f3f8e99a39ba6b5625699a3978f1c0f48c"><code>1f6b68f</code></a> Merge branch 'release-1.27.107' into develop</li>
<li>Additional commits viewable in <a href="https://github.com/aws/aws-cli/compare/1.27.104...1.27.109">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=awscli&package-manager=pip&previous-version=1.27.104&new-version=1.27.109)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
mergify bot pushed a commit to cdklabs/awscdk-asset-awscli that referenced this issue Apr 10, 2023
Bumps [awscli](https://github.com/aws/aws-cli) from 1.27.104 to 1.27.109.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/aws/aws-cli/blob/develop/CHANGELOG.rst">awscli's changelog</a>.</em></p>
<blockquote>
<h1>1.27.109</h1>
<ul>
<li>api-change:<code>dlm</code>: Updated timestamp format for GetLifecyclePolicy API</li>
<li>api-change:<code>docdb</code>: This release adds a new parameter 'DBClusterParameterGroupName' to 'RestoreDBClusterFromSnapshot' API to associate the name of the DB cluster parameter group while performing restore.</li>
<li>api-change:<code>fsx</code>: Amazon FSx for Lustre now supports creating data repository associations on Persistent_1 and Scratch_2 file systems.</li>
<li>api-change:<code>lambda</code>: This release adds a new Lambda InvokeWithResponseStream API to support streaming Lambda function responses. The release also adds a new InvokeMode parameter to Function Url APIs to control whether the response will be streamed or buffered.</li>
<li>api-change:<code>quicksight</code>: This release has two changes: adding the OR condition to tag-based RLS rules in CreateDataSet and UpdateDataSet; adding RefreshSchedule and Incremental RefreshProperties operations for users to programmatically configure SPICE dataset ingestions.</li>
<li>api-change:<code>redshift-data</code>: Update documentation of API descriptions as needed in support of temporary credentials with IAM identity.</li>
<li>api-change:<code>servicecatalog</code>: Updates description for property</li>
</ul>
<h1>1.27.108</h1>
<ul>
<li>api-change:<code>cloudformation</code>: Including UPDATE_COMPLETE as a failed status for DeleteStack waiter.</li>
<li>api-change:<code>greengrassv2</code>: Add support for SUCCEEDED value in coreDeviceExecutionStatus field. Documentation updates for Greengrass V2.</li>
<li>api-change:<code>proton</code>: This release adds support for the AWS Proton service sync feature. Service sync enables managing an AWS Proton service (creating and updating instances) and all of it's corresponding service instances from a Git repository.</li>
<li>api-change:<code>rds</code>: Adds and updates the SDK examples</li>
</ul>
<h1>1.27.107</h1>
<ul>
<li>bugfix:eks: Fix eks kubeconfig validations closes <code>[#6564](aws/aws-cli#6564) &lt;https://github.com/aws/aws-cli/issues/6564&gt;</code><strong>, fixes <code>[#4843](aws/aws-cli#4843) &lt;https://github.com/aws/aws-cli/issues/4843&gt;</code></strong>, fixes <code>[#5532](aws/aws-cli#5532) &lt;https://github.com/aws/aws-cli/issues/5532&gt;</code>__</li>
<li>api-change:<code>apprunner</code>: App Runner adds support for seven new vCPU and memory configurations.</li>
<li>api-change:<code>config</code>: This release adds resourceType enums for types released in March 2023.</li>
<li>api-change:<code>ecs</code>: This is a document only updated to add information about Amazon Elastic Inference (EI).</li>
<li>api-change:<code>identitystore</code>: Documentation updates for Identity Store CLI command reference.</li>
<li>api-change:<code>ivs-realtime</code>: Fix ParticipantToken ExpirationTime format</li>
<li>api-change:<code>network-firewall</code>: AWS Network Firewall now supports IPv6-only subnets.</li>
<li>api-change:<code>servicecatalog</code>: removed incorrect product type value</li>
<li>api-change:<code>vpc-lattice</code>: This release removes the entities in the API doc model package for auth policies.</li>
</ul>
<h1>1.27.106</h1>
<ul>
<li>api-change:<code>amplifyuibuilder</code>: Support StorageField and custom displays for data-bound options in form builder. Support non-string operands for predicates in collections. Support choosing client to get token from.</li>
<li>api-change:<code>autoscaling</code>: Documentation updates for Amazon EC2 Auto Scaling</li>
<li>api-change:<code>dataexchange</code>: This release updates the value of MaxResults.</li>
<li>api-change:<code>ec2</code>: C6in, M6in, M6idn, R6in and R6idn bare metal instances are powered by 3rd Generation Intel Xeon Scalable processors and offer up to 200 Gbps of network bandwidth.</li>
<li>api-change:<code>elastic-inference</code>: Updated public documentation for the Describe and Tagging APIs.</li>
<li>api-change:<code>sagemaker-runtime</code>: Update sagemaker-runtime command to latest version</li>
<li>api-change:<code>sagemaker</code>: Amazon SageMaker Asynchronous Inference now allows customer's to receive failure model responses in S3 and receive success/failure model responses in SNS notifications.</li>
<li>api-change:<code>wafv2</code>: This release rolls back association config feature for webACLs that protect CloudFront protections.</li>
</ul>
<h1>1.27.105</h1>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aws/aws-cli/commit/300c55450414e611a461accc8d15857703c19e7a"><code>300c554</code></a> Merge branch 'release-1.27.109'</li>
<li><a href="https://github.com/aws/aws-cli/commit/0f39d4d98e418390fa46f9408a704d8e6ee17642"><code>0f39d4d</code></a> Bumping version to 1.27.109</li>
<li><a href="https://github.com/aws/aws-cli/commit/8c3681ff072698869446a23d15ade9b1124868dc"><code>8c3681f</code></a> Merge commit '23360bea246fc1d11ebd8c216fd29e5aa29695df' into stage-release-de...</li>
<li><a href="https://github.com/aws/aws-cli/commit/83b647ea31156d5c9cb848259fde52e7631776c4"><code>83b647e</code></a> Update changelog based on model updates</li>
<li><a href="https://github.com/aws/aws-cli/commit/746f66ed34139cf3832ff59052a1a4312de44c4f"><code>746f66e</code></a> Merge branch 'release-1.27.108'</li>
<li><a href="https://github.com/aws/aws-cli/commit/3d21d242ffc04df36e42234c5a2947844d7d7096"><code>3d21d24</code></a> Merge branch 'release-1.27.108' into develop</li>
<li><a href="https://github.com/aws/aws-cli/commit/2a7efe33c452a87877553d3f5fb56880aad19ea2"><code>2a7efe3</code></a> Bumping version to 1.27.108</li>
<li><a href="https://github.com/aws/aws-cli/commit/c52959e85c73f4701eef2f253cbf89e3419c8303"><code>c52959e</code></a> Update changelog based on model updates</li>
<li><a href="https://github.com/aws/aws-cli/commit/98e06f77e460e2cbf86ec8b5fe1231eefb0eba59"><code>98e06f7</code></a> Merge branch 'release-1.27.107'</li>
<li><a href="https://github.com/aws/aws-cli/commit/1f6b68f3f8e99a39ba6b5625699a3978f1c0f48c"><code>1f6b68f</code></a> Merge branch 'release-1.27.107' into develop</li>
<li>Additional commits viewable in <a href="https://github.com/aws/aws-cli/compare/1.27.104...1.27.109">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=awscli&package-manager=pip&previous-version=1.27.104&new-version=1.27.109)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
@des1redState
Copy link

The problem is that if you have only one definition of a cluster, context or user in the ~/.kube/config file and you delete one of them then kubectl will set deleted type to null instead of [].

Then if you try to update-kubeconfig using aws cli command you will see an error:

  • if contexts: null: Tried to insert into contexts,which is a <class 'NoneType'> not a <class 'list'>
  • if users: null: Tried to insert into users,which is a <class 'NoneType'> not a <class 'list'>
  • if clusters: null: 'NoneType' object is not iterable

Simple workaround for above cases is to replace all null with [] then run aws cli update-kubeconfig command, like this:

sed -i 's/: null/: []/g' ~/.kube/config && \
aws eks --region ${AWS_REGION} update-kubeconfig --name ${EKS_CLUSTER_NAME}

Thank you for this. My issue was indeed resolved by changing users: null to users: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization Issues related to CLI customizations (located in /awscli/customizations) eks-kubeconfig feature-request A feature should be added or improved. has-pr This issue has a PR associated with it. p2 This is a standard priority issue
Projects
None yet