vcluster-fs-syncer

module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0

README

vcluster-fs-syncer

go.dev reference Generated via Bootstrap Coverage Status

Synchronizes /var/lib/kubelet/pods into predictable vcluster scoped paths at /var/lib/loft/<vclusterName>/pods

Contributing

Please read the CONTRIBUTING.md document for guidelines on developing and contributing changes.

High-level Overview

This service is a light-weight service that reacts to pod creation, update, and delete events.

When a pod event is received, it looks for the following annotations to determine if a pod is deployed in a vcluster and to grab information on the virtual pod (within the vcluster):

  • vcluster.loft.sh/uid - UUID of the pod inside the vcluster
  • vcluster.loft.sh/name - Name of the pod inside the vcluster
  • vcluster.loft.sh/namespace - Namespace of the pod inside the vcluster
  • vcluster.loft.sh/managed-by - Name of the vcluster that the pod is deployed in

If the pod contains all of these annotations, the pod is considered to be deployed in a vcluster and the pod directory is bind mounted into the vcluster scoped directory at /var/lib/loft/<vclusterName>/pods/<podUID>.

If the pod does not contain all of these annotations, the pod is considered to be deployed in the host cluster and no action is taken.

The ideal use case for this service is to run daemonsets inside of a virtual cluster that need access to the pod directory. For example, Velero which needs it for the restic (now called node-agent) daemonset. In order to use the per-vcluster pod directory, the /var/lib/loft/<vclusterName>/pods directory must be mounted in your Kubernetes resource at whatever path you need it to be.

Deploying

The vcluster-fs-syncer is deployed as a Kubernetes Deployment. It is deployed in the vcluster-fs-syncer--bento1a namespace.

To deploy, run the following:

./scripts/shell-wrapper.sh deploy-to-dev.sh show | kubectl apply -f -
Adding and Deleting Service in Development Environment

First, make sure you set up your development environment.

To add this service to your developer environment:

devenv apps deploy vcluster-fs-syncer

To delete this service from your developer environment:

devenv apps delete vcluster-fs-syncer

Directories

Path Synopsis
cmd
vcluster-fs-syncer
Package main implements the main entrypoint for the vcluster-fs-syncer service.
Package main implements the main entrypoint for the vcluster-fs-syncer service.
internal
kube
Package kube implements helpers for creating a Kubernetes client.
Package kube implements helpers for creating a Kubernetes client.
syncer
Package syncer implements the syncer for synchronization of /var/lib/kubelet/pods.
Package syncer implements the syncer for synchronization of /var/lib/kubelet/pods.
vcluster-fs-syncer
Package vcluster_fs_syncer contains the base activities that make up the service.
Package vcluster_fs_syncer contains the base activities that make up the service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL