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 NIC configuration information to Machine #136

Merged
merged 7 commits into from
Feb 13, 2019
Merged

Add NIC configuration information to Machine #136

merged 7 commits into from
Feb 13, 2019

Conversation

ymmt2005
Copy link
Member

@ymmt2005 ymmt2005 commented Feb 12, 2019

This PR adds NIC configuration information to Machine.Info.

The information can be referenced from Ignition templates to configure network.

gateway-offset in dhcp.json is moved to ipam.json.
This impacts existing users (if any).

The data format stored in etcd is slightly changed.
To convert old data automatically, the PR also introduces "schema version".

The first schema version is "2" considering old data are made
with schema version "1".

To implement automatic conversion of data stored in etcd,
"schema version" is introduced.

The first schema version is "2" considering old data are made
with schema version "1".
@ymmt2005 ymmt2005 added the wip label Feb 12, 2019
@ymmt2005 ymmt2005 changed the title Add schema versioning. Add NIC configuration information to Machine Feb 12, 2019
and add "MaskBits" field to provide netmask bits to Ignition templates.
"gateway-offset" field in dhcp.json was used to calculate
the default gateway address in a subnet.

Because the subnet is also calculated from ipam.json,
placing "gateway-offset" in DHCP configurations is considered
a design flaw.

This PR adds "node-gateway-offset" field to ipam.json and
uses it to calculate the default gateway addresses.
@ymmt2005
Copy link
Member Author

ymmt2005 commented Feb 13, 2019

dctest 上で動作確認。

Before:

$ sabactl machines get --serial "fb8f2417d0b4db30050719c31ce02a2e8141bbd8" | jq '.[0].info'
{
  "bmc": {
    "ipv4": {
      "address": "10.72.17.3",
      "netmask": "255.255.240.0",
      "gateway": "10.72.16.1"
    }
  }
}

$ sabactl ipam get
{
  "max-nodes-in-rack": 28,
  "node-ipv4-pool": "10.69.0.0/20",
  "node-ipv4-range-size": 6,
  "node-ipv4-range-mask": 26,
  "node-ip-per-node": 3,
  "node-index-offset": 3,
  "bmc-ipv4-pool": "10.72.16.0/20",
  "bmc-ipv4-offset": "0.0.1.0",
  "bmc-ipv4-range-size": 5,
  "bmc-ipv4-range-mask": 20,
  "bmc-ipv4-gateway-offset": 1
}

バージョンアップ:

$ sudo ./sabakan --config-file=/etc/sabakan/config.yml
2019-02-13T02:23:58.760406Z boot-0 sabakan info: "upgrading schema version" from="1" to="2"
2019-02-13T02:23:58.867119Z boot-0 sabakan info: "updated schema version" to="2"
2019-02-13T02:23:58.894676Z boot-0 sabakan info: "resume stateful watching" rev=510

After:

$ ./sabactl machines get --serial "fb8f2417d0b4db30050719c31ce02a2e8141bbd8" | jq '.[0].info'
{
  "network": {
    "ipv4": [
      {
        "address": "10.69.0.3",
        "netmask": "255.255.255.192",
        "maskbits": 26,
        "gateway": "10.69.0.1"
      },
      {
        "address": "10.69.0.67",
        "netmask": "255.255.255.192",
        "maskbits": 26,
        "gateway": "10.69.0.65"
      },
      {
        "address": "10.69.0.131",
        "netmask": "255.255.255.192",
        "maskbits": 26,
        "gateway": "10.69.0.129"
      }
    ]
  },
  "bmc": {
    "ipv4": {
      "address": "10.72.17.3",
      "netmask": "255.255.240.0",
      "maskbits": 20,
      "gateway": "10.72.16.1"
    }
  }
}

$ ./sabactl ipam get
{
  "max-nodes-in-rack": 28,
  "node-ipv4-pool": "10.69.0.0/20",
  "node-ipv4-range-size": 6,
  "node-ipv4-range-mask": 26,
  "node-ip-per-node": 3,
  "node-index-offset": 3,
  "node-gateway-offset": 1,
  "bmc-ipv4-pool": "10.72.16.0/20",
  "bmc-ipv4-offset": "0.0.1.0",
  "bmc-ipv4-range-size": 5,
  "bmc-ipv4-range-mask": 20,
  "bmc-ipv4-gateway-offset": 1
}

docs/machine.md Outdated Show resolved Hide resolved
docs/schema.md Outdated Show resolved Hide resolved
dulltz and others added 2 commits February 13, 2019 12:03
Co-Authored-By: ymmt2005 <ymmt2005@gmail.com>
Co-Authored-By: ymmt2005 <ymmt2005@gmail.com>
@ymmt2005 ymmt2005 merged commit a602e78 into master Feb 13, 2019
@ymmt2005 ymmt2005 deleted the add-nic-info branch February 13, 2019 03:07
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.

None yet

2 participants