Skip to content

Further IPAM simplifcations#10569

Merged
tgraf merged 8 commits intomasterfrom
pr/tgraf/ipam-simplifcations
Mar 21, 2020
Merged

Further IPAM simplifcations#10569
tgraf merged 8 commits intomasterfrom
pr/tgraf/ipam-simplifcations

Conversation

@tgraf
Copy link
Copy Markdown
Contributor

@tgraf tgraf commented Mar 13, 2020

This PR includes further simplifications of the IPAM code to reduce the IPAM module-specific code and to simplify the introduction of additional modes.


This change is Reviewable

@tgraf tgraf added wip area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. area/eni Impacts ENI based IPAM. labels Mar 13, 2020
@tgraf tgraf requested a review from a team March 13, 2020 09:49
@tgraf tgraf requested review from a team as code owners March 13, 2020 09:49
@maintainer-s-little-helper
Copy link
Copy Markdown

Release note label not set, please set the appropriate release note.

4 similar comments
@maintainer-s-little-helper
Copy link
Copy Markdown

Release note label not set, please set the appropriate release note.

@maintainer-s-little-helper
Copy link
Copy Markdown

Release note label not set, please set the appropriate release note.

@maintainer-s-little-helper
Copy link
Copy Markdown

Release note label not set, please set the appropriate release note.

@maintainer-s-little-helper
Copy link
Copy Markdown

Release note label not set, please set the appropriate release note.

@tgraf tgraf added release-note/misc This PR makes changes that have no direct user impact. and removed area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. labels Mar 13, 2020
@tgraf tgraf added the integration/cloud Related to integration with cloud environments such as AKS, EKS, GKE, etc. label Mar 13, 2020
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 13, 2020

Coverage Status

Coverage decreased (-0.02%) to 45.581% when pulling 274531b on pr/tgraf/ipam-simplifcations into 8462fe6 on master.

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Mar 13, 2020

test-me-please

@tgraf tgraf added pending-review and removed wip labels Mar 13, 2020
@tgraf tgraf force-pushed the pr/tgraf/ipam-simplifcations branch from b011ecd to 053e5ab Compare March 18, 2020 11:14
@tgraf tgraf requested a review from a team as a code owner March 18, 2020 11:14
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Mar 18, 2020

test-me-please

Single test failed:

 Suite-k8s-1.11.K8sUpdates Tests upgrade and downgrade from a Cilium stable image to master

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Mar 18, 2020

test-me-please

@tgraf tgraf added pending-review and removed wip labels Mar 19, 2020
tgraf added 7 commits March 20, 2020 23:37
The field has been obsoleted in favour of Spec.IPAM.PreAllocate. It no
longer makes sense to initialize this to the default if unset.

This change is backwards compatible because even the operator is
upgraded after a respective Cilium node, it would still fall back to
this default value. The value in the Spec field is primiarly for
documentation purposes when set to the default value.

Signed-off-by: Thomas Graf <thomas@cilium.io>
The sole use of PopulateSpecFields() is to set Spec.ENI.PreAllocate.
Given this field has been moved to Spec.IPAM.PreAllocate, it can be set
in the generic IPAM layer and thus PopulateSpecFields() can be removed
entirely.

Signed-off-by: Thomas Graf <thomas@cilium.io>
The allocation limits have been moved into a generic section of the
CilumNode resource so it is no longer required for the specific IPAM
implementation to implement the retrieval of these values.

This means that some ENI specific code will live in pkg/ipam for
backwards compatibility, it can be removed in Cilium 1.9.

This also resolves an indirect data race: It is now guarnteed and
documented that n.resource is locked while accessing whereas previously,
the pointer to the CiliumNode was unprotected in the IPAM specific node
structure. It was indirectly protected via the n.mutex though.

Signed-off-by: Thomas Graf <thomas@cilium.io>
All IPAM modes relying on external APIs require an instance ID of some
sort. Instead of requiring each IPAM module to carry this in a separate
sub-level spec, add it to the top-level. This allows to remove AzureSpec
entirely and it also allows to remove LogFields() from the interface.

Spec.ENI.InstanceID continues to be supported. Spec.Azure.InstanceID can
be safely removed as it has not been released yet.

Signed-off-by: Thomas Graf <thomas@cilium.io>
Some ENI references where left over due to basing this code off the ENI
implementation. Remove them.

Signed-off-by: Thomas Graf <thomas@cilium.io>
Ensure that deep copies are made for data being passed in to avoid cross
contamination between tests.

Signed-off-by: Thomas Graf <thomas@cilium.io>
Fixes:
```
WARNING: DATA RACE
Read at 0x00c000340628 by goroutine 37:
  github.com/cilium/cilium/pkg/ipam.(*nodeOperationsMock).PrepareIPAllocation()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager_test.go:95 +0x123
  github.com/cilium/cilium/pkg/ipam.(*Node).determineMaintenanceAction()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:475 +0x8ce
  github.com/cilium/cilium/pkg/ipam.(*Node).maintainIPPool()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:506 +0x53
  github.com/cilium/cilium/pkg/ipam.(*Node).MaintainIPPool()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:572 +0x90
  github.com/cilium/cilium/pkg/ipam.(*NodeManager).Update.func1()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager.go:210 +0x8b
  github.com/cilium/cilium/pkg/trigger.(*Trigger).waiter()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/trigger/trigger.go:206 +0x4b9

Previous write at 0x00c000340628 by goroutine 35:
  github.com/cilium/cilium/pkg/ipam.(*nodeOperationsMock).AllocateIPs()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager_test.go:101 +0xe0
  github.com/cilium/cilium/pkg/ipam.(*Node).maintainIPPool()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:542 +0xa0d
  github.com/cilium/cilium/pkg/ipam.(*Node).MaintainIPPool()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node.go:572 +0x90
  github.com/cilium/cilium/pkg/ipam.(*NodeManager).Update.func1()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/ipam/node_manager.go:210 +0x8b
  github.com/cilium/cilium/pkg/trigger.(*Trigger).waiter()
      /home/vagrant/go/src/github.com/cilium/cilium/pkg/trigger/trigger.go:206 +0x4b9
```

Signed-off-by: Thomas Graf <thomas@cilium.io>
@tgraf tgraf force-pushed the pr/tgraf/ipam-simplifcations branch from 053e5ab to 274531b Compare March 20, 2020 22:46
@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Mar 20, 2020

test-me-please

@tgraf
Copy link
Copy Markdown
Contributor Author

tgraf commented Mar 21, 2020

test-me-please

Flake:

Suite-k8s-1.11.K8sServicesTest Checks service across nodes Tests NodePort BPF Tests with direct routing Tests with MetalLB Connectivity to endpoint via LB

@tgraf tgraf merged commit da14950 into master Mar 21, 2020
@tgraf tgraf deleted the pr/tgraf/ipam-simplifcations branch March 21, 2020 20:42
christarazi added a commit that referenced this pull request May 14, 2020
This commit adds shortName and all CRD names via markers. It also
updates the Validation schema via markers which the old method of
hardcoding had a few fields missing / incorrect.

Here's a summary of the main differences in the validation schema:

1) Old schema had eniTypes.ENISpec.MaxAllocate, which doesn't exist. It
   exists under ipamTypes.IPAMSpec.MaxAllocate.
2) Old schema was missing eniTypes.ENISpec.{InstanceID,InstanceType},
   which is now included in this new generated schema.
3) Old schema was missing EncryptionSpec, which is now included in this
   new generated schema.
4) Old schema has azureTypes.AzureSpec.InstanceID, but that was removed
   and deprecated in favor of ipamTypes.IPAMSpec.InstanceID. See PR
   which forgot to remove this from the old validation schema: #10569

This CRD is generated using
https://book.kubebuilder.io/reference/generating-crd.html.

Signed-off-by: Chris Tarazi <chris@isovalent.com>
christarazi added a commit that referenced this pull request May 15, 2020
This commit adds resource name generation via markers. It also updates
the validation schema via markers which the old method of hardcoding had
a few fields missing / incorrect.

Here's a summary of the main differences in the validation schema:

1) Old schema had eniTypes.ENISpec.MaxAllocate, which doesn't exist. It
   exists under ipamTypes.IPAMSpec.MaxAllocate.
2) Old schema was missing eniTypes.ENISpec.{InstanceID,InstanceType},
   which is now included in this new generated schema.
3) Old schema was missing EncryptionSpec, which is now included in this
   new generated schema.
4) Old schema has azureTypes.AzureSpec.InstanceID, but that was removed
   and deprecated in favor of ipamTypes.IPAMSpec.InstanceID. See PR
   which forgot to remove this from the old validation schema. [1]

This CRD is generated using
https://book.kubebuilder.io/reference/generating-crd.html.

[1]: #10569

Signed-off-by: Chris Tarazi <chris@isovalent.com>
christarazi added a commit that referenced this pull request Aug 14, 2020
This commit adds resource name generation via markers. It also updates
the validation schema via markers which the old method of hardcoding had
a few fields missing / incorrect.

Here's a summary of the main differences in the validation schema:

1) Old schema had eniTypes.ENISpec.MaxAllocate, which doesn't exist. It
   exists under ipamTypes.IPAMSpec.MaxAllocate.
2) Old schema was missing eniTypes.ENISpec.{InstanceID,InstanceType},
   which is now included in this new generated schema.
3) Old schema was missing EncryptionSpec, which is now included in this
   new generated schema.
4) Old schema has azureTypes.AzureSpec.InstanceID, but that was removed
   and deprecated in favor of ipamTypes.IPAMSpec.InstanceID. See PR
   which forgot to remove this from the old validation schema. [1]

This CRD is generated using
https://book.kubebuilder.io/reference/generating-crd.html.

[1]: #10569

Signed-off-by: Chris Tarazi <chris@isovalent.com>
christarazi added a commit that referenced this pull request Aug 14, 2020
This commit adds resource name generation via markers. It also updates
the validation schema via markers which the old method of hardcoding had
a few fields missing / incorrect.

Here's a summary of the main differences in the validation schema:

1) Old schema had eniTypes.ENISpec.MaxAllocate, which doesn't exist. It
   exists under ipamTypes.IPAMSpec.MaxAllocate.
2) Old schema was missing eniTypes.ENISpec.{InstanceID,InstanceType},
   which is now included in this new generated schema.
3) Old schema was missing EncryptionSpec, which is now included in this
   new generated schema.
4) Old schema has azureTypes.AzureSpec.InstanceID, but that was removed
   and deprecated in favor of ipamTypes.IPAMSpec.InstanceID. See PR
   which forgot to remove this from the old validation schema. [1]

This CRD is generated using
https://book.kubebuilder.io/reference/generating-crd.html.

[1]: #10569

Signed-off-by: Chris Tarazi <chris@isovalent.com>
aanm pushed a commit that referenced this pull request Aug 18, 2020
This commit adds resource name generation via markers. It also updates
the validation schema via markers which the old method of hardcoding had
a few fields missing / incorrect.

Here's a summary of the main differences in the validation schema:

1) Old schema had eniTypes.ENISpec.MaxAllocate, which doesn't exist. It
   exists under ipamTypes.IPAMSpec.MaxAllocate.
2) Old schema was missing eniTypes.ENISpec.{InstanceID,InstanceType},
   which is now included in this new generated schema.
3) Old schema was missing EncryptionSpec, which is now included in this
   new generated schema.
4) Old schema has azureTypes.AzureSpec.InstanceID, but that was removed
   and deprecated in favor of ipamTypes.IPAMSpec.InstanceID. See PR
   which forgot to remove this from the old validation schema. [1]

This CRD is generated using
https://book.kubebuilder.io/reference/generating-crd.html.

[1]: #10569

Signed-off-by: Chris Tarazi <chris@isovalent.com>
HadrienPatte added a commit that referenced this pull request Apr 2, 2026
Remove deprecated fields that have been unused for 5+ years:
* Azure `AzureInterface.GatewayIP` (obsolete since v1.10, see #15182)
* AWS `ENISpec.InstanceID` (obsolete since v1.8, see #10569)
* AWS `ENISpec.{MinAllocate,PreAllocate,MaxAboveWatermark}` (obsolete since v1.8, see #10089)

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
HadrienPatte added a commit that referenced this pull request Apr 2, 2026
Remove deprecated fields that have been unused for 5+ years:
* Azure `AzureInterface.GatewayIP` (obsolete since v1.10, see #15182)
* AWS `ENISpec.InstanceID` (obsolete since v1.8, see #10569)
* AWS `ENISpec.{MinAllocate,PreAllocate,MaxAboveWatermark}` (obsolete since v1.8, see #10089)

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/eni Impacts ENI based IPAM. integration/cloud Related to integration with cloud environments such as AKS, EKS, GKE, etc. release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants