app/src/sidecar_deploy/__init__.py
def new_backup_sidecar_deployment(backup_paths: List[str],
                                  store_secret_name: str) -> Dict:
    """Generates a k8s Deployment for the restic-backup-sidecar container.

    Args:
        backup_paths:
            List of paths to back up.
        store_secret_name:
            Name of k8s secret with configuration of backup location.

    Returns:
        A k8s Deployment for the restic-backup-sidecar container as Dict
    """
    with open("/app/src/sidecar_deploy/backup.yml") as f:
        deployment: Dict = yaml.safe_load(f)

    # backup sidecar configuration
    deployment_name = deployment["metadata"]["name"] + f"-{os.urandom(16).hex()}"
    deployment["metadata"]["name"] = deployment_name
    deployment["metadata"]["labels"]["app"] = deployment_name
    deployment["spec"]["selector"]["matchLabels"]["app"] = deployment_name
    deployment["spec"]["template"]["metadata"]["labels"]["app"] = \
        deployment_name
    deployment["spec"]["template"]["spec"]["volumes"][0]["secret"]\
        ["secretName"] = store_secret_name
    deployment["spec"]["template"]["spec"]["containers"][0]["name"] = \
        deployment_name
    deployment["spec"]["template"]["spec"]["containers"][0]["env"] = [
        _from_secret("SFTP_PATH", store_secret_name, "path"),
        _from_secret("SFTP_USER", store_secret_name, "user"),
        _from_secret("SFTP_HOST", store_secret_name, "host"),
        _from_secret("SFTP_PORT", store_secret_name, "port"),
        _from_secret("RESTIC_PASSWORD", store_secret_name, "restic_password"),
        {
            "name": "BACKUP_PATHS",
            "value": ",".join(backup_paths)
        }
    ]

    return deployment
Generates a k8s Deployment for the restic-backup-sidecar container.

    Args:
        backup_paths:
            List of paths to back up.
        store_secret_name:
            Name of k8s secret with configuration of backup location.

    Returns:
        A k8s Deployment for the restic-backup-sidecar container as Dict
    
Generates a k8s Deployment for the restic-backup-sidecar container.
Generates a k8s Deployment for the restic - backup - sidecar container .
def new_backup_sidecar_deployment(backup_paths: List[str],
                                  store_secret_name: str) -> Dict:
    with open("/app/src/sidecar_deploy/backup.yml") as f:
        deployment: Dict = yaml.safe_load(f)
    deployment_name = deployment["metadata"]["name"] + f"-{os.urandom(16).hex()}"
    deployment["metadata"]["name"] = deployment_name
    deployment["metadata"]["labels"]["app"] = deployment_name
    deployment["spec"]["selector"]["matchLabels"]["app"] = deployment_name
    deployment["spec"]["template"]["metadata"]["labels"]["app"] = \
        deployment_name
    deployment["spec"]["template"]["spec"]["volumes"][0]["secret"]\
        ["secretName"] = store_secret_name
    deployment["spec"]["template"]["spec"]["containers"][0]["name"] = \
        deployment_name
    deployment["spec"]["template"]["spec"]["containers"][0]["env"] = [
        _from_secret("SFTP_PATH", store_secret_name, "path"),
        _from_secret("SFTP_USER", store_secret_name, "user"),
        _from_secret("SFTP_HOST", store_secret_name, "host"),
        _from_secret("SFTP_PORT", store_secret_name, "port"),
        _from_secret("RESTIC_PASSWORD", store_secret_name, "restic_password"),
        {
            "name": "BACKUP_PATHS",
            "value": ",".join(backup_paths)
        }
    ]
    return deployment
def new_backup_sidecar_deployment ( backup_paths : List [ str ] , store_secret_name : str ) -> Dict : with open ( "/app/src/sidecar_deploy/backup.yml" ) as f : deployment : Dict = yaml . safe_load ( f ) deployment_name = deployment [ "metadata" ] [ "name" ] + f"-{os.urandom(16).hex()}" deployment [ "metadata" ] [ "name" ] = deployment_name deployment [ "metadata" ] [ "labels" ] [ "app" ] = deployment_name deployment [ "spec" ] [ "selector" ] [ "matchLabels" ] [ "app" ] = deployment_name deployment [ "spec" ] [ "template" ] [ "metadata" ] [ "labels" ] [ "app" ] = deployment_name deployment [ "spec" ] [ "template" ] [ "spec" ] [ "volumes" ] [ 0 ] [ "secret" ] [ "secretName" ] = store_secret_name deployment [ "spec" ] [ "template" ] [ "spec" ] [ "containers" ] [ 0 ] [ "name" ] = deployment_name deployment [ "spec" ] [ "template" ] [ "spec" ] [ "containers" ] [ 0 ] [ "env" ] = [ _from_secret ( "SFTP_PATH" , store_secret_name , "path" ) , _from_secret ( "SFTP_USER" , store_secret_name , "user" ) , _from_secret ( "SFTP_HOST" , store_secret_name , "host" ) , _from_secret ( "SFTP_PORT" , store_secret_name , "port" ) , _from_secret ( "RESTIC_PASSWORD" , store_secret_name , "restic_password" ) , { "name" : "BACKUP_PATHS" , "value" : "," . join ( backup_paths ) } ] return deployment
Generates a k8s Deployment for the restic-backup-sidecar container.
Generates a k8s Deployment for the restic - backup - sidecar container .
"""Generates a k8s Deployment for the restic-backup-sidecar container.

    Args:
        backup_paths:
            List of paths to back up.
        store_secret_name:
            Name of k8s secret with configuration of backup location.

    Returns:
        A k8s Deployment for the restic-backup-sidecar container as Dict
    """ # backup sidecar configuration
A k8s Deployment for the restic-backup-sidecar container as Dict
A k8s Deployment for the restic - backup - sidecar container as Dict
backup_paths
List[str]
List of paths to back up.
List of paths to back up .
store_secret_name
str
Name of k8s secret with configuration of backup location.
Name of k8s secret with configuration of backup location .