Skip to content

NO-JIRA: quote bootstrap IP in bootkube etcd endpoints manifest#1640

Merged
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
Rusty-Gopher:fix-quote-bootstrap-ip-etcd-endpoints
Jun 26, 2026
Merged

NO-JIRA: quote bootstrap IP in bootkube etcd endpoints manifest#1640
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
Rusty-Gopher:fix-quote-bootstrap-ip-etcd-endpoints

Conversation

@Rusty-Gopher

@Rusty-Gopher Rusty-Gopher commented Jun 23, 2026

Copy link
Copy Markdown

During bootstrap, the rendered etcd-endpoints ConfigMap writes the bootstrap
IP into an annotation.

IPv4 bootstrap IPs render safely either way, but IPv6 addresses can contain
colon sequences such as ::. When emitted as an unquoted YAML plain scalar,
a value like this can fail YAML parsing:

alpha.installer.openshift.io/etcd-bootstrap: fd3b:8433:2a9:138::

Quote the rendered annotation value so the bootstrap IP is always treated as
a string. This preserves the rendered value for IPv4 and fixes IPv6 bootstrap
addresses.

Changed:

alpha.installer.openshift.io/etcd-bootstrap: {{ .BootstrapIP }}

to:

alpha.installer.openshift.io/etcd-bootstrap: "{{ .BootstrapIP }}"

Tested:

go test ./pkg/cmd/render

Summary by CodeRabbit

  • Bug Fixes
    • Fixed YAML quoting for the etcd bootstrap configuration so the bootstrap endpoint renders as the intended interpolated value.
  • Tests
    • Added an IPv6-specific rendering test to validate manifests when an IPv6 bootstrap IP is used.
    • Enhanced the render test setup to use a configurable bootstrap IP and verify the generated ConfigMap contents.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Walkthrough

The etcd bootstrap annotation is quoted in the manifest template, render code now accepts an injected bootstrap IP locator, and render tests add IPv6 coverage by reading the generated ConfigMap and checking the bootstrap annotation.

Changes

Bootstrap IP rendering

Layer / File(s) Summary
Render bootstrap IP plumbing
pkg/cmd/render/render.go
renderOpts carries a bootstrap IP locator into newTemplateData, and TemplateData.setBootstrapIP uses that locator when computing the bootstrap IP.
Manifest quoting and test wiring
bindata/bootkube/manifests/00_etcd-endpoints-cm.yaml, pkg/cmd/render/render_test.go
The etcd bootstrap annotation is quoted in the manifest, and render test helpers add configurable bootstrap IP selection and locator injection.
IPv6 render assertion
pkg/cmd/render/render_test.go
TestRenderIpv6 renders manifests for an IPv6 bootstrap IP, loads the generated ConfigMap, and checks the bootstrap annotation value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The added TestRenderIpv6 and all t.Run names are static literals; no dynamic IPs, UUIDs, timestamps, or generated suffixes appear in test titles.
Test Structure And Quality ✅ Passed The added tests are focused unit tests, use t.TempDir for cleanup, and include a clear assertion for the IPv6 annotation; no Ginkgo/cluster/timeouts issues found.
Microshift Test Compatibility ✅ Passed The PR adds only Go unit tests in pkg/cmd/render, not Ginkgo e2e tests, and they use no MicroShift-unsupported cluster APIs or assumptions.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: TestRenderIpv6 is a standard Go unit test in pkg/cmd/render, not a Ginkgo e2e test, and it has no multi-node/topology assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only quotes the etcd bootstrap annotation and adds IPv6 render tests; no new affinity, nodeSelector, replicas, or topology-spread constraints were introduced.
Ote Binary Stdout Contract ✅ Passed No main/TestMain/init/suite setup stdout writes were added; the new code is test-only, and the only fmt.Fprint goes to injected errOut.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only Go unit tests in pkg/cmd/render, not Ginkgo e2e tests, and introduces no public-internet connectivity or IPv4-only assumptions.
No-Weak-Crypto ✅ Passed Touched files only adjust YAML quoting and render tests; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons found.
Container-Privileges ✅ Passed Touched files only quote the etcd bootstrap annotation and add render tests; none introduce privileged, hostPID/Network/IPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data is logged in the PR changes; it only quotes the bootstrap annotation and adds test/locator wiring, with no new secret/PII/hostname logging.
Title check ✅ Passed The title clearly describes the main change: quoting the bootstrap IP in the etcd endpoints manifest.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 23, 2026
@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Hi @Rusty-Gopher. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci Bot requested review from benluddy and everettraven June 23, 2026 19:30
@Rusty-Gopher

Copy link
Copy Markdown
Author

Hey,

While working on this fix for my usecase, i noticed that testrender() was actually never called with IPv6 bootstrap it, which was exactly my usecase.

The IPv6 network configs were added in 876221a but only for testTemplateData() — the full render pipeline was never exercised with an IPv6 address.

Now i have added a TestRenderIPv6 to cover this gap.
Please let me know if you have any feedback on this approach.

Thanks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/cmd/render/render_test.go`:
- Around line 313-325: The TestRenderIpv6 function currently only verifies that
render.Run() completes without error, but does not validate that the rendered
etcd-endpoints ConfigMap annotation contains the properly quoted IPv6 address.
Replace the testRender call with testTemplateData to enable proper validation of
the TemplateData structure. Add a validator that checks the EscapedBootstrapIP
field equals the correctly bracketed IPv6 address "[2001:db8::1]" to ensure the
IPv6 quoting fix is properly tested and the test would fail if the bracketing
were removed from the template.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 314396bd-9b13-4ded-8eff-c02ee8f62c79

📥 Commits

Reviewing files that changed from the base of the PR and between 8805fc2 and c5b4664.

📒 Files selected for processing (1)
  • pkg/cmd/render/render_test.go

Comment thread pkg/cmd/render/render_test.go
{{- if ne .BootstrapScalingStrategy "BootstrapInPlaceStrategy" }}
annotations:
alpha.installer.openshift.io/etcd-bootstrap: {{ .BootstrapIP }}
alpha.installer.openshift.io/etcd-bootstrap: "{{ .BootstrapIP }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

from my prespective, no, this one uses the k8s api client, not raw yaml files, so ipv6 colons are fine in json.
not the same problem.

Comment thread pkg/cmd/render/render_test.go Outdated
Comment on lines +343 to +345
func testRender(t *testing.T, tc *testConfig) {
renderManifests(t, tc)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need to have a function just to call another function. Let's keep it at testRender

testRender(t, config)
}

func TestRenderIpv6(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

funny that we don't already have a render test that looks at the generated yaml. Good addition.

Comment thread pkg/cmd/render/render_test.go Outdated
Comment on lines +316 to +317
defaultBootstrapIPLocator = &fakeBootstrapIPLocator{ip: net.ParseIP("2001:db8::1")}
defer func() { defaultBootstrapIPLocator = orig }()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that looks strange, especially when we run tests in parallel. Do you mind to refactor the testConfig with it?

I don't really get why this needs to be on TestMain, I think we can remove that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this probably is a larger refactoring, but it would be useful to have it injected through TemplateData directly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this probably is a larger refactoring, but it would be useful to have it injected through TemplateData directly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, i have moved bootstrapIP into testConfig and removed TestMain.

Also i have added bootstrapIPLocator as a field on renderOpts, so the fake locator in injected through this structt, avoiding any gloabal state mutation.

Atleast from my side. tests are fully isolated and safe to run in parallel

Can you please check it and let me know if thats ok for you, thanks for the hint!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah works for me, thanks :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks to you, that was quick, appericiate it.
If anything is needed from my side, just let me know :)

@tjungblu

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 25, 2026
@tjungblu

Copy link
Copy Markdown
Contributor

/lgtm
/approve

Thank you! I'll tag verified once everything passes in CI.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2026
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tjungblu

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2026
@tjungblu

Copy link
Copy Markdown
Contributor

/retitle NO-JIRA: quote bootstrap IP in bootkube etcd endpoints manifest

@openshift-ci openshift-ci Bot changed the title render: quote bootstrap IP in etcd endpoints manifest NO-JIRA: quote bootstrap IP in bootkube etcd endpoints manifest Jun 25, 2026
@tjungblu

Copy link
Copy Markdown
Contributor

/retest

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@Rusty-Gopher: This pull request explicitly references no jira issue.

Details

In response to this:

During bootstrap, the rendered etcd-endpoints ConfigMap writes the bootstrap
IP into an annotation.

IPv4 bootstrap IPs render safely either way, but IPv6 addresses can contain
colon sequences such as ::. When emitted as an unquoted YAML plain scalar,
a value like this can fail YAML parsing:

alpha.installer.openshift.io/etcd-bootstrap: fd3b:8433:2a9:138::

Quote the rendered annotation value so the bootstrap IP is always treated as
a string. This preserves the rendered value for IPv4 and fixes IPv6 bootstrap
addresses.

Changed:

alpha.installer.openshift.io/etcd-bootstrap: {{ .BootstrapIP }}

to:

alpha.installer.openshift.io/etcd-bootstrap: "{{ .BootstrapIP }}"

Tested:

go test ./pkg/cmd/render

Summary by CodeRabbit

  • Bug Fixes
  • Fixed YAML quoting for the etcd bootstrap configuration so the bootstrap endpoint renders as the intended interpolated value.
  • Tests
  • Added an IPv6-specific rendering test to validate manifests when an IPv6 bootstrap IP is used.
  • Enhanced the render test setup to use a configurable bootstrap IP and verify the generated ConfigMap contents.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@tjungblu

Copy link
Copy Markdown
Contributor

/verified by ci

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 26, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@tjungblu: This PR has been marked as verified by ci.

Details

In response to this:

/verified by ci

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@tjungblu

Copy link
Copy Markdown
Contributor

/override ci/prow/e2e-aws-ovn-serial-1of2
/override ci/prow/e2e-aws-ovn-single-node

unrelated and known failure in both jobs, no bootstrap error. Neither of them runs ipv6 bootstrap anyway.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@tjungblu: Overrode contexts on behalf of tjungblu: ci/prow/e2e-aws-ovn-serial-1of2, ci/prow/e2e-aws-ovn-single-node

Details

In response to this:

/override ci/prow/e2e-aws-ovn-serial-1of2
/override ci/prow/e2e-aws-ovn-single-node

unrelated and known failure in both jobs, no bootstrap error. Neither of them runs ipv6 bootstrap anyway.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@Rusty-Gopher: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 6959085 into openshift:main Jun 26, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants