Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/sync/sync"

Index

Variables

Const KubernetesSync

KubernetesSync: "KubernetesSync" = "KubernetesSync"

Functions

kubernetesSync

  • kubernetesSync(sdm: SoftwareDeliveryMachine): CommandHandlerRegistration
  • Command to synchronize the resources in a Kubernetes cluster with the resource specs in the configured sync repo. The sync repo will be cloned and the resources applied against the Kubernetes API in lexical order sorted by file name. If no sync repo is configured in the SDM, the command errors. This command is typically executed on an interval timer by setting the intervalMinutes KubernetesSyncOptions.

    If the SDM configuration says this packs commands should be added, i.e., sdm.configuration.sdm.k8s.options.addCommands is true, the command will have the intent kube sync SDM_NAME. Otherwise the command will be registered without an intent.

    Parameters

    • sdm: SoftwareDeliveryMachine

    Returns CommandHandlerRegistration

repoSync

  • repoSync(cli: CommandListenerInvocation): Promise<HandlerResult>
  • Clone the sync repo and apply the specs to the Kubernetes cluster.

    Parameters

    • cli: CommandListenerInvocation

    Returns Promise<HandlerResult>

sortSpecs

  • sortSpecs(syncRepo: GitProject): Promise<ProjectFile[]>
  • Consume stream of files from project and sort them by their path property using localeCompare. Any file at the root of the project, i.e., not in a subdirectory, having the extensions ".json", ".yaml", or ".yml` are considered specs.

    Essentially, this function converts a FileStream into a Promise of sorted ProjectFiles.

    Parameters

    • syncRepo: GitProject

      Repository of specs to sort

    Returns Promise<ProjectFile[]>

    Sorted array of specs in project

syncApply

  • Return a function that ensures all specs in syncRepo have corresponding resources in the Kubernetes cluster. If the resource does not exist, it is created using the spec. If it does exist, it is patched using the spec. Errors are collected and thrown after processing all specs so one bad spec does not stop processing.

    Parameters

    Returns function

      • (p: GitProject): Promise<void>
      • Parameters

        • p: GitProject

        Returns Promise<void>

Generated using TypeDoc