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

Move operator to gotohelm #1509

Merged
merged 11 commits into from
Sep 11, 2024
Merged

Move operator to gotohelm #1509

merged 11 commits into from
Sep 11, 2024

Conversation

RafalKorepta
Copy link
Contributor

To solve problem of missing security context this commit moves almost all resources to go. genschema is currently broken as I tried to solve particular issue with operator schema generation. Need to fix before merging this PR.

@RafalKorepta RafalKorepta force-pushed the rk/k8s-316/security-context branch 3 times, most recently from 2d415d6 to c5a40a2 Compare September 5, 2024 13:18
@RafalKorepta RafalKorepta marked this pull request as ready for review September 5, 2024 13:18
@RafalKorepta RafalKorepta force-pushed the rk/k8s-316/security-context branch 5 times, most recently from 0e673f9 to cf1477c Compare September 6, 2024 13:00
cmd/genschema/main.go Outdated Show resolved Hide resolved
charts/operator/values.go Outdated Show resolved Hide resolved
charts/operator/values.go Outdated Show resolved Hide resolved
charts/operator/values.go Outdated Show resolved Hide resolved
charts/operator/values.yaml Outdated Show resolved Hide resolved
@RafalKorepta RafalKorepta force-pushed the rk/k8s-316/security-context branch 5 times, most recently from 9dfd2f8 to 76dc85a Compare September 10, 2024 12:36
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.

No major blockers!

charts/operator/certificates.go Show resolved Hide resolved
charts/operator/chart_test.go Outdated Show resolved Hide resolved
require.NoError(t, os.WriteFile("testdata/template-cases-generated.txtar", archive, 0o644))
}

func makeSureTagIsNotEmptyString(values PartialValues, fuzzer *fuzz.Fuzzer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check be enforced by the chart's JSON schema?

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 exactly JSON schema that enforces me to re-generate any tag. That's why this function is created.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, shouldn't this block handle that for you in that case? Or do we never end up generating a valid values due to the number of fields here?

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 should handle that, but for me it was to much false positive. I didn't want to wait.

charts/operator/deployment.go Outdated Show resolved Hide resolved
)
}

if overrides.Spec.TopologySpreadConstraints != nil && len(overrides.Spec.TopologySpreadConstraints) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it was necessary to fully implement this when we just need to be able to override SecurityPolicy 😅

Did you try just calling merge on the pod specs and then filling in fields that need special handling? I think I tried that for containers and it didn't work but I don't recall why....

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 was not reliable, that's why I copied from redpanda chart and filled all other fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

merge wasn't reliable or the implementation in the redpanda chart wasn't reliable?

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func ClusterRole(dot *helmette.Dot) []rbacv1.ClusterRole {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for the future (not this PR). We could add the ability to load files into gotohelm and just read these from disk so they don't get out of sync. Similar to what I did here: #1285

charts/operator/serviceaccount.go Outdated Show resolved Hide resolved
@RafalKorepta RafalKorepta force-pushed the rk/k8s-316/security-context branch 2 times, most recently from 31220b5 to 29a41e6 Compare September 11, 2024 12:47
charts/operator/chart_test.go Outdated Show resolved Hide resolved
require.NoError(t, os.WriteFile("testdata/template-cases-generated.txtar", archive, 0o644))
}

func makeSureTagIsNotEmptyString(values PartialValues, fuzzer *fuzz.Fuzzer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, shouldn't this block handle that for you in that case? Or do we never end up generating a valid values due to the number of fields here?

)
}

if overrides.Spec.TopologySpreadConstraints != nil && len(overrides.Spec.TopologySpreadConstraints) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

merge wasn't reliable or the implementation in the redpanda chart wasn't reliable?

@RafalKorepta RafalKorepta force-pushed the rk/k8s-316/security-context branch 8 times, most recently from 2034b23 to 927d09f Compare September 11, 2024 20:20
The helmignore is required if testdata consist of large generated "golden" files
like in current operator chart. Helm cli would take that files and include in
the release. Currently console 0.7.29 and connectors 0.1.12 have testdata
directy included. With this commit they will omit go files and testdata.
@RafalKorepta RafalKorepta enabled auto-merge (rebase) September 11, 2024 21:29
@RafalKorepta RafalKorepta merged commit 182bd51 into main Sep 11, 2024
42 checks passed
@RafalKorepta RafalKorepta deleted the rk/k8s-316/security-context branch September 11, 2024 21:48
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