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 console subchart in redpanda helm chart #1558

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

RafalKorepta
Copy link
Contributor

@RafalKorepta RafalKorepta commented Oct 10, 2024

This PR is based on top of #1557

caedc4a

Support full Console volumes

The Console partial values are used for pragmatic reasons as genpartial does
not convert console.Values to console.PartialValues inside Redpanda Values
partial generation. In both structs the type is the same. Unit tests that
marshals Redpanda partial values into file does not work as expected. The
console part of the marshalled values have multiple empty strings or nulls.
It is caused by the fact omitempty is not always set in Console.Values. In
normal template evaluation those nulls and empty strings would be replaced by
default values from values.yaml file. To unblock operator integration
Console.PartialValues is used, until genpartail is smart enough.

598dfe9

Add Console as subchart in Redpanda chart

ac9795e

Use certification path const in all places

@RafalKorepta RafalKorepta force-pushed the rk/k8s-305/console-subchart-in-redpanda branch 2 times, most recently from 3804758 to 8c03e67 Compare October 10, 2024 15:32
@RafalKorepta RafalKorepta force-pushed the rk/k8s-305/console-subchart-in-redpanda branch from 8c03e67 to 732abdd Compare October 10, 2024 16:01
values.Console = &redpanda.PartialConsole{Enabled: ptr.To(false)}
values.Console = &console.PartialValues{
Enabled: ptr.To(true),
Secret: &console.PartialSecretConfig{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a note about why the secret is set here? At first I thought it was just being copied but then I realized we need it to be consistent cross both helm and go invocations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the first implementation secret was always generated. Now as License is added it makes sense to have JWT placeholder for stable tests.

Do you need a one line comment that states "For generating stable test result"?

charts/redpanda/console.tpl.go Outdated Show resolved Hide resolved

consoleDot := dot.Subcharts["console"]

consoleValue := helmette.UnmarshalInto[console.Values](consoleDot.Values)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a lot of comments to this function. There were a handful previously but we can definitely do better.

Noting that the console.* section of the redpanda chart disables the secret/configmap in order for the redpanda chart to render it with connection information will be a great start.

charts/redpanda/console.tpl.go Outdated Show resolved Hide resolved
charts/redpanda/console.tpl.go Outdated Show resolved Hide resolved
if cert.SecretRef != nil {
secretName = cert.SecretRef.Name
}
if cert.CAEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can either solve this here or file a ticket handle it later: truststores (Defined on the listener instead of the cert) need to be handled here as they can also be used to set the CA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the Volumes and VolumeMounts have now much more clear functions.

charts/redpanda/console.tpl.go Outdated Show resolved Hide resolved
charts/redpanda/console.tpl.go Outdated Show resolved Hide resolved
charts/redpanda/values.go Outdated Show resolved Hide resolved
Mode: mode,
BuildFlags: []string{"-tags=generate"},
Dir: cwd,
Mode: mode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is intentional as Redpanda.Values have now console.PartialValues. As the PartialValues struct is in the file that have generated build tag, the load package needs that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also remove the build directive from the generation as nothing will be using that now?

@RafalKorepta RafalKorepta force-pushed the rk/k8s-305/console-subchart-in-redpanda branch 7 times, most recently from 1b39385 to ac9795e Compare October 16, 2024 15:55
Copy link
Contributor

@chrisseto chrisseto left a comment

Choose a reason for hiding this comment

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

LGTM, just the one variable name comment.

charts/redpanda/values.go Outdated Show resolved Hide resolved
The Console partial values are used for pragmatic reasons as genpartial does
not convert console.Values to console.PartialValues inside Redpanda Values
partial generation. In both structs the type is the same. Unit tests that
marshals Redpanda partial values into file does not work as expected. The
console part of the marshalled values have multiple empty strings or nulls.
It is caused by the fact omitempty is not always set in Console.Values. In
normal template evaluation those nulls and empty strings would be replaced by
default values from values.yaml file. To unblock operator integration
Console.PartialValues is used, until genpartail is smart enough.
@RafalKorepta RafalKorepta force-pushed the rk/k8s-305/console-subchart-in-redpanda branch from ac9795e to 83fd674 Compare October 17, 2024 14:16
@RafalKorepta RafalKorepta merged commit 6bf5905 into main Oct 17, 2024
42 checks passed
@RafalKorepta RafalKorepta deleted the rk/k8s-305/console-subchart-in-redpanda branch October 17, 2024 15:03
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.

2 participants