kubernetes-sigs / kubebuilder-declarative-pattern

A toolkit for building declarative operators with kubebuilder
Apache License 2.0
256 stars 85 forks source link

mockkubeapiserver: Support stringData when creating a secret #383

Closed justinsb closed 2 months ago

justinsb commented 5 months ago

This is an edge case in the kube apiserver, but there is special handling for the stringData field of a secret, that is mapped to base64 data.

justinsb commented 3 months ago

Hmmm .... this no longer needs a rebase (at least it shouldn't)... I'll try a retest

/retest

justinsb commented 3 months ago

Also, wouldn't hurt to cover/document this behavior in tests :)

A great point, I was thinking about that the other day. This change was to support testing in k8s-config-connector, so it got test coverage there, but we could easily create some simple tests directly in this repo - let me do that!

justinsb commented 3 months ago

This is escalating a bit ... looks like I need to break out a new module to avoid a circular dependency: https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/398

justinsb commented 3 months ago

Had a bit of trouble with the go.sum / go.mod checking (dev/format-gomod), but I finally figured out that the go.sum difference was to do with my cache; I did go clean -cache -modcache before running dev/format-gomod. I think it's still worth trying go.work (and I added a note to the dev/format-gomod script and to the GitHub action error message)

justinsb commented 3 months ago

This might be much easier if we merged a (basically empty) ktest module first - then I think we could stay away from go work sync which is the root of all the problems. Maybe that's a reasonable compromise that's worth a go.

justinsb commented 3 months ago

I tried staging the ktest module in #400. I think that would mean I could back out the go work sync logic which gave me so much trouble

justinsb commented 3 months ago

Found a repo that checks in go.work: kubernetes/kubernetes ! I think we're on solid ground :-)

k8s-ci-robot commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, yuwenma

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/OWNERS)~~ [justinsb] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment