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

fix(declarative): generate correct uuid for transient entities #14082

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

windmgc
Copy link
Member

@windmgc windmgc commented Jan 6, 2025

Summary

Like what was fixed in #13516 , this PR fixed a case in which a valid declarative config(as pasted below) cannot be loaded in dbless mode. (The cert/key are copied from spec/fixtures/kong_clustering.(crt|key) pair)

{
	"_format_version": "3.0",
	"consumers": [
		{
			"username": "consumerA",
			"basicauth_credentials": [
				{
					"username": "qwerty",
					"password": "qwerty"
				}
			]
		}
	],
	"certificates": [
		{
			"id": "eab647a0-314a-4c26-94ec-3e9d78e4293f",
			"cert": "-----BEGIN CERTIFICATE-----\nMIIDzTCCArWgAwIBAgIUMmq4W4is+P02LXKinUdLoPjFuDYwDQYJKoZIhvcNAQEL\nBQAwdjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM\nDVNhbiBGcmFuY2lzY28xIDAeBgNVBAoMF0tvbmcgQ2x1c3RlcmluZyBUZXN0aW5n\nMRgwFgYDVQQDDA9rb25nX2NsdXN0ZXJpbmcwHhcNMTkxMTEzMDU0NTA1WhcNMjkx\nMTEwMDU0NTA1WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW\nMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEgMB4GA1UECgwXS29uZyBDbHVzdGVyaW5n\nIFRlc3RpbmcxGDAWBgNVBAMMD2tvbmdfY2x1c3RlcmluZzCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBALr7evXK3nLxW98lXDWUcyNRCKDzUVX5Rlm7ny0a\nqVIh+qRUT7XGHFnDznl7s1gEkcxLtuMnKBV7Ic2jVTzKluZZFJD5H2plP7flpVu/\nbyvpBNguERF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ZFc6wm36NOr\nEFnubFIuow6YMnbVwN7yclcZ8+EWivZ6qDfC5Tyw3ipUtMlH7K2BgOw5yb8ptQmU\nFQnaCQ30W/BKZXkwbW+8voMalT+DroejnA7hiOyyjQKBgFLi6x6w76fTgQ7Ts8x0\neATLOrvdvfotuLyMSsQLbljXyJznCTNrOGfYTua/Ifgkn4LpnoOkkxvVbj/Eugc7\nWeXBG+gbEi25GZUktrZWP1uc6s8aXH6rjYJP8iXnUpFHmQAPGuGiFnfB5MxlSns9\n9SKBXe7AvKGknGf7zg8WLKJZ\n-----END PRIVATE KEY-----\n",
			"snis": [
				{
					"name": "alpha.example",
					"id": "c6ac927c-4f5a-4e88-8b5d-c7b01d0f43af"
				}
			]
		}
	]
}


The snis field with a transient = true property was added for the certificates entity in the PR #13357 . However this has a side effect on the populate_ids_for_validation function when it is being called to generate the nested snis entity under the certificates entity in the declarative config. Without checking the transient field, the snis will be regarded as a "parent" to the certificate and the id generation will be skipped.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

https://konghq.atlassian.net/browse/FTI-6351

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 13, 2025
@github-actions github-actions bot added core/db schema-change-noteworthy cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Jan 13, 2025
@windmgc windmgc requested review from lhanjian and flrgh January 13, 2025 09:27
@flrgh flrgh merged commit 55afae5 into master Jan 14, 2025
28 checks passed
@flrgh flrgh deleted the fix-declarative-config-parsing-trasient branch January 14, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/db schema-change-noteworthy size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants