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

Fixing calico-ipam using hostname instead of nodename #375

Merged
merged 1 commit into from
Sep 11, 2017

Conversation

heschlie
Copy link
Contributor

@heschlie heschlie commented Sep 7, 2017

Description

Fixes projectcalico/calico#826

It looks as though we were still using the deprecated hostname from the CNI payload, and not nodename which was causing issues assigning affine blocks if you need to use a NODENAME that is different from the Nodes os.Hostname().

I tested this on a vagrant cluster launching Calico with systemd to configure a NODENAME different than the Nodes hostname, and matched the NODENAME env var in the CNI config files nodename. Without this fix the claimed blocks get assigned to the Nodes hostname in etcd, instead of the proper nodename.

Todos

  • Tests
  • Documentation
  • Release note

Release Note

Calico now respects the `nodename` in the [CNI configuration](https://docs.projectcalico.org/v2.6/reference/cni-plugin/configuration), if set. Previously, affinity blocks got assigned to the hostname of the [node](https://docs.projectcalico.org/v2.6/reference/calicoctl/resources/node) , even if a `nodename` was specified.

@heschlie heschlie added this to the Calico v2.6.0 milestone Sep 7, 2017
@heschlie heschlie self-assigned this Sep 7, 2017
Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

This breaks upgrade, I think.

@bcreane
Copy link
Contributor

bcreane commented Sep 7, 2017

lgtm at this point.

@@ -69,12 +69,26 @@ type ipamArgs struct {
IP net.IP `json:"ip,omitempty"`
}

func updateNodename(conf utils.NetConf) string {
Copy link
Member

Choose a reason for hiding this comment

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

naming nit: this isn't updating nodename, it's determining it.

Maybe determineNodename would be better.

func cmdAdd(args *skel.CmdArgs) error {
conf := utils.NetConf{}
if err := json.Unmarshal(args.StdinData, &conf); err != nil {
return fmt.Errorf("failed to load netconf: %v", err)
}

nodename := updateNodename(conf)

Copy link
Member

Choose a reason for hiding this comment

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

no need for the extra newline.

Copy link
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

A couple of minor nits.

Once those are fixed and then this is squashed feel free to merge.

It looks as though we were still using the deprecated `hostname` from
the CNI payload, and not `nodename` which was causing issues assigning
affine blocks if you need to use a `NODENAME` that is different from the Nodes `os.Hostname()`.

We'll check for the old `hostname` value as well similar to how we do in
the CNI plugin.
@heschlie heschlie merged commit 5595efe into projectcalico:master Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CALICO-IPAM not using NODENAME nor FELIX_FELIXHOSTNAME
3 participants