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

[clusterctl] "clusterctl config provider" fails to show AWS, VSphere, and Azure info #2876

Closed
sedefsavas opened this issue Apr 7, 2020 · 12 comments · Fixed by #2905
Closed
Assignees
Labels
area/clusterctl Issues or PRs related to clusterctl kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@sedefsavas
Copy link

What steps did you take and what happened:

Running clusterctl config provider --infrastructure aws gives the following error:

Error: failed to perform variable substitution: value for variables [AWS_B64ENCODED_CREDENTIALS] is not set. Please set the value using os environment variables or the clusterctl config file

What did you expect to happen:
I expected it to run without needing any variables similar to other providers.

/kind bug
/area clusterctl

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. area/clusterctl Issues or PRs related to clusterctl labels Apr 7, 2020
@vincepri
Copy link
Member

vincepri commented Apr 8, 2020

/close

We expect variables to be present to generate configuration.

@randomvariable mentioned during today's meeting that need for credentials might be removed.

@k8s-ci-robot
Copy link
Contributor

@vincepri: Closing this issue.

In response to this:

/close

We expect variables to be present to generate configuration.

@randomvariable mentioned during today's meeting that need for credentials might be removed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@CecileRobertMichon
Copy link
Contributor

@vincepri @fabriziopandini thinking about this more, custerctl config provider is supposed to list info about a provider. 
It doesn’t generate a config or deploy any infrastructure, so not sure why it needs credentials...

FWIW the same is true with Azure:

clusterctl config provider --infrastructure azure                                                           
Error: failed to perform variable substitution: value for variables [AZURE_CLIENT_ID_B64, AZURE_CLIENT_SECRET_B64, AZURE_SUBSCRIPTION_ID_B64, AZURE_TENANT_ID_B64] is not set. Please set the value using os environment variables or the clusterctl config file

After exporting the credentials:

clusterctl config provider --infrastructure azure                                                                ✔  10270  10:31:28
Name:               azure
Type:               InfrastructureProvider
URL:                https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/latest/infrastructure-components.yaml
Version:            v0.4.1
TargetNamespace:    capz-system
WatchingNamespace:
Variables:
  - AZURE_CLIENT_ID_B64
  - AZURE_CLIENT_SECRET_B64
  - AZURE_SUBSCRIPTION_ID_B64
  - AZURE_TENANT_ID_B64
Images:
  - gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
  - us.gcr.io/k8s-artifacts-prod/cluster-api-azure/cluster-api-azure-controller:v0.4.1
  - gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
  - us.gcr.io/k8s-artifacts-prod/cluster-api-azure/cluster-api-azure-controller:v0.4.1

@CecileRobertMichon
Copy link
Contributor

Also this works which proves the command doesn't need credentials to work:

export AWS_B64ENCODED_CREDENTIALS=fakecreds                                                          ]
 clusterctl config provider --infrastructure aws                                                               
Name:               aws
Type:               InfrastructureProvider
URL:                https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/latest/infrastructure-components.yaml
Version:            v0.5.2
TargetNamespace:    capa-system
WatchingNamespace:
Variables:
  - AWS_B64ENCODED_CREDENTIALS
Images:
  - gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
  - us.gcr.io/k8s-artifacts-prod/cluster-api-aws/cluster-api-aws-controller:v0.5.2
  - gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
  - us.gcr.io/k8s-artifacts-prod/cluster-api-aws/cluster-api-aws-controller:v0.5.2

@sedefsavas sedefsavas changed the title [clusterctl] "clusterctl config provider" fails to show AWS info [clusterctl] "clusterctl config provider" fails to show AWS, VSphere, and Azure info Apr 8, 2020
@sedefsavas
Copy link
Author

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Apr 8, 2020
@k8s-ci-robot
Copy link
Contributor

@sedefsavas: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nader-ziada
Copy link
Contributor

/assign

@vincepri
Copy link
Member

/milestone v0.3.x

@fabriziopandini
Copy link
Member

fabriziopandini commented Apr 15, 2020

custerctl config provider is supposed to list info about a provider. 
It doesn’t generate a config or deploy any infrastructure, so not sure why it needs credentials...

Two comments about this:

  1. It requires all variables to be set, not only credentials
  2. custerctl config provider is the -o yaml options that is the only way for a user to get a preview of the yaml that will be applied to a cluster

If we are going to make the command to work without variable substitution, we are losing the option to run o get a preview of the yaml that will be applied to a cluster, which can be useful.

I see three options:

  • Have a different behavior between custerctl config provider (not requiring variables) and custerctl config provider -o yaml (requiring variables)
  • Go for a middle-ground solution: if variables are available use them, but tolerate missing variables
  • Drop the possibility to have a preview of the yaml that will be applied to a cluster

I'm for the middle-ground solution option. opinions?

@CecileRobertMichon
Copy link
Contributor

CecileRobertMichon commented Apr 15, 2020

If we are going to make the command to work without variable substitution, we are losing the option to run o get a preview of the yaml that will be applied to a cluster, which can be useful.

Isn't that what clusterctl config cluster does?

clusterctl config                                                         ✔  10738  16:50:25
Display provider configuration and templates to create workload clusters.

Usage:
  clusterctl config [command]

Available Commands:
  cluster      Generate templates for creating workload clusters.
  provider     Display information about a provider.
  repositories Display the list of providers and their repository configurations.

If is the only way for a user to get a preview of the yaml that will be applied to a cluster is true then maybe that means we are overloading the clusterctl config provider command to start with... The command is documented as Display information about a provider.

@fabriziopandini
Copy link
Member

@CecileRobertMichon clusterctl config cluster gives you the cluster template yaml, while clusterctl config provider gives you the component yaml (your provider yaml)

@CecileRobertMichon
Copy link
Contributor

edit: I realized that by "a preview of the yaml that will be applied to a cluster" you meant the infra components, not the cluster resources.

In that case I think solution 2) makes sense - the command shouldn't fail if variables are missing since it still provides valuable information and should just replace the variables if they are present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterctl Issues or PRs related to clusterctl kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants