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

feat: Linux node config #782

Merged

Conversation

@m10ev m10ev requested review from bharathkkb, Jberlinsky and a team as code owners January 9, 2021 11:29
@comment-bot-dev
Copy link

comment-bot-dev commented Jan 9, 2021

Thanks for the PR! 🚀
✅ Lint checks have passed.

Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @m10ev
Would be great if we could add a test, maybe here

"sysctls") ? [1] : []

content {
sysctls = merge(local.node_pools_linux_node_configs["all"], local.node_pools_linux_node_configs[each.value["name"]])["sysctls"]
Copy link
Member

Choose a reason for hiding this comment

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

for a config like

all = {
      sysctls = {
        "foo"  = 1
      }
}
pool-01 = {
      sysctls = {
       "bar" = 2
      }
}

Wouldn't merge of the second map override the key sysctls from the first unless we do

sysctls = merge(lookup(local.node_pools_linux_node_configs["all"],"sysctls",{}),lookup(local.node_pools_linux_node_configs[each.value["name"]],"sysctls",{}))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. Are you in favour of keeping this structure and doing this more complex "deep" merge or do you prefer to flatten the structure one level because sysctls is currently the only key in this map?

Copy link
Member

Choose a reason for hiding this comment

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

@m10ev I think it makes sense to flatten as only sysctls is available.

@m10ev
Copy link
Contributor Author

m10ev commented Jan 11, 2021

I'm just guessing about the test assertion right now because I don't have an existing cluster in order to see the output format of the describe command. If you have access to view the output from the integration tests, could you help me with that?

Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

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

The tests LGTM, there was a small typo.

"config" => including(
"linuxNodeConfig" => including(
"sysctls" => including(
"net.core.netdev_max_backlog" => "10000"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"net.core.netdev_max_backlog" => "10000"
"net.core.netdev_max_backlog" => "10000",

Copy link
Member

Choose a reason for hiding this comment

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

We can probably assert the whole object instead of including because there should not be any other keys in sysctls.

"linuxNodeConfig" => including(
                  "sysctls" => {
                    "net.core.netdev_max_backlog" => "10000",
                    "net.core.rmem_max" => "10000"
                  }
                )

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it's preferable to use including as asserting the whole object is more brittle to API changes.

Copy link
Member

Choose a reason for hiding this comment

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

@morgante In this particular case, wouldn't the API including additional configs within sysctls be an error? My reasoning for suggesting whole object for sysctls was in case of any bug being introduced in the logic where we merge all and nodepool specific config.

Copy link
Contributor

Choose a reason for hiding this comment

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

It could be an API error, but it could also be a new default that we haven't included. In either case we couldn't fix it in the module so I'd prefer to avoid brittle logic.

@tenevdev
Copy link
Contributor

Hello, I'm keen to use this feature, too. Is it blocked waiting for one more approval from the owners or it needs extra work?

@bharathkkb bharathkkb merged commit 98826e6 into terraform-google-modules:master Jan 14, 2021
@bharathkkb
Copy link
Member

@tenevdev you can reference the main branch or this will be available with the 0.13 release- #779

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

5 participants