Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "pack/k8s/sync/application"

Index

Type aliases

SyncAction

SyncAction: "upsert" | "delete"

Functions

matchSpec

  • Search fileSpecs for a spec that matches spec. To be considered a match, the kind, name, and namespace, which may be undefined, must match. The apiVersion is not considered when matching because the same resource can appear under different API versions.

    Parameters

    • spec: KubernetesObject

      Kubernetes object spec to match

    • fileSpecs: ProjectFileSpec[]

      Array of spec and file objects to search

    Returns ProjectFileSpec | undefined

    First file and spec object to match spec or undefined if no match is found

resourceDeleted

  • Safely persist the deletion of a resource to the sync repo project. If fs is undefined, do nothing.

    Parameters

    • resource: KubernetesObject

      Kubernetes resource that was upserted

    • p: Project

      Sync repo project

    • fs: ProjectFileSpec

      File and spec object that matches resource, may be undefined

    Returns Promise<void>

resourceUpserted

sameObject

  • sameObject(a: KubernetesObject, b: KubernetesObject): boolean
  • Determine if two Kubernetes resource specifications represent the same object. When determining if they are the same, only the kind, name, and namespace, which may be undefined, must match. The apiVersion is not considered when matching because the same resource can appear under different API versions. Other object properties are not considered.

    Parameters

    • a: KubernetesObject

      First Kubernetes object spec to match

    • b: KubernetesObject

      Second Kubernetes object spec to match

    Returns boolean

    true if specs match, false otherwise

syncApplication

  • Synchronize changes from deploying app to the configured syncRepo. If no syncRepo is configured, do nothing.

    Parameters

    • app: KubernetesDelete

      Kubernetes application change that triggered the sync

    • resources: KubernetesObject[]

      Kubernetes resource objects to synchronize

    • Default value action: SyncAction = "upsert"

      Action performed, "upsert" or "delete"

    Returns Promise<void>

syncResources

  • Update the sync repo with the changed resources from a KubernetesApplication. For each changed resource in resources, loop through all the existing Kubernetes spec files, i.e., those that match k8sSpecGlob, to see if the apiVersion, kind, name, and namespace, which may be undefined, match. If a match is found, update that spec file. If no match is found, create a unique file name and store the resource spec in it. If changes are made, commit and push the changes.

    Parameters

    • app: KubernetesDelete

      Kubernetes application object

    • resources: KubernetesObject[]

      Resources that were upserted as part of this application

    • action: SyncAction

      Action performed, "upsert" or "delete"

    • opts: KubernetesSyncOptions

      Repo sync options, passed to the sync action

    Returns (p: GitProject) => Promise<void>

    Function that updates the sync repo with the resource specs

      • Parameters

        • p: GitProject

        Returns Promise<void>

uniqueSpecFile

  • uniqueSpecFile(resource: KubernetesObject, p: Project, format: KubernetesSyncOptions["specFormat"]): Promise<string>
  • Return a unique name for a resource spec that lexically sorts so resources that should be created earlier than others sort earlier than others.

    Parameters

    • resource: KubernetesObject

      Kubernetes object spec

    • p: Project

      Kubernetes spec project

    • format: KubernetesSyncOptions["specFormat"]

    Returns Promise<string>

    Unique spec file name that sorts properly

Generated using TypeDoc