Skip to content

Commit

Permalink
Merge "Add runfn implementation with timeout support"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Nov 19, 2021
2 parents 6208bf3 + d0e2f6d commit 89c6ff4
Show file tree
Hide file tree
Showing 8 changed files with 1,873 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ spec:
parameter is specified. Else it will write output to STDOUT. This
path relative to current site root.
type: string
timeout:
description: Timeout is the maximum amount of time (in seconds) for
container execution if not specified (0) no timeout will be set
and container could run indefinitely
format: int64
type: integer
type:
description: Supported types are "airship" and "krm"
type: string
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/v1alpha1/genericcontainer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ type GenericContainerSpec struct {

// Mounts are the storage or directories to mount into the container
StorageMounts []StorageMount `json:"mounts,omitempty" yaml:"mounts,omitempty"`

// Timeout is the maximum amount of time (in seconds) for container execution
// if not specified (0) no timeout will be set and container could run indefinitely
Timeout uint64 `json:"timeout,omitempty"`
}

// AirshipContainerSpec airship container settings
Expand Down
3 changes: 2 additions & 1 deletion pkg/container/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
"github.com/ahmetb/dlog"
"sigs.k8s.io/kustomize/kyaml/fn/runtime/runtimeutil"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/runfn"
kyaml "sigs.k8s.io/kustomize/kyaml/yaml"
"sigs.k8s.io/yaml"

"opendev.org/airship/airshipctl/pkg/api/v1alpha1"
"opendev.org/airship/airshipctl/pkg/container/runfn"
"opendev.org/airship/airshipctl/pkg/log"
"opendev.org/airship/airshipctl/pkg/util"
)
Expand Down Expand Up @@ -228,6 +228,7 @@ func (c *V1Alpha1) runKRM() error {
Output: c.output,
StorageMounts: mounts,
ContinueOnEmptyResult: true,
Timeout: c.conf.Spec.Timeout,
}
function, err := kyaml.Parse(c.conf.Config)
if err != nil {
Expand Down
Loading

0 comments on commit 89c6ff4

Please sign in to comment.