Kinds: secrets, certificates and backup
Implementation, history and tests of the entries on the reference page
Kinds: secrets, certificates and backup. Every test
named here is in pkg/oam/builtin/components/, in the file the note beside it names.
issuer, clusterissuer, certificate
- Implementation: Each is built on
policyHeldKind(policyFreeKindwith a policy check, see the storageclass entry) and emits that one object, named after the component unlessobjectNamenames it; the handler adds no label, no annotation and no default. (“Each” isissuer,clusterissuerandcertificate.) - History: go-kure/launcher#790 (the kind-named projections);
go-kure/launcher#922 (the object kind policy,
oam.ObjectKindPolicy). - Tests:
TestCertManagerKinds_NoDefaultedZerosholds the types to having no number, boolean or string that is omitted when zero and that the CRD defaults to something else. (“the types” are the reference’s spec types,IssuerSpecandCertificateSpec, and the test is incertmanager_kinds_internal_test.go.)TestKindComponents_OmittedRequiredAndWrittenDefaultsderives the two from the CRD and shows the refusals. (“the two” are thecronand thewindowDurationof a renewal window, and “the refusals” are the refusals of either when it is left out, and the test is inkind_api_sets_internal_test.go.)TestKindComponents_NullRequiredshows each refusal by running the CRD’s schema validator on the object the type would encode. (“each refusal” is the refusal of an unauthorednodeSelectorTermsand of an unauthorednameof a parent reference, in an ACME HTTP01 solver, and the test is inkind_null_required_internal_test.go.)- A dependency bump that adds, drops or moves one fails
TestKindComponents_RequiredIsGenerateduntil the list is regenerated. (“one” is a field the reference’s generated lists name, and “the list” is that list, and the test is inkind_required_internal_test.go.) TestKindComponents_GeneratedRequiredBothWaysbuilds each field authored and refuses its omission, and runs one per type through the CRD’s own validation, which refuses it too. (“each field” is a field the reference’s generated lists name, and the test is inkind_required_internal_test.go.)TestLabelSelectorKinds_CoverEverySelectorshows, at each of the 16 label selectors, what the API server answers for an expression without itskeyor itsoperator. (The test is inlabel_selector_internal_test.go.)
secretstore, clustersecretstore, externalsecret, clusterexternalsecret
- Implementation: All four are built on
policyHeldKind: the stores for the credentials a provider takes as a value, the two external-secret kinds for the one field that has the operator write another kind than a Secret (target.manifest, under Policy below). (“All four” aresecretstore,clustersecretstore,externalsecretandclusterexternalsecret, and “Policy” is the Policy paragraph in the reference’s Validation section.) - History: go-kure/launcher#790 (the kind-named projections; the published
schema marks
providerof asecretstoreand of aclustersecretstore, andexternalSecretSpecof aclusterexternalsecret, as required); go-kure/launcher#922 (the object kind policy,oam.ObjectKindPolicy); go-kure/launcher#1108 (the operator’s CRDs vendored for the tests). - Tests:
TestExternalSecretsKinds_DefaultedZerosholds that list to the default markers of the linked module’s source in both directions: no other number or boolean of the four specs is of that shape. (“that list” is the reference’s list of the three store fields whose authored zero orfalsethe API would replace, and “that shape” is a zero the type omits and the API defaults to another value, and the test is inexternalsecrets_kinds_internal_test.go.)TestKindComponents_RequiredIsGeneratedfails where the generated file and that derivation differ, in either direction and for either list, and names the path; a dependency bump that adds, drops or moves one fails there. (“the generated file” iszz_generated_kind_required.go, “that derivation” is the reference’s derivation of the lists from the linked module’s source, “either list” is the generated required list and the list of four store fields the type always writes, and “one” is a path, and the test is inkind_required_internal_test.go.)- Regenerate with
UPDATE_KIND_REQUIRED=1 go test ./pkg/oam/builtin/components/ -run TestKindComponents_RequiredIsGenerated. (“Regenerate” is regenerating the generated file the previous bullet names.) TestExternalSecretsKinds_RequiredMatchSourceshows that no field of the four specs is required and omitted by the type when unauthored at this pin, and fails on the first one a bump brings. (“the first one” is the first such field, and the test is inexternalsecrets_kinds_internal_test.go.)- The API server holds the lists too:
TestKindComponents_GeneratedRequiredBothWaysruns one path of every type holding a generated path through its validator on the operator’s CRDs, vendored for the tests from the release the linked commit is tagged (go-kure/launcher#1108; see “Vendored CRDs” under the required fields), and every generated path is one those CRDs declare. (“the lists” are the reference’s required lists, and the test is inkind_required_internal_test.go.) - Every rule the source declares on a type these specs reach is classified in
TestExternalSecretsKinds_Rules, which fails on one that is added or reworded. (“the source” is the linked module’s source, “these specs” are the four specs, and “one” is a rule, and the test is inexternalsecrets_kinds_internal_test.go.) TestExternalSecretsKinds_WrittenUnauthoredpins those five. (“those five” are the five empty blocks the reference names, an external secret’ssecretStoreRefandtarget, aclusterexternalsecret’sexternalSecretMetadata, an AWS provider’sauthand a Vault provider’stls, and the test is inexternalsecrets_kinds_test.go.)TestExternalSecretsKinds_InlineValuesfinds every stringvaluebeside asecretRefin the linked module (14 at this pin) and fails on one that is in neither list. (“neither list” is the reference’s list of refused fields and its list of seven other fields that are not refused, and the test is inexternalsecrets_kinds_internal_test.go.)TestSecretStoreKinds_FakeDatapins the order. (“the order” is the order of the two refusals the reference gives for thefakeprovider’sdata, and the test is inexternalsecrets_kinds_test.go.)TestPolicyReadsKind_IsWhatTheRenderedObjectCheckReadsfails when the refused set and the check differ. (“the refused set” is the reference’s list of kinds thattarget.manifestrefuses, and “the check” is the rendered-object check the reference names, and the test is inpolicy_reads_kind_internal_test.go.)
replicationsource, replicationdestination
- Implementation: Each is built on
policyHeldKind(policyFreeKindwith a policy check, see above) and emits that one object in the build namespace, named after the component unlessobjectNamenames it, and declares it as namespaced; the handler adds no label, no annotation and no default. (“Each” isreplicationsourceandreplicationdestination.) - History: go-kure/launcher#790 (the kind-named projections);
go-kure/launcher#922 (the object kind policy,
oam.ObjectKindPolicy); go-kure/launcher#883 (the kinds’ required lists are generated from the linked module’s CRDs). - Tests:
TestVolsyncKinds_NoDefaultsholds the linked CRDs to that, and a dependency bump that adds a default fails there with the field named. (“that” is the reference’s “VolSync’s CRDs default no field underspec”, and the test is involsync_kinds_internal_test.go.)TestKindComponents_NullRequiredshows the refusal with the validator of the linked CRDs. (“the refusal” is the refusal of an unauthorednodeSelectorTermsin a mover’s required node affinity, and the test is inkind_null_required_internal_test.go.)- The lists (192 paths for a source, 142 for a destination) are derived from the
CRDs the linked module ships, by
TestKindComponents_RequiredIsGenerated; a dependency bump that adds, drops or moves one fails there until the list is regenerated. (“The lists” are the reference’s required lists, “one” is a path and “there” isTestKindComponents_RequiredIsGenerated, and the test is inkind_required_internal_test.go.) TestKindComponents_GeneratedRequiredBothWaysshows the API server’s answer to the omission of a field of each type that holds one (15 rows for a source, 14 for a destination). (The test is inkind_required_internal_test.go.)TestVolsyncKinds_WrittenEmptyAcceptedholds that every other field of VolSync’s own types the type writes empty is one the CRDs take empty. (The test is involsync_kinds_internal_test.go.)TestVolsyncKinds_AbsentFromCRDderives the fields the types reach that the linked CRDs have no property for and holds the refusals to them, both ways: a bump of either module that closes the gap, or widens it, fails there with the field named. (“the refusals” are the refusals of the two fields the reference names,secret.defaultUserandsecret.items[].user, and the test is involsync_kinds_internal_test.go.) It also runs the API server’s own create sequence on the linked CRDs (crdCreate): the API server names each of the two as an unknown field, for which a request made with strict field validation is refused, and prunes it from the object it goes on with. (“It” isTestVolsyncKinds_AbsentFromCRD, and “the two” are the same two fields.)TestVolsyncKinds_NoExpressionRulesholds the linked CRDs to that, and a dependency bump that adds one fails there with the rule named. (“that” is the reference’s “The CRDs declare no expression rule” and “one” is such a rule, and the test is involsync_kinds_internal_test.go.)TestVolsyncKinds_WrittenEmptyAcceptedholds every such field to its schema. (“every such field” is a field the type writes empty, as thecustomCAblock of anrcloneorresticmover, and the test is involsync_kinds_internal_test.go.)