Releases: deckhouse/lib-dhctl
Releases · deckhouse/lib-dhctl
Call parent process logger in InMemoryLogger
Check document has not contains multiple apiVersion an kind and trim last new line in *F in logger
Add:
in yaml package:
- ParseIndex check that document contains only one
apiVersionandkindkeys. It needs to fail if user forget to add---yaml documents separator to multi-documents yaml.
in log package:
- trim last new line from format in
*Ffunctions. Because*Ffunctions add new line to format we can get situation in migration when we forget to delete new line at end of format in old code.
Chore:
in log package:
- add deprecation warnings to all loggers for
*Lnfunctions.
Add ExtractValidationError and ExtractValidationErrors func
Add:
in yaml package:
- Add
ExtractValidationErrorandExtractValidationErrorsfunc for extractingErrorKindfrom passed error
Add ErrUnknown to validation.ErrorKind
Add:
in package yaml:
- ErrUnknown in validation for fallback
SchemaIndex: add ParseIndex func and methods for extract group and group version
Add:
in yaml package:
- Add
ParseIndexfunc for parsingSchemaIndexfrom document only. - Add methods
GroupandGroupVersionfor extract group and group version fromSchemaIndex. - Add
ErrReaderror for causes when io.Reader returns error while parsing.
Add yaml package
Add:
-
yamlpackage:
Add Errors primitives.
It contains primaryValidatorstruct for validate yaml documents withapiVersionandkindfields. NowValidatorwrap validation and another errors with special pre-defined errors which handle is need witherrors.Is.
It was migratedSchemaStorefrom dhctl. But new struct can:- extended with transformers for transform
Schema(for example we add by default disallow additional properties). User can add your own transformers. PreValidatorfor additional validation before validate by schema. For example we validateModuleConfigresources in dhctl, but every module config has it own validation schema forsettingsfield. This settings should validate before validate entry document, because validation by schema only validateModuleConfigdocument as is (that document presentsettings,versionfield) andsettingswill not validate by own settings schema.- extensions validators, like
x-rulesfor validate separated fields by own validation functions. For example, in dhctl we validate ssh private key inConnectionConfigusing parsing go-ssh parse string, for private is valid private key string but not random string. - apiVersion fallbacks. For example old clients can use deleted apiVersion from specs user of library can add fallback from deleted versions for present. By default, we add fallback from version
deckhouse.io/v1alpha1todeckhouse.io/v1. LoadSchemasfor parse and load schemas fromio.Readerto[]openapi/*spec.Schema(schema can contains multiple apiVersions). Warning! InLoadSchemaswe add disallow additional properties if it was not set.
Also, we added some utils functions:
SplitYAML*for split content on multiple documents by\n---\nseparator.Unmarshalwrapper foryaml.Unmarshalbut this function is generic and return result as return, not by argument pointer.
- extended with transformers for transform
Readonly retry.Params and deprecate *Ln methods in logger
BREAKING CHANGES:
- Remove next methods from retry.Params:
Now
WithName(n string) Params WithAttempts(attempts int) Params WithWait(wait time.Duration) Params WithLogger(logger log.Logger) Paramsretry.Paramsis readonly now. It needs to prevent change in usage. For example we pass to functionParamsand rewrite params in original object before run loop. It it incorrect, to prevent it we doParamsreadonly
DEPRECATIONS:
- deprecate
*Lnmethods in logger. Please use*Fmethods. This methods add new line to end by default (see #9)
Add:
WithNamefunc inretrypackage now getformat stringand optional arguments list (it does not break API). NowWithNameformat name, and we could not usefmt.Sprintfbefore useWithNameand pass format and arguments directly toWithName
Optimize format wrapper
Fixes:
- fix add
\nin format wrapper to format string only to prevent multiple format string parsing - fix makefile to prevent download binaries is they exist
Chores:
- parallel run jobs in workflow for getting all information in pull request changes
Add slog handler, add new line for *F methods to logger
BREAKING CHANGES:
*Fmethods in logger now add new line to message
Add:
- slog handler for pass logs from slog to our logger
*WithoutLnmethods to logger
Fixes:
- fix SimpleLogger out format as message and !BADKEY string as format and args
fix go.mod and lint imports
fix go.mod and lint imports (#8) Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>