Skip to content

fix(cli): remove invalid character for kubernetes provider in implicit non-obvious plan #10228

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

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Oct 11, 2023

Introduced by #10132.

When running exp scaletest create-workspaces against a kubernetes cluster:

Planning workspace...
==> ⧗ Queued
=== ✔ Queued [0ms]
==> ⧗ Running
=== ✔ Running [22ms]
==> ⧗ Setting up
=== ✔ Setting up [43ms]
==> ⧗ Detecting persistent resources
=== ✔ Detecting persistent resources [4483ms]
==> ⧗ Cleaning Up
=== ✘ Cleaning Up [27ms]
=== ✘ Cleaning Up [48ms]
Encountered an error running "coder exp scaletest create-workspaces"
prepare build:
    github.com/coder/coder/v2/cli.(*RootCmd).scaletestCreateWorkspaces.func1
        /home/runner/actions-runner/_work/coder/coder/cli/exp_scaletest.go:616
  - dry-run workspace:
    github.com/coder/coder/v2/cli.prepWorkspaceBuild
        /home/runner/actions-runner/_work/coder/coder/cli/create.go:311
  - run dry-run provision job: terraform plan: exit status 1

The function prepWorkspaceBuild actually does a terraform plan under the hood.
So in effect I was passing scaletest-% to kubectl create pod, which the Kuberentes terraform provider really hates, but apparently the kreuzwerker Docker provider is cool with.

However, if we need to do a plan to get rich parameters, then the --no-plan parameter for exp scaletest create-workspaces isn't really an option. Or am I misunderstanding?

@johnstcn johnstcn self-assigned this Oct 11, 2023
@johnstcn johnstcn requested review from mafredri and mtojek October 11, 2023 20:50
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Not blocking

The function prepWorkspaceBuild actually does a terraform plan under the hood.

Do you mean this in create.go or something else:

	// Run a dry-run with the given parameters to check correctness
	dryRun, err := client.CreateTemplateVersionDryRun(inv.Context(), templateVersion.ID, codersdk.CreateTemplateVersionDryRunRequest{
		WorkspaceName:       args.NewWorkspaceName,
		RichParameterValues: buildParameters,
	})

@@ -607,7 +602,7 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
richParameters, err := prepWorkspaceBuild(inv, client, prepWorkspaceBuildArgs{
Action: WorkspaceCreate,
Template: tpl,
NewWorkspaceName: "scaletest-%", // TODO: the scaletest runner will pass in a different name here. Does this matter?
NewWorkspaceName: "scaletest-N", // TODO: the scaletest runner will pass in a different name here. Does this matter?
Copy link
Member

Choose a reason for hiding this comment

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

I presume that the comment is still valid?

Copy link
Member Author

Choose a reason for hiding this comment

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

As we saw, it does appear to matter if NewWorkspaceName ends up not being valid :-)

@johnstcn
Copy link
Member Author

Not blocking

The function prepWorkspaceBuild actually does a terraform plan under the hood.

Do you mean this in create.go or something else:

	// Run a dry-run with the given parameters to check correctness
	dryRun, err := client.CreateTemplateVersionDryRun(inv.Context(), templateVersion.ID, codersdk.CreateTemplateVersionDryRunRequest{
		WorkspaceName:       args.NewWorkspaceName,
		RichParameterValues: buildParameters,
	})

Yes, correct. I vaguely recall this being necessary for rich parameters to work?

@johnstcn johnstcn merged commit 1e75762 into main Oct 12, 2023
@johnstcn johnstcn deleted the cj/scaletest-parameters-fix branch October 12, 2023 08:21
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants