1. Packages
  2. HashiCorp Nomad
  3. API Docs
  4. SchedulerConfig
Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi

nomad.SchedulerConfig

Explore with Pulumi AI

nomad logo
Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi

    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

    Set cluster scheduler configuration:

    import * as pulumi from "@pulumi/pulumi";
    import * as nomad from "@pulumi/nomad";
    
    const config = new nomad.SchedulerConfig("config", {
        memoryOversubscriptionEnabled: true,
        preemptionConfig: {
            batch_scheduler_enabled: true,
            service_scheduler_enabled: true,
            sysbatch_scheduler_enabled: true,
            system_scheduler_enabled: true,
        },
        schedulerAlgorithm: "spread",
    });
    
    import pulumi
    import pulumi_nomad as nomad
    
    config = nomad.SchedulerConfig("config",
        memory_oversubscription_enabled=True,
        preemption_config={
            "batch_scheduler_enabled": True,
            "service_scheduler_enabled": True,
            "sysbatch_scheduler_enabled": True,
            "system_scheduler_enabled": True,
        },
        scheduler_algorithm="spread")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-nomad/sdk/v2/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{
    			MemoryOversubscriptionEnabled: pulumi.Bool(true),
    			PreemptionConfig: pulumi.BoolMap{
    				"batch_scheduler_enabled":    pulumi.Bool(true),
    				"service_scheduler_enabled":  pulumi.Bool(true),
    				"sysbatch_scheduler_enabled": pulumi.Bool(true),
    				"system_scheduler_enabled":   pulumi.Bool(true),
    			},
    			SchedulerAlgorithm: pulumi.String("spread"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nomad = Pulumi.Nomad;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Nomad.SchedulerConfig("config", new()
        {
            MemoryOversubscriptionEnabled = true,
            PreemptionConfig = 
            {
                { "batch_scheduler_enabled", true },
                { "service_scheduler_enabled", true },
                { "sysbatch_scheduler_enabled", true },
                { "system_scheduler_enabled", true },
            },
            SchedulerAlgorithm = "spread",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nomad.SchedulerConfig;
    import com.pulumi.nomad.SchedulerConfigArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var config = new SchedulerConfig("config", SchedulerConfigArgs.builder()        
                .memoryOversubscriptionEnabled(true)
                .preemptionConfig(Map.ofEntries(
                    Map.entry("batch_scheduler_enabled", true),
                    Map.entry("service_scheduler_enabled", true),
                    Map.entry("sysbatch_scheduler_enabled", true),
                    Map.entry("system_scheduler_enabled", true)
                ))
                .schedulerAlgorithm("spread")
                .build());
    
        }
    }
    
    resources:
      config:
        type: nomad:SchedulerConfig
        properties:
          memoryOversubscriptionEnabled: true
          preemptionConfig:
            batch_scheduler_enabled: true
            service_scheduler_enabled: true
            sysbatch_scheduler_enabled: true
            system_scheduler_enabled: true
          schedulerAlgorithm: spread
    

    Create 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)
    public SchedulerConfig(String name, SchedulerConfigArgs args)
    public SchedulerConfig(String name, SchedulerConfigArgs args, CustomResourceOptions options)
    
    type: nomad:SchedulerConfig
    properties: # The arguments to resource properties.
    options: # 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.
    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.
    name String
    The unique name of the resource.
    args SchedulerConfigArgs
    The arguments to resource properties.
    options 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 Map<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.
    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.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<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.

    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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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)
    public static SchedulerConfig get(String name, Output<String> id, SchedulerConfigState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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 Map<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.
    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.
    memoryOversubscriptionEnabled Boolean
    (bool: false) - When true, tasks may exceed their reserved memory limit.
    preemptionConfig Map<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.

    Package Details

    Repository
    HashiCorp Nomad pulumi/pulumi-nomad
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the nomad Terraform Provider.
    nomad logo
    Nomad v2.2.0 published on Wednesday, Mar 13, 2024 by Pulumi