open-nomad/nomad/job_endpoint_hook_node_pool_oss.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
784 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build !ent
// +build !ent
package nomad
import "github.com/hashicorp/nomad/nomad/structs"
// enterpriseValidation implements any admission hooks for node pools for Nomad
// Enterprise.
func (j jobNodePoolValidatingHook) enterpriseValidation(_ *structs.Job, _ *structs.NodePool) ([]error, error) {
return nil, nil
}
// jobNodePoolMutatingHook mutates the job on Nomad Enterprise only.
type jobNodePoolMutatingHook struct {
srv *Server
}
func (c jobNodePoolMutatingHook) Name() string {
return "node-pool-mutation"
}
func (c jobNodePoolMutatingHook) Mutate(job *structs.Job) (*structs.Job, []error, error) {
if job.NodePool == "" {
job.NodePool = structs.NodePoolDefault
}
return job, nil, nil
}