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

[BUG]: KubeloginInstallerV0 Cannot read properties of undefined (reading 'trim') #19097

Open
1 of 4 tasks
TeodoraEinoryte opened this issue Oct 11, 2023 · 14 comments
Open
1 of 4 tasks

Comments

@TeodoraEinoryte
Copy link

TeodoraEinoryte commented Oct 11, 2023

Task name

KubeloginInstallerV0

Task version

0.226.0

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure DevOps Server 2023.8

Operation system

Debian 12

Task log

Starting: KubeloginInstaller
==============================================================================
Task         : Kubelogin tool installer
Description  : Helps to install kubelogin
Version      : 0.226.0
Author       : Microsoft Corporation
Help         : https://azure.github.io/kubelogin/index.html
==============================================================================
##[error]Cannot read properties of undefined (reading 'trim')
Finishing: KubeloginInstaller

Relevant log output

##[error]Cannot read properties of undefined (reading 'trim')

Aditional info

Kubelogin version: 0.0.32
After restarting failed job, this task succeeds
@bartwitkowski
Copy link

Same problem here!

@Exchizz
Copy link

Exchizz commented Oct 11, 2023

I was also experiencing that issue ~30 mins ago on self-hosted agents.

It appears to have been fixed now - my pipelines are working again :)

@v-mohithgc v-mohithgc added the Area:RM RM task team label Oct 12, 2023
@v-mohithgc
Copy link
Contributor

v-mohithgc commented Oct 12, 2023

Hi everyone, thanks for reporting.
Can anyone confirm if this issue still persists? if so what's the reoccurrence rate?
I was just checking the source code of this task, and I don't see any recent changes deployed (last change was 2 months back), so ig it's unlikely this issue might be from the task end.

Can anyone confirm if this issue is fixed? if not, can you enable the debug logs (system.debug=true) and send us the failure logs to v-mohithgc @microsoft.com.

Thanks

@TeodoraEinoryte
Copy link
Author

TeodoraEinoryte commented Oct 12, 2023

Hello, thanks for the response. This issue appears from time to time, like once a week for us on multiple pipelines. It existed all the time since we started using kubelogin task (for a month now).
I will try to capture output with debug logs.

Edit: logs sent to the provided email

@Exchizz
Copy link

Exchizz commented Oct 12, 2023

I was experiencing the issue yesterday for about 1 hour (on self hosted agents).

EDIT: We've started to experience the issue again

@YevheniiKholodkov
Copy link
Contributor

Hello,
Thank you for reporting the issue.

The root cause of the issue is that the task is making an anonymous REST API call to GitHub in order to fetch the latest version of kubelogin. However, anonymous calls in GitHub are subject to a limit of 60 requests per hour. When a 403 error occurs in the task, it is not being handled properly, leading to a failure later in the code when attempting to use the version tag. Hence, you see the error "cannot read property of undefined".

There is no way to provide credentials to the task to make an authorized rest api call with a rate limit of 5000 calls per hour.
However, there are 2 possible workarounds.
The first one is to specify the version explicitly in the task. This way we will skip the call to github to retrieve the latest version. For example,

  • task: KubeloginInstaller@0
    inputs:
    kubeloginVersion: 0.0.30
    The second one is to avoid using KubeloginInstaller task and install kubelogin on the VM where you run the self-hosted agent and add to it to the PATH. The tasks that use kubelogin should pick it up there.

We will be working on a fix , but there is no ETA at the moment.

(Note. This issue is unlikly to happen on Microsoft Hosted agents because a new agent is assigned to each pipeline run )

@TeodoraEinoryte
Copy link
Author

Thank you very much for your response and your suggestions on how to resolve the issue!

@sivetic
Copy link

sivetic commented Feb 16, 2024

Is there any update on this issue? We are required to use kubelogin for AKS + Azure AD + Azure RBAC integration, and the task fails often enough to make this a serious challenge for teams.

@sivetic
Copy link

sivetic commented Feb 16, 2024

The first one is to specify the version explicitly in the task. This way we will skip the call to github to retrieve the latest version. For example,

  • task: KubeloginInstaller@0
    inputs:
    kubeloginVersion: 0.0.30

Wouldn't specifying the version explicitly also hit the GitHub API rate limit? It seems getKubeloginRelease() is called which queries the API:

let request = new webClient.WebRequest();
request.uri = 'https://api.github.com/repos/' + KUBELOGIN_REPO_OWNER + '/' + KUBELOGIN_REPO + '/releases/tags/' + version;
request.method = 'GET';
request.headers = request.headers || {};
request.headers['User-Agent'] = userAgent;

const response = await webClient.sendRequest(request);

@matthawley
Copy link

@sivetic is right -we've specified a version, and we consistently still get rate limited. We need to find a different solution until this gets resolved as it's pretty impactful to our pipelines.

@sivetic
Copy link

sivetic commented Apr 5, 2024

@matthawley A quick workaround we do is to replace the official task with a bash/PS script:

- bash: |
   curl -fsSLO https://github.com/Azure/kubelogin/releases/download/v0.1.1/kubelogin-linux-amd64.zip
   unzip -ojd /usr/local/bin kubelogin-linux-amd64.zip bin/linux_amd64/kubelogin
   rm -f kubelogin-linux-amd64.zip
   kubelogin --version
   
  displayName: 'Install Kubelogin'

@matthawley
Copy link

@sivetic Nice - I'll give this a try!

@SamirFarhat
Copy link

@matthawley A quick workaround we do is to replace the official task with a bash/PS script:

- bash: |
   curl -fsSLO https://github.com/Azure/kubelogin/releases/download/v0.1.1/kubelogin-linux-amd64.zip
   unzip -ojd /usr/local/bin kubelogin-linux-amd64.zip bin/linux_amd64/kubelogin
   rm -f kubelogin-linux-amd64.zip
   kubelogin --version
   
  displayName: 'Install Kubelogin'

Thank you, this works great

@Deekshitha981
Copy link
Collaborator

We are currently working on the fix, will update as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants