Skip to content

Skaffold after sync hook to target specific containers #9044

Open
@RossKohler

Description

@RossKohler

Let me just start by saying that I've really been enjoying using Skaffold in one of my projects. I would like to make a feature request, or maybe someone can give me some idea of how I can achieve this using the existing skaffold.yaml schema https://skaffold.dev/docs/references/yaml/.

I'm running the sync functionality for the local development of an Airflow instance within a Kind Kubernetes cluster. Basically, every time I make changes to files in my local directory they are synced with the Airflow deployment and I'm able to dev in a complete environment that accurately simulates production. This works well!

The problem is that Airflow has intervals in which it scans the file structure for changes. So between syncs, there could at most be 30 seconds to wait before Airflow picks up the changes. But if I could run airflow dags reserialize inside one of the pods after every sync, I could force Airflow to rescan immediately. This is almost completely possible with the current structure of the skaffold.yaml schema, I could just use the after sync hook and run the command in the containers. But what happens, is that because I cant target a specific pod, like I can in other hooks, this command runs 4 or 5 times (depending on how many pods are running).

Would it make sense to allow that after-sync hook to target specific pods? like the other hooks seem to allow you to do?

A workaround is that instead of using the container parameter, I just write a script that get's triggered after every sync that basically does a kubectl exec on one of the pods. I'm not sure if there are any other suggestions on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions