Skip to content

Releases: deckhouse/lib-dhctl

Call parent process logger in InMemoryLogger

29 Jan 18:26
eb8ae1f

Choose a tag to compare

Fix:
in log:

  • Call parent process logger in InMemoryLogger for better observability

Check document has not contains multiple apiVersion an kind and trim last new line in *F in logger

28 Jan 20:41
d5ecc6a

Choose a tag to compare

Add:
in yaml package:

  • ParseIndex check that document contains only one apiVersion and kind keys. 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 *F functions. Because *F functions 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 *Ln functions.

Add ExtractValidationError and ExtractValidationErrors func

16 Jan 20:07
0f7fe15

Choose a tag to compare

Add:
in yaml package:

  • Add ExtractValidationError and ExtractValidationErrors func for extracting ErrorKind from passed error

Add ErrUnknown to validation.ErrorKind

16 Jan 19:47
b151933

Choose a tag to compare

Add:
in package yaml:

  • ErrUnknown in validation for fallback

SchemaIndex: add ParseIndex func and methods for extract group and group version

16 Jan 19:30
b9e397b

Choose a tag to compare

Add:
in yaml package:

  • Add ParseIndex func for parsing SchemaIndex from document only.
  • Add methods Group and GroupVersion for extract group and group version from SchemaIndex.
  • Add ErrRead error for causes when io.Reader returns error while parsing.

Add yaml package

16 Jan 17:45
378b2dc

Choose a tag to compare

Add:

  • yaml package:
    Add Errors primitives.
    It contains primary Validator struct for validate yaml documents with apiVersion and kind fields. Now Validator wrap validation and another errors with special pre-defined errors which handle is need with errors.Is.
    It was migrated SchemaStore from 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.
    • PreValidator for additional validation before validate by schema. For example we validate ModuleConfig resources in dhctl, but every module config has it own validation schema for settings field. This settings should validate before validate entry document, because validation by schema only validate ModuleConfig document as is (that document present settings, version field) and settings will not validate by own settings schema.
    • extensions validators, like x-rules for validate separated fields by own validation functions. For example, in dhctl we validate ssh private key in ConnectionConfig using 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/v1alpha1 to deckhouse.io/v1.
    • LoadSchemas for parse and load schemas from io.Reader to []openapi/*spec.Schema (schema can contains multiple apiVersions). Warning! In LoadSchemas we add disallow additional properties if it was not set.

    Also, we added some utils functions:

    • SplitYAML* for split content on multiple documents by \n---\n separator.
    • Unmarshal wrapper for yaml.Unmarshal but this function is generic and return result as return, not by argument pointer.

Readonly retry.Params and deprecate *Ln methods in logger

12 Jan 01:48
f6b6f68

Choose a tag to compare

BREAKING CHANGES:

  • Remove next methods from retry.Params:
    WithName(n string) Params
    WithAttempts(attempts int) Params
    WithWait(wait time.Duration) Params
    WithLogger(logger log.Logger) Params
    
    Now retry.Params is readonly now. It needs to prevent change in usage. For example we pass to function Params and rewrite params in original object before run loop. It it incorrect, to prevent it we do Params readonly

DEPRECATIONS:

  • deprecate *Ln methods in logger. Please use *F methods. This methods add new line to end by default (see #9)

Add:

  • WithName func in retry package now get format string and optional arguments list (it does not break API). Now WithName format name, and we could not use fmt.Sprintf before use WithName and pass format and arguments directly to WithName

Optimize format wrapper

03 Jan 20:09
556f631

Choose a tag to compare

Fixes:

  • fix add \n in 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

01 Jan 20:40
3a878a3

Choose a tag to compare

BREAKING CHANGES:

  • *F methods in logger now add new line to message

Add:

  • slog handler for pass logs from slog to our logger
  • *WithoutLn methods to logger

Fixes:

  • fix SimpleLogger out format as message and !BADKEY string as format and args

fix go.mod and lint imports

31 Dec 17:53
b88ead2

Choose a tag to compare

fix go.mod and lint imports (#8)

Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>