HashiCorp Nomad

v0.2.1 published on Tuesday, Dec 7, 2021 by Pulumi

SchedulerConfig

Manages scheduler configuration of the Nomad cluster.

Warning: destroying this resource will not have any effect in the cluster configuration, since there’s no clear definition of what a destroy action should do. The cluster will be left as-is and only the state reference will be removed.

Example Usage

using Pulumi;
using Nomad = Pulumi.Nomad;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Nomad.SchedulerConfig("config", new Nomad.SchedulerConfigArgs
        {
            PreemptionConfig = 
            {
                { "batch_scheduler_enabled", true },
                { "service_scheduler_enabled", true },
                { "system_scheduler_enabled", true },
            },
            SchedulerAlgorithm = "spread",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-nomad/sdk/go/nomad"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := nomad.NewSchedulerConfig(ctx, "config", &nomad.SchedulerConfigArgs{
			PreemptionConfig: pulumi.BoolMap{
				"batch_scheduler_enabled":   pulumi.Bool(true),
				"service_scheduler_enabled": pulumi.Bool(true),
				"system_scheduler_enabled":  pulumi.Bool(true),
			},
			SchedulerAlgorithm: pulumi.String("spread"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_nomad as nomad

config = nomad.SchedulerConfig("config",
    preemption_config={
        "batch_scheduler_enabled": True,
        "service_scheduler_enabled": True,
        "system_scheduler_enabled": True,
    },
    scheduler_algorithm="spread")
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";

const config = new nomad.SchedulerConfig("config", {
    preemptionConfig: {
        batch_scheduler_enabled: true,
        service_scheduler_enabled: true,
        system_scheduler_enabled: true,
    },
    schedulerAlgorithm: "spread",
});

Create a SchedulerConfig Resource

new SchedulerConfig(name: string, args?: SchedulerConfigArgs, opts?: CustomResourceOptions);
@overload
def SchedulerConfig(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    memory_oversubscription_enabled: Optional[bool] = None,
                    preemption_config: Optional[Mapping[str, bool]] = None,
                    scheduler_algorithm: Optional[str] = None)
@overload
def SchedulerConfig(resource_name: str,
                    args: Optional[SchedulerConfigArgs] = None,
                    opts: Optional[ResourceOptions] = None)
func NewSchedulerConfig(ctx *Context, name string, args *SchedulerConfigArgs, opts ...ResourceOption) (*SchedulerConfig, error)
public SchedulerConfig(string name, SchedulerConfigArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SchedulerConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args SchedulerConfigArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SchedulerConfigArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SchedulerConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

SchedulerConfig Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The SchedulerConfig resource accepts the following input properties:

MemoryOversubscriptionEnabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
PreemptionConfig Dictionary<string, bool>
(map[string]bool) - Options to enable preemption for various schedulers.
SchedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
MemoryOversubscriptionEnabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
PreemptionConfig map[string]bool
(map[string]bool) - Options to enable preemption for various schedulers.
SchedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
memoryOversubscriptionEnabled boolean
(bool: false) - When true, tasks may exceed their reserved memory limit.
preemptionConfig {[key: string]: boolean}
(map[string]bool) - Options to enable preemption for various schedulers.
schedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
memory_oversubscription_enabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
preemption_config Mapping[str, bool]
(map[string]bool) - Options to enable preemption for various schedulers.
scheduler_algorithm str
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.

Outputs

All input properties are implicitly available as output properties. Additionally, the SchedulerConfig resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing SchedulerConfig Resource

Get an existing SchedulerConfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SchedulerConfigState, opts?: CustomResourceOptions): SchedulerConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        memory_oversubscription_enabled: Optional[bool] = None,
        preemption_config: Optional[Mapping[str, bool]] = None,
        scheduler_algorithm: Optional[str] = None) -> SchedulerConfig
func GetSchedulerConfig(ctx *Context, name string, id IDInput, state *SchedulerConfigState, opts ...ResourceOption) (*SchedulerConfig, error)
public static SchedulerConfig Get(string name, Input<string> id, SchedulerConfigState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

MemoryOversubscriptionEnabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
PreemptionConfig Dictionary<string, bool>
(map[string]bool) - Options to enable preemption for various schedulers.
SchedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
MemoryOversubscriptionEnabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
PreemptionConfig map[string]bool
(map[string]bool) - Options to enable preemption for various schedulers.
SchedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
memoryOversubscriptionEnabled boolean
(bool: false) - When true, tasks may exceed their reserved memory limit.
preemptionConfig {[key: string]: boolean}
(map[string]bool) - Options to enable preemption for various schedulers.
schedulerAlgorithm string
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.
memory_oversubscription_enabled bool
(bool: false) - When true, tasks may exceed their reserved memory limit.
preemption_config Mapping[str, bool]
(map[string]bool) - Options to enable preemption for various schedulers.
scheduler_algorithm str
(string: "binpack") - Specifies whether scheduler binpacks or spreads allocations on available nodes. Possible values are binpack and spread.

Package Details

Repository
https://github.com/pulumi/pulumi-nomad
License
Apache-2.0
Notes
This Pulumi package is based on the nomad Terraform Provider.