Skip to content

Question: Can a childResource generated from a resourceTemplate dependsOn another ? #188

Description

@cmoulliard

Question

Can a childResource generated from a resourceTemplate dependsOn another ?

I created the following flow to be able to execute for a Package different Kubernetes Jobs that we could represent as such semantically

Package A
steps:
  - pre-install # optional
  - install (dependsOn - pre-install)
  - post-install # optional (dependsOn - install)

Here is an example

  packages:
    - name: nginx-ingress
      description: "nginx-ingress package"
      pipeline:
        steps:
        - name: pre-install   # !!!!! This step is optional
           image: registry.access.redhat.com/ubi9
           script: |
             echo "This is a pre-installation running a job"
        - name: install-nginx-ingress
           image: dtzar/helm-kubectl
           repoUrl: https://kubernetes.github.io/ingress-nginx
           version: 4.12.2
           valuesObject:
             ingress:
               enabled: true
        - name: post-install # !!!!! This step is optional
           image: registry.access.redhat.com/ubi9
           script: |
             echo "This is a post-installation running a job"

As you can see the flow don't include dependsOn and by consequence, it could be possible that the order is not respected when the following GlueOperator will process it

apiVersion: io.javaoperatorsdk.operator.glue/v1beta1
kind: GlueOperator
metadata:
  name: ingress-platform
spec:
  parent:
    apiVersion: halkyon.io/v1alpha1
    kind: Platform
  childResources:
    - name: jobs
      bulk: true
      resourceTemplate: |
        items:
        {#for pkg in parent.spec.packages}
        {#for s in pkg.pipeline.steps}
        - apiVersion: batch/v1
          kind: Job
          metadata:
            name: {s.name}
            namespace: default
          spec:
            template:
              spec:
                containers:
                  - name: {s.name}
                    image: {s.image}
                    command:
                    {#if s.script??}
                    - /bin/sh
                    - -exc
                    - |
                      {s.script}
                    {#else}
                    - helm
                    - version
                    {/if}
                restartPolicy: Never
            backoffLimit: 4
        {/for}
        {/for}

Argo workflow offers such options :

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions