configdata

package
v0.25.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigData

type ConfigData struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Configuration     ConfigurationSpec  `json:"configuration,omitempty"`
	Localization      []LocalizationRule `json:"localization,omitempty"`
}

ConfigData defines configuration options. This data is not promoted to being a CRD, but it contains versionable properties. The following is an example structure of this data:

apiVersion: config.ocm.software/v1alpha1 kind: ConfigData metadata:

name: ocm-config

configuration:

defaults:
  replicas: 1
rules:
- value: (( replicas ))
  file: helm_release.yaml
  path: spec.values.replicaCount
schema:
  type: object
  additionalProperties: false
  properties:
    replicas:
      type: string

localization:

  • file: helm_release.yaml tag: spec.chart.spec.version resource: name: chart

  • file: helm_repository.yaml mapping: path: spec.url transform: |- package main

    import ( "encoding/json" "path" )

    result: string

    for x in component.resources { if x.name == "chart" { result: path.Dir(x.access.imageReference) } }

    out: json.Marshal("oci://"+result)

Localization and Configuration are both provided in the same struct. This is to minimize duplication and having to learn multiple structures and Kubernetes Objects. ConfigData is not a full-fledged Kubernetes object because nothing is reconciling it and there is no need for the cluster to be aware of its presence. It's meant to be created and maintained by the Component Consumer. Various configuration and localization methods are available to the consumer: - **plain yaml substitution** - **cue lang** ( https://cuelang.org/ ) with a playground (https://cuelang.org/play/) - **strategic patch merge** The available Localization resource properties are: - **image** - **repository** - **registry** - **tag**.

type ConfigRule

type ConfigRule struct {
	Value any    `json:"value"`
	Path  string `json:"path"`
	File  string `json:"file"`
}

type ConfigurationSpec

type ConfigurationSpec struct {
	Defaults map[string]any      `json:"defaults"`
	Schema   gojsonschema.Schema `json:"schema"`
	Rules    []ConfigRule        `json:"rules"`
}

type LocalizationRule

type LocalizationRule struct {
	Resource   ResourceItem `json:"resource"`
	File       string       `json:"file"`
	Registry   string       `json:"registry,omitempty"`
	Mapping    *Mapping     `json:"mapping,omitempty"`
	Repository string       `json:"repository,omitempty"`
	Image      string       `json:"image,omitempty"`
	Tag        string       `json:"tag,omitempty"`
}

type Mapping

type Mapping struct {
	Path      string `json:"path"`
	Transform string `json:"transform"`
}

type ResourceItem

type ResourceItem struct {
	Name          string            `json:"name"`
	ExtraIdentity map[string]string `json:"extraIdentity,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL