Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "pack/k8s/sync/sync"

Index

Variables

Const KubernetesSync

KubernetesSync: "KubernetesSync" = "KubernetesSync"

Functions

kubernetesSync

  • 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

    Returns CommandHandlerRegistration

repoSync

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 (p: GitProject) => Promise<void>

      • Parameters

        • p: GitProject

        Returns Promise<void>

Generated using TypeDoc