mirror of https://github.com/kubernetes/kops.git
add Label Resource Tag Specification Volumes
This commit is contained in:
parent
1e6ec01eb3
commit
00fc4e78e8
|
|
@ -198,15 +198,16 @@ metadata:
|
|||
labels:
|
||||
spotinst.io/strategy-cluster-spread-nodes-by: "count"
|
||||
spotinst.io/strategy-cluster-orientation-availability-vs-cost: "balanced"
|
||||
spotinst.io/resource-tag-specification-volumes: "true"
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
| Label | Description | Default |
|
||||
|---|---|---|
|
||||
|| Label | Description | Default |
|
||||
|---|----------------------------------------------------------------------------------------|---|
|
||||
| `spotinst.io/strategy-cluster-spread-nodes-by` | Specify how Ocean will spread the nodes across markets by this value [vcpu,count]. | `count` |
|
||||
| `spotinst.io/strategy-cluster-orientation-availability-vs-cost` | Specify approach [cost,balanced,cheapest] that Ocean takes while launching nodes. | `balanced` |
|
||||
|
||||
| `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` |
|
||||
## Documentation
|
||||
|
||||
If you're new to [Spot](https://spot.io/) and want to get started, please checkout our [Getting Started](https://docs.spot.io/connect-your-cloud-provider/) guide, available on the [Spot Documentation](https://docs.spot.io/) website.
|
||||
|
|
|
|||
|
|
@ -135,6 +135,10 @@ const (
|
|||
// SpotClusterLabelStrategyClusterOrientationAvailabilityVsCost is the metadata label used on the
|
||||
// instance group to specify how to optimize towards continuity and/or cost-effective infrastructure
|
||||
SpotClusterLabelStrategyClusterOrientationAvailabilityVsCost = "spotinst.io/strategy-cluster-orientation-availability-vs-cost"
|
||||
|
||||
// SpotClusterLabelResourceTagSpecificationVolumes
|
||||
// Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags.
|
||||
SpotClusterLabelResourceTagSpecificationVolumes = "spotinst.io/resource-tag-specification-volumes"
|
||||
)
|
||||
|
||||
// SpotInstanceGroupModelBuilder configures SpotInstanceGroup objects
|
||||
|
|
@ -387,6 +391,11 @@ func (b *SpotInstanceGroupModelBuilder) buildOcean(c *fi.CloudupModelBuilderCont
|
|||
ocean.SpreadNodesBy = fi.PtrTo(v)
|
||||
case SpotClusterLabelStrategyClusterOrientationAvailabilityVsCost:
|
||||
ocean.AvailabilityVsCost = fi.PtrTo(string(spotinsttasks.NormalizeClusterOrientation(&v)))
|
||||
case SpotClusterLabelResourceTagSpecificationVolumes:
|
||||
ocean.ResourceTagSpecificationVolumes, err = parseBool(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ type Ocean struct {
|
|||
InstanceMetadataOptions *InstanceMetadataOptions
|
||||
SpreadNodesBy *string
|
||||
AvailabilityVsCost *string
|
||||
ResourceTagSpecificationVolumes *bool
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -304,6 +305,11 @@ func (o *Ocean) Find(c *fi.CloudupContext) (*Ocean, error) {
|
|||
actual.InstanceMetadataOptions.HTTPTokens = fi.PtrTo(fi.ValueOf(lc.InstanceMetadataOptions.HTTPTokens))
|
||||
actual.InstanceMetadataOptions.HTTPPutResponseHopLimit = fi.PtrTo(int64(fi.ValueOf(lc.InstanceMetadataOptions.HTTPPutResponseHopLimit)))
|
||||
}
|
||||
|
||||
//
|
||||
if lc.ResourceTagSpecification != nil {
|
||||
actual.ResourceTagSpecificationVolumes = fi.PtrTo(fi.ValueOf(lc.ResourceTagSpecification.Volumes.ShouldTag))
|
||||
}
|
||||
}
|
||||
|
||||
// Auto Scaler.
|
||||
|
|
@ -483,6 +489,16 @@ func (_ *Ocean) create(cloud awsup.AWSCloud, a, e, changes *Ocean) error {
|
|||
ocean.Compute.LaunchSpecification.SetInstanceMetadataOptions(opt)
|
||||
}
|
||||
}
|
||||
//
|
||||
{
|
||||
if e.ResourceTagSpecificationVolumes != nil {
|
||||
opt := new(aws.ResourceTagSpecification)
|
||||
vol := new(aws.Volumes)
|
||||
vol.SetShouldTag(fi.PtrTo(fi.ValueOf(e.ResourceTagSpecificationVolumes)))
|
||||
opt.SetVolumes(vol)
|
||||
ocean.Compute.LaunchSpecification.SetResourceTagSpecification(opt)
|
||||
}
|
||||
}
|
||||
if !fi.ValueOf(e.UseAsTemplateOnly) {
|
||||
// User data.
|
||||
{
|
||||
|
|
@ -830,7 +846,22 @@ func (_ *Ocean) update(cloud awsup.AWSCloud, a, e, changes *Ocean) error {
|
|||
changed = true
|
||||
}
|
||||
}
|
||||
|
||||
// ResourceTagSpecificationVolumes.
|
||||
{
|
||||
if changes.ResourceTagSpecificationVolumes != nil {
|
||||
if ocean.Compute == nil {
|
||||
ocean.Compute = new(aws.Compute)
|
||||
}
|
||||
if ocean.Compute.LaunchSpecification == nil {
|
||||
ocean.Compute.LaunchSpecification = new(aws.LaunchSpecification)
|
||||
}
|
||||
opt := new(aws.ResourceTagSpecification)
|
||||
opt.Volumes.SetShouldTag(fi.PtrTo(fi.ValueOf(e.ResourceTagSpecificationVolumes)))
|
||||
ocean.Compute.LaunchSpecification.SetResourceTagSpecification(opt)
|
||||
changes.ResourceTagSpecificationVolumes = nil
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
// Template.
|
||||
{
|
||||
if changes.UseAsTemplateOnly != nil {
|
||||
|
|
@ -1120,6 +1151,7 @@ type terraformOcean struct {
|
|||
SecurityGroups []*terraformWriter.Literal `cty:"security_groups"`
|
||||
SpreadNodesBy *string `cty:"spread_nodes_by"`
|
||||
AvailabilityVsCost *string `cty:"availability_vs_cost"`
|
||||
ResourceTagSpecificationVolumes *bool `cty:"resource_tag_specification_volumes"`
|
||||
}
|
||||
|
||||
func (_ *Ocean) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Ocean) error {
|
||||
|
|
@ -1136,6 +1168,7 @@ func (_ *Ocean) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Oce
|
|||
GracePeriod: e.GracePeriod,
|
||||
SpreadNodesBy: e.SpreadNodesBy,
|
||||
AvailabilityVsCost: e.AvailabilityVsCost,
|
||||
ResourceTagSpecificationVolumes: e.ResourceTagSpecificationVolumes,
|
||||
}
|
||||
|
||||
// Image.
|
||||
|
|
|
|||
Loading…
Reference in New Issue