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

Handle empty instance_families #236

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ default: build
init-examples:
@echo "==> Creating symlinks for example/ projects to terraform-provider-castai binary"; \
TF_PROVIDER_FILENAME=terraform-provider-castai; \
GOOS=`go tool dist env | awk -F'=' '/^GOOS/ { print $$2}' | tr -d '"'`; \
GOARCH=`go tool dist env | awk -F'=' '/^GOARCH/ { print $$2}' | tr -d '"'`; \
GOOS=`go tool dist env | awk -F'=' '/^GOOS/ { print $$2}' | tr -d '";'`; \
aldor007 marked this conversation as resolved.
Show resolved Hide resolved
GOARCH=`go tool dist env | awk -F'=' '/^GOARCH/ { print $$2}' | tr -d '";'`; \
for examples in examples/eks examples/gke examples/aks ; do \
for tfproject in $$examples/* ; do \
TF_PROJECT_PLUGIN_PATH="$${tfproject}/terraform.d/plugins/registry.terraform.io/castai/castai/0.0.0-local/$${GOOS}_$${GOARCH}"; \
Expand Down
4 changes: 2 additions & 2 deletions castai/resource_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,10 @@ func toTemplateConstraints(obj map[string]any) *sdk.NodetemplatesV1TemplateConst
if v, ok := obj[FieldNodeTemplateFallbackRestoreRateSeconds].(int); ok {
out.FallbackRestoreRateSeconds = toPtr(int32(v))
}
if v, ok := obj[FieldNodeTemplateGpu].([]any); ok && len(v) > 0 {
if v, ok := obj[FieldNodeTemplateGpu].([]any); ok && len(v) > 0 && v[0] != nil {
linkas45 marked this conversation as resolved.
Show resolved Hide resolved
out.Gpu = toTemplateConstraintsGpuConstraints(v[0].(map[string]any))
}
if v, ok := obj[FieldNodeTemplateInstanceFamilies].([]any); ok && len(v) > 0 {
if v, ok := obj[FieldNodeTemplateInstanceFamilies].([]any); ok && len(v) > 0 && v[0] != nil {
out.InstanceFamilies = toTemplateConstraintsInstanceFamilies(v[0].(map[string]any))
}
if v, ok := obj[FieldNodeTemplateMaxCpu].(int); ok && v != 0 {
Expand Down
Loading