Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix status checks for multiple modules #9370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jashandeep-sohi
Copy link

Issue:

If you have workloads in different namespaces managed in different modules, Skaffold will only run status checks on the first module it encounters. This can be a problem when you have dependencies between the modules, where workloads in one must be healthy before moving onto the next (e.g. CRD operators).

For example,

apiVersion: skaffold/v4beta8
kind: Config
metadata:
  name: a
manifests:
  kustomize:
    paths:
      - ./deploy-a.yaml
deploy:
  kubectl:
    flags:
      apply:
        -  --server-side
---
apiVersion: skaffold/v4beta8
kind: Config
metadata:
  name: b
manifests:
  kustomize:
    paths:
      - ./deploy-b.yaml
deploy:
  kubectl:
    flags:
      apply:
        -  --server-side

Where deploy-a.yaml looks something like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: a
  namespace: a
spec:
  template:
    spec:
      containers:
        - name: default
          image: ...
          command: ["sleep", "inf"]
          livenessProbe:
            exec:
              command: ["true"]
            initialDelaySeconds: 15
            periodSeconds: 5

And deploy-b.yaml looks something like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: b
  namespace: b
spec:
  template:
    spec:
      containers:
        - name: default
          image: ...
          command: ["sleep", "inf"]
          livenessProbe:
            exec:
              command: ["true"]
            initialDelaySeconds: 15
            periodSeconds: 5

Notes:

  • There's a Deployer created per config/module
  • A Deployer holds a reference to a list of namespaces to monitor that it updates as it deploys resources
  • A reference to this list is also passed to the Status Monitor that it uses to figure our what resources to monitor
  • But the Status Monitor is deduped per kubecontext, which leads to a mismatch between the reference to the namespace list for subsequent modules (assuming they use the same kubecontext)
  • There should be a Status Monitor per Deployer
  • Dedup on the config name (those are unique right?)

Also added a Flake to this project, making it easy to install/run Skaffold with Nix:

nix run github:<org>/skaffold/<rev-or-ref>

Issue:

If you have workloads in different namespaces managed in different modules,
Skaffold will only run status checks on the first module it encounters. This
can be a problem when you have dependencies between the modules, where workloads
in one must be healthy before moving onto the next (e.g. CRD operators).

For example,

```yaml
apiVersion: skaffold/v4beta8
kind: Config
metadata:
  name: a
manifests:
  kustomize:
    paths:
      - ./deploy-a.yaml
deploy:
  kubectl:
    flags:
      apply:
        -  --server-side
---
apiVersion: skaffold/v4beta8
kind: Config
metadata:
  name: b
manifests:
  kustomize:
    paths:
      - ./deploy-b.yaml
deploy:
  kubectl:
    flags:
      apply:
        -  --server-side
```

Where `deploy-a.yaml` looks something like:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: a
  namespace: a
spec:
  template:
    spec:
      containers:
        - name: default
          image: ...
          command: ["sleep", "inf"]
          livenessProbe:
            exec:
              command: ["true"]
            initialDelaySeconds: 15
            periodSeconds: 5
```

And `deploy-b.yaml` looks something like:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: b
  namespace: b
spec:
  template:
    spec:
      containers:
        - name: default
          image: ...
          command: ["sleep", "inf"]
          livenessProbe:
            exec:
              command: ["true"]
            initialDelaySeconds: 15
            periodSeconds: 5
```

Notes:
  - There's a Deployer created per config/module
  - A Deployer holds a reference to a list of namespaces to monitor that it
    updates as it deploys resources
  - A reference to this list is also passed to the Status Monitor that it uses
    to figure our what resources to monitor
  - But the Status Monitor is deduped per kubecontext, which leads to a mismatch
    between the reference to the namespace list for subsequent modules (assuming
    they use the same kubecontext)
  - There should be a Status Monitor per Deployer
  - Dedup on the config name (those are unique right?)

Also added a Flake to this project, making it easy to install/run Skaffold with Nix:

```sh
nix run github:<org>/skaffold/<rev-or-ref>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant