Documentation ¶
Overview ¶
This package governs metadata in configuration repos and their surrounding development repositories as well.
Metadata refers to a yaml file that provides information about how to parse and interact with the referenced configuration files.
ConfigRepo or configuration repository refers to the source of truth repository.
DevRepo or development repository refers to the repository where lekko config is used, but not as a source of truth.
Index ¶
- Constants
- func CreateNamespaceMetadata(ctx context.Context, rootPath, namespaceName string, cw fs.ConfigWriter) error
- func MarshalYAML(v interface{}) ([]byte, error)
- func NewYAMLDecoderStrict(reader io.Reader) *yaml.Decoder
- func NewYAMLEncoderStrict(writer io.Writer) *yaml.Encoder
- func UnmarshalYAMLStrict(data []byte, v interface{}) error
- func UpdateRootConfigRepoMetadata(ctx context.Context, path string, cw fs.ConfigWriter, ...) error
- type NamespaceConfigRepoMetadata
- type RootConfigRepoMetadata
Constants ¶
const DefaultNamespaceConfigRepoMetadataFileName = "lekko.ns.yaml"
const DefaultRootConfigRepoMetadataFileName = "lekko.root.yaml"
const GenFolderPathJSON = "gen/json"
const GenFolderPathProto = "gen/proto"
const LatestNamespaceVersion = "v1beta3"
Variables ¶
This section is empty.
Functions ¶
func CreateNamespaceMetadata ¶
func MarshalYAML ¶
func NewYAMLDecoderStrict ¶
NewYAMLDecoderStrict creates a new YAML decoder from the reader.
func NewYAMLEncoderStrict ¶
NewYAMLDecoderStrict creates a new YAML decoder from the reader.
func UnmarshalYAMLStrict ¶
This is taken from github.com/bufbuild/buf/private/pkg/encoding/encoding.go
UnmarshalYAMLStrict unmarshals the data as YAML, returning a user error on failure.
If the data length is 0, this is a no-op.
func UpdateRootConfigRepoMetadata ¶
func UpdateRootConfigRepoMetadata(ctx context.Context, path string, cw fs.ConfigWriter, f func(*RootConfigRepoMetadata)) error
Types ¶
type NamespaceConfigRepoMetadata ¶
type NamespaceConfigRepoMetadata struct { // This version refers to the version of the configuration in the repo itself. // TODO we should move this to a separate version number. Version string `json:"version,omitempty" yaml:"version,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` }
type RootConfigRepoMetadata ¶
type RootConfigRepoMetadata struct { // This version refers to the version of the metadata. Version string `json:"version,omitempty" yaml:"version,omitempty"` Namespaces []string `json:"namespaces,omitempty" yaml:"namespaces,omitempty"` ProtoDirectory string `json:"protoDir,omitempty" yaml:"protoDir,omitempty"` }
The type for
func ParseFullConfigRepoMetadataStrict ¶
func ParseFullConfigRepoMetadataStrict(ctx context.Context, path string, provider fs.Provider) (*RootConfigRepoMetadata, map[string]*NamespaceConfigRepoMetadata, error)
Parses the lekko metadata from a configuration repo in a strict way, returning a user error on failure.
This looks in the default locations and names for now, and a custom extension can be written later.
This returns the root metadata of a repository and a map from namespace name to namespace metadata.
This takes a provider so that we can use the same code on a local version on disk as well as in Github.