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

Implemented IPPool and IPreservations creation flow and static IPs set #630

Open
wants to merge 4 commits into
base: onpremises-provisioning
Choose a base branch
from

Conversation

RostislavPorohnya
Copy link
Contributor

No description provided.

return "", err
}

usedCIDRs := []string{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use var usedCIDRs []string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will use

Comment on lines 324 to 338
ipReservationsList := &apicalico.IPReservationList{}
err := k8sclient.List(ctx, ipReservationsList, &client.ListOptions{
LabelSelector: labels.SelectorFromSet(map[string]string{
models.ControlledByLabel: models.OperatorLabel,
}),
})
if err != nil {
return "", err
}

for _, reservation := range ipReservationsList.Items {
return reservation.Spec.ReservedCIDRs[0], nil
}

icIPPoolList := &apicalico.IPPoolList{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ipReservationsList and ipPoolList variables or
icIPReservationsList and icIPPoolList, not both versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will remove ic prefix

func getAvailablePrivateCIDR(unavailCIDRs []string) (string, error) {
for i := 0; i < 255; i++ {
checkNet := net.IPNet{
IP: net.ParseIP(fmt.Sprintf("10.%d.0.0", i)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use the second octet and mask 24? maybe we should use the third one here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, added third octet

Comment on lines +70 to +71
//+kubebuilder:rbac:groups=projectcalico.org,resources=ipreservations,verbs=get;list;watch;create;update;patch;delete;deletecollection
//+kubebuilder:rbac:groups=projectcalico.org,resources=ippools,verbs=get;list;watch;create;update;patch;delete;deletecollection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add to another cluster's controllers, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These roles applied for manager so they work for all controllers

@testisnullus testisnullus force-pushed the onpremises-provisioning branch 4 times, most recently from 9366fa1 to 9292b20 Compare November 28, 2023 15:32
@testisnullus testisnullus force-pushed the onpremises-provisioning branch 3 times, most recently from 0f36b70 to d7fcad4 Compare December 11, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants