Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/kubernetes/spec"

Index

Functions

kubernetesSpecFileBasename

  • kubernetesSpecFileBasename(resource: KubernetesObject): string
  • Create a suitable basename for the spec file for resource. The form of the file name is "NN-NAMESPACE-NAME-KIND", where "NN" is a numeric prefix so the resources are created in the proper order, "NAMESPACE-" is omitted if resource is not namespaced, the kind is converted from PascalCase to kebab-case, and the whole name is lowercased.

    Parameters

    • resource: KubernetesObject

      Kubernetes resource spec

    Returns string

    Base file name for resource spec

kubernetesSpecStringify

  • Convert a Kubernetes resource spec into a stable string suitable for writing to a file or comparisons.

    Parameters

    Returns Promise<string>

    Stable string representation of the resource spec

parseKubernetesSpecs

  • parseKubernetesSpecs(specString: string): KubernetesObject[]
  • Parses content of string as Kubernetes JSON or YAML specs. It parses the file as YAML, since JSON is valid YAML, and returns an array of [[k8s.KubernetesObject]]s, since a YAML file can contain multiple documents. It validates that each document parsed looks something like a Kubernetes spec. If it does not, it is filtered out of the returned specs.

    Parameters

    • specString: string

      String representation of Kubernetes spec(s)

    Returns KubernetesObject[]

    Parsed and filtered Kubernetes spec objects

specSlug

  • specSlug(spec: KubernetesObject): string

specSnippet

  • specSnippet(spec: KubernetesObject): string
  • Convert spec to string and shorten it if necessary.

    Parameters

    • spec: KubernetesObject

    Returns string

specStringSnippet

  • specStringSnippet(spec: string): string

Generated using TypeDoc