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 YAML template for Kubernetes on GCP #478

Merged
merged 2 commits into from
Dec 13, 2022
Merged

Conversation

scottslowe
Copy link
Contributor

This PR fixes issues with the YAML template for Kubernetes on GCP, which was affected by the issue described in #477. No other templates were identified as being affected by #477.

This PR fixes #477.

Remove type statements for provider-namespace configuration values. Change from default to value to assign initial value.

Signed-off-by: Scott Lowe <slowe@pulumi.com>
Comment on lines 17 to 20
gcp:project:
type: string
value: changeme
gcp:region:
type: string
default: us-central1
value: us-central1
Copy link
Member

@cnunciato cnunciato Dec 10, 2022

Choose a reason for hiding this comment

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

I think the fix for this is to remove these provider config settings from the root config block (the program block), as they'll be written to Pulumi.{stack}.yaml during pulumi new with defaults from the template block. When I run pulumi new with this branch, for example, I don't see changeme in the CLI prompt as a default, and after creation, I get empty string:

config:
  asasdasdfa:nodesPerZone: "1"
  gcp:project: ""
  gcp:region: us-central1

Tried with 3.48 and 3.49 and got the same result. Looking at other *-gcp-yaml templates, it seems they all keep these confined to template.config, so we should be good just removing them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't leave those out; they are referenced later in the template. In order to be able to reference them later, they have to be included in the config block. And there has to be at least a value key under each of them, because the template won't work otherwise.

Copy link
Member

@cnunciato cnunciato Dec 10, 2022

Choose a reason for hiding this comment

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

I see, ok. Well if this fixes it, let’s go ahead and merge — we can always come back it. Thanks for the explanation and the fix!

Copy link
Member

Choose a reason for hiding this comment

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

cc @aq17 @AaronFriel Curious what we would expect to be used here? It doesn't feel right to require that we include dummy values like this?

Copy link
Contributor

@aq17 aq17 Dec 10, 2022

Choose a reason for hiding this comment

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

Yes, for keys that should have a default, using value instead of type and default is correct. Agree that using a dummy key isn’t ideal but workable for now; one idea could be to add a required option in lieu of value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it is possible to omit gcp:project and gcp:region from the template and still reference them; when running pulumi up, you should get

    warning: unable to detect a global setting for GCP Project;
    Pulumi will rely on per-resource settings for this operation.
    Set the GCP Project by using:
    	`pulumi config set gcp:project <project>` 

if it isn't set in your stack config, which seems preferable to using dummy values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aq17 Interesting; I was under the impression that the only way to use a configuration value (provider-namespaced or otherwise) was to include it in the config block (the template does reference gcp:project later on). I'll try removing it from the config block and report back.

Copy link
Member

Choose a reason for hiding this comment

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

I think the fix for this is to remove these provider config settings from the root config block

Actually, it is possible to omit gcp:project and gcp:region from the template and still reference them

Finally got a chance to try this locally myself, and just removing those two settings does seem to do the trick, yeah.

We should also remove them from the template's page on pulumi.com: https://www.pulumi.com/templates/kubernetes/gcp/#customizing-the-project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also tested this locally and it seemed to work; I wanted to run one more set of tests to be sure. Agreed that if we remove these settings we need to update the landing page as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've run a few tests and can't find any ill effects from removing gcp:project and gcp:region from the top-level config block, so I'll push another commit that just removes those and re-request reviews before merging.

Comment on lines 17 to 20
gcp:project:
type: string
value: changeme
gcp:region:
type: string
default: us-central1
value: us-central1
Copy link
Member

@cnunciato cnunciato Dec 10, 2022

Choose a reason for hiding this comment

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

I see, ok. Well if this fixes it, let’s go ahead and merge — we can always come back it. Thanks for the explanation and the fix!

Remove provider configuration values from top-level config block

Signed-off-by: Scott Lowe <slowe@pulumi.com>
@scottslowe scottslowe merged commit ae60b7f into master Dec 13, 2022
@scottslowe scottslowe deleted the slowe/fix-issue-477 branch December 13, 2022 21:07
dirien pushed a commit to dirien/templates that referenced this pull request Mar 29, 2023
* Fix YAML template for Kubernetes on GCP

Remove type statements for provider-namespace configuration values. Change from default to value to assign initial value.

Signed-off-by: Scott Lowe <slowe@pulumi.com>

* Remove provider configuration values

Remove provider configuration values from top-level config block

Signed-off-by: Scott Lowe <slowe@pulumi.com>

Signed-off-by: Scott Lowe <slowe@pulumi.com>
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.

Provider-namespace configuration values should not have a type
4 participants