Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
github.com/mitchellh/go-homedir v1.1.0
github.com/syseleven/go-metakube v0.0.0-20250912102141-91146beb0bed
github.com/syseleven/go-metakube v0.0.0-20251002201927-c010577712bf
go.uber.org/zap v1.19.0
golang.org/x/mod v0.14.0
k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/syseleven/go-metakube v0.0.0-20250912102141-91146beb0bed h1:vnYgTQplP0cXDoBYFNLmaYiAZSExX24BZFUnqs4TXRQ=
github.com/syseleven/go-metakube v0.0.0-20250912102141-91146beb0bed/go.mod h1:KJB8m9a51Dcci9ee2pLwKetFm9MUrOAjDPAm5ZnOnHI=
github.com/syseleven/go-metakube v0.0.0-20251002201927-c010577712bf h1:ReXhQz+LAGkLFZKL2yl/1tUWtBah4WCrIpmSv+2u+QE=
github.com/syseleven/go-metakube v0.0.0-20251002201927-c010577712bf/go.mod h1:KJB8m9a51Dcci9ee2pLwKetFm9MUrOAjDPAm5ZnOnHI=
github.com/syseleven/terraform-plugin-sdk/v2 v2.31.0-sys11-2 h1:vywVVW9AnKcEiqgbZe16wwuaQaZ8VtMe+xmNBdvdMnU=
github.com/syseleven/terraform-plugin-sdk/v2 v2.31.0-sys11-2/go.mod h1:i2C41tszDjiWfziPQDL5R/f3Zp0gahXe5No/MIO9rCE=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
15 changes: 15 additions & 0 deletions metakube/resource_cluster_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,23 @@ func metakubeResourceClusterSpecFields() map[string]*schema.Schema {
ValidateFunc: validation.StringInSlice([]string{"cilium", "canal", "none"}, false),
Description: "Define the type of CNI plugin",
},
"cilium_cni_exclusive": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "Cilium cni-exclusive flag. If set to true, Cilium will delete non-Cilium CNI config files on nodes.",
},
},
},
//// ValidateFunc and ValidateDiagFunc are not supported on lists or sets.
// ValidateFunc: func(v interface{}, k string) (warnings []string, errors []error) {
// if v, ok := v.(map[string]interface{}); ok {
// if v["type"] != "cilium" && v["cilium_cni_exclusive"] != nil {
// errors = append(errors, fmt.Errorf("cilium_cni_exclusive is required when type is cilium"))
// }
// }
// return warnings, errors
// },
},
"ip_family": {
Type: schema.TypeString,
Expand Down
10 changes: 10 additions & 0 deletions metakube/resource_cluster_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func flattenCniPlugin(in *models.CNIPluginSettings) []interface{} {

m := make(map[string]interface{})
m["type"] = string(in.Type)
if in.Cilium != nil {
m["cilium_cni_exclusive"] = in.Cilium.CniExclusive
}

return []interface{}{m}
}
Expand Down Expand Up @@ -436,6 +439,13 @@ func expandCniPlugin(p []interface{}) *models.CNIPluginSettings {
obj.Type = models.CNIPluginType(vv)
}
}
if v, ok := in["cilium_cni_exclusive"]; ok {
if vv, ok := v.(bool); ok && obj.Type == models.CNIPluginType("cilium") {
obj.Cilium = &models.CiliumCNISettings{
CniExclusive: vv,
}
}
}

return obj
}
Expand Down