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

Add SSA merge strategy to container NodePool's nodeConfig to avoid fights over ownership. #457

Merged
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
15 changes: 15 additions & 0 deletions apis/container/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions apis/container/v1beta1/zz_nodepool_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/container/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ func Configure(p *config.Provider) { //nolint:gocyclo
Extractor: common.ExtractResourceIDFuncPath,
}

r.ServerSideApplyMergeStrategies["node_config"] = config.MergeStrategy{
ListMergeStrategy: config.ListMergeStrategy{
MergeStrategy: config.ListTypeMap,
ListMapKeys: config.ListMapKeys{
InjectedKey: config.InjectedKey{
Key: "index",
DefaultValue: `"0"`,
},
},
},
}

r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if diff == nil || diff.Destroy {
return diff, nil
Expand Down
24 changes: 24 additions & 0 deletions package/crds/container.gcp.upbound.io_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ spec:
type: array
imageType:
type: string
index:
default: "0"
description: This is an injected field with a default value
for being able to merge items of the parent object list.
type: string
kubeletConfig:
items:
properties:
Expand Down Expand Up @@ -553,6 +558,9 @@ spec:
type: array
type: object
type: array
x-kubernetes-list-map-keys:
- index
x-kubernetes-list-type: map
nodeCount:
description: |-
The number of nodes per instance group. This field can be used to
Expand Down Expand Up @@ -856,6 +864,11 @@ spec:
type: array
imageType:
type: string
index:
default: "0"
description: This is an injected field with a default value
for being able to merge items of the parent object list.
type: string
kubeletConfig:
items:
properties:
Expand Down Expand Up @@ -1066,6 +1079,9 @@ spec:
type: array
type: object
type: array
x-kubernetes-list-map-keys:
- index
x-kubernetes-list-type: map
nodeCount:
description: |-
The number of nodes per instance group. This field can be used to
Expand Down Expand Up @@ -1552,6 +1568,11 @@ spec:
type: array
imageType:
type: string
index:
default: "0"
description: This is an injected field with a default value
for being able to merge items of the parent object list.
type: string
kubeletConfig:
items:
properties:
Expand Down Expand Up @@ -1686,6 +1707,9 @@ spec:
type: array
type: object
type: array
x-kubernetes-list-map-keys:
- index
x-kubernetes-list-type: map
nodeCount:
description: |-
The number of nodes per instance group. This field can be used to
Expand Down
Loading