GitHub Action for setting context (retrieving Kubeconfig) before interacting with Kubernetes cluster
Перейти к файлу
dependabot[bot] ed9816d2f2
Bump the actions group across 1 directory with 3 updates (#131)
Bumps the actions group with 3 updates in the / directory: [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest), [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) and [typescript](https://github.com/microsoft/TypeScript).


Updates `@types/jest` from 29.5.13 to 29.5.14
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Updates `@types/node` from 22.7.5 to 22.8.7
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `typescript` from 5.6.2 to 5.6.3
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.6.3)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-06 15:05:42 -05:00
.github Bump the actions group in /.github/workflows with 3 updates (#118) 2024-09-11 15:20:07 -04:00
src remove deprecated crypto package (#111) 2024-02-09 14:08:06 -05:00
.gitignore refactor (#45) 2022-02-04 14:09:43 -05:00
.prettierignore Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00
.prettierrc.json Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00
CHANGELOG.md 4.0.1 Changelog (#120) 2024-09-09 10:21:26 -04:00
CODE_OF_CONDUCT.md Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00
LICENSE Initial commit 2019-09-03 23:06:59 -07:00
README.md fix version (#126) 2024-10-10 12:12:12 -04:00
SECURITY.md Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00
action.yml separate execution and run function, bump release workflow hash (#109) 2024-02-09 12:44:55 -05:00
jest.config.js Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00
package-lock.json Bump the actions group across 1 directory with 3 updates (#131) 2024-11-06 15:05:42 -05:00
package.json Bump the actions group across 1 directory with 3 updates (#131) 2024-11-06 15:05:42 -05:00
tsconfig.json Code consistency using prettier (#73) 2022-06-27 13:34:55 -04:00

README.md

Azure Kubernetes Service set context

This action can be used to set cluster context before other actions like azure/k8s-deploy and azure/k8s-create-secret. Any kubectl commands (in script) can also be run subsequently in the workflow.

You must run Azure/login before this action.

Action inputs

Action inputs Description
resource-group
(Required)
Resource group containing the AKS cluster
cluster-name
(Required)
Name of the AKS cluster
subscription Subscription tied to AKS cluster
admin Get cluster admin credentials. Values: true or false
use-kubelogin Allows non-admin users to use the Action via kubelogin
public-fqdn Get private cluster credential with server address to be public fqdn

Example

- uses: azure/login@v2
  with:
     client-id: ${{ secrets.AZURE_CLIENT_ID }}
     tenant-id: ${{ secrets.AZURE_TENANT_ID }}
     subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- uses: azure/aks-set-context@v4
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'

Service Principal Authentication

- uses: azure/login@v2
  with:
     creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/aks-set-context@v4
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'

Kubelogin

kubelogin is at the core of the non-admin user scenario. For more information on kubelogin, refer to the documentation here.

To run this Action as a non-admin user, you must first install kubelogin. To set up kubelogin, you may use the action azure/use-kubelogin:

- name: Set up kubelogin for non-interactive login
  uses: azure/use-kubelogin@v2
  with:
     kubelogin-version: 'v0.0.24'

Non-Admin User Example

If you are executing this Action as a non-admin user, you need to toggle the optional use-kubelogin Action input to true for it to work.

- uses: azure/login@v2
  with:
     client-id: ${{ secrets.AZURE_CLIENT_ID }}
     tenant-id: ${{ secrets.AZURE_TENANT_ID }}
     subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- uses: azure/aks-set-context@v4
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'
     admin: 'false'
     use-kubelogin: 'true'
- uses: azure/login@v2
  with:
     creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/aks-set-context@v4
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'
     admin: 'false'
     use-kubelogin: 'true'

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Support

aks-set-context is an open source project that is not covered by the Microsoft Azure support policy. Please search open issues here, and if your issue isn't already represented please open a new one. The project maintainers will respond to the best of their abilities.