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 for k0s install bypass #5

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions internal/provider/k0s_config_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,19 @@ func (r *K0sctlConfigResource) Create(ctx context.Context, req resource.CreateRe
RestoreFrom: kcsm.RestoreFrom.ValueString(),
}

kcsm.KubeYaml = types.StringNull()
kcsm.KubeHost = types.StringNull()
kcsm.CaCert = types.StringNull()
kcsm.PrivateKey = types.StringNull()
kcsm.ClientCert = types.StringNull()
kcsm.Id = kcsm.Metadata.Name

if kcsm.SkipCreate.ValueBool() {
resp.Diagnostics.AddWarning("skipping create", "Skipping the k0sctl create because of configuration flag.")
resp.Diagnostics.Append(resp.State.Set(ctx, kcsm)...)
} else if r.testingMode {
resp.Diagnostics.AddWarning("testing mode warning", "k0sctl config resource handler is in testing mode, no installation will be run.")

kcsm.KubeYaml = types.StringNull()
kcsm.KubeHost = types.StringNull()
kcsm.CaCert = types.StringNull()
kcsm.PrivateKey = types.StringNull()
kcsm.ClientCert = types.StringNull()

kcsm.Id = kcsm.Metadata.Name

if diags := resp.State.Set(ctx, kcsm); diags != nil {
resp.Diagnostics.Append(diags...)
}
resp.Diagnostics.Append(resp.State.Set(ctx, kcsm)...)
} else if err := aa.Run(); err != nil {
resp.Diagnostics.Append(diag.NewErrorDiagnostic("error running k0sctl apply", err.Error()))
} else {
Expand Down
Loading