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

Fix EKS error "failed to get cloud data" #105

Merged
merged 3 commits into from
Sep 19, 2024
Merged

Conversation

comrumino
Copy link
Contributor

@comrumino comrumino commented Sep 19, 2024

Fixes #106; see my commit messages for a more detailed description of the changes made and links to known module version issues.

Testing GetContextName

I added test coverage for EKSSupport.GetContextName to validate the change I made.

If you would like to manually reproduce the issue, change .kube/config for a valid connection such that the context key-value for cluster is not an ARN. See below for an example config to reproduce the issue.

contexts:
- context:
    cluster: my-cluster
    user: arn:aws:eks:us-west-2:12345678910:cluster/my-cluster
    name: my-cluster
clusters:
- cluster:
    certificate-authority-data: ...
    server: https://....sk1.us-west-2.eks.amazonaws.com
    name: my-cluster

…he current context name is the cluster name;

This enhancement resolves the error:
    `failed to get cloud data. resourceKind: ClusterDescribe; error: operation error EKS: DescribeCluster, serialization failed: serialization failed: input member name must not be empty`
If cluster name is not an ARN or equal to the context name,
EKSSupport.GetContextName will return an empty string and log
serialization failed.

Signed-off-by: comrumino <comrumino@archstrike.org>
…spect to non-ARN context names; added SetConnectedToCluster to tearDown to make test results more predictable.

Signed-off-by: comrumino <comrumino@archstrike.org>
…cloud data. resourceKind: ClusterDescribe; error: not found, ResolveEndpointV2`. This error is a known issue regarding incompatible service module versions. Refer to aws/aws-sdk-go-v2#2370 (comment) for more details.

Signed-off-by: comrumino <comrumino@archstrike.org>
@comrumino comrumino changed the title Enhanced EKSSupport.GetContextName Fix EKS error "failed to get cloud data" Sep 19, 2024
Copy link
Contributor

@matthyx matthyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @comrumino !

@matthyx matthyx merged commit a719e19 into kubescape:main Sep 19, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EKS Support: failed to get cloud data
2 participants