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

✨ Make IP addresses of PacketMachine(Template) configurable #484

Closed
wants to merge 2 commits into from

Conversation

Lirt
Copy link

@Lirt Lirt commented Jan 13, 2023

What this PR does / why we need it:

This PR allows users to configure IP addresses of packet machines through PacketMachineTemplate. It helps to fix issue #226.

As described in Equinix API Spec the device is by default configured with 1 Public IPv4, 1 Private IPv4 and 1 Public IPv6 address.

Currently there is no way to change this setting in CAPP. This change allows full control of IP address struct from within PacketMachineTemplate.

Here is example of PacketMachineTemplate with 1 IPv4 private address:

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: PacketMachineTemplate
metadata:
  name: my-standard-worker
  namespace: cluster-01
spec:
  template:
    spec:
      os: "ubuntu_20_04"
      facility: "ny7"
      billingCycle: hourly
      machineType: "n3.xlarge.x86"
      sshKeys:
      - '...'
      tags: []
      ipAddresses:
      - ipAddressCreateRequest:
          address_family: 4
          public: false

This change is backwards compatible as by default it keeps the structure empty which resolves to default.

Notes

In ideal scenario the struct for IP addresses would look like this (see the type packngo.IPAddressCreateRequest):

       IpAddresses []packngo.IPAddressCreateRequest `json:"ipAddresses,omitempty"`

And then we wouldn't need code that unpacks slice:

	ipAddressCreateRequests := []packngo.IPAddressCreateRequest{}
	for _, machine := range req.MachineScope.PacketMachine.Spec.IpAddresses {
		ipAddressCreateRequests = append(ipAddressCreateRequests, machine.IPAddressCreateRequest)
	}

But this isn't possible, because this structure doesn't provide the necessary DeepCopy functions in the packngo library. Implementing those functions in packngo would allow us to use it and we could in turn define IP addresses like this:

      ipAddresses:
      - address_family: 4
        public: false

Signed-off-by: Ondrej Vasko ondrej.vaskoo@gmail.com

Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 13, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @Lirt!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-packet 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-packet has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Lirt
Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval by writing /assign @justinsb in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 13, 2023
Use proper letter case

Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 13, 2023
@kubernetes-sigs kubernetes-sigs deleted a comment from k8s-ci-robot Apr 13, 2023
@cprivitere
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 13, 2023
@Lirt
Copy link
Author

Lirt commented Apr 14, 2023

Based on discussion in issue #226 I think this PR can be closed.

TLDR explanation:
Servers without public IP addresses don't have Internet access and Equinix Metal doesn't have NAT service which make cluster installation complicated.

If you think this PR could be beneficial, please contact maintainers and reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants