aws

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package aws generates Machine objects for aws.

Package aws generates Machine objects for aws.

Index

Constants

This section is empty.

Variables

View Source
var MasterMachineTmpl = template.Must(template.New("aws-master-machine").Parse(`
{{- $c := . -}}
kind: List
apiVersion: v1
metadata:
  resourceVersion: ""
  selfLink: ""
items:
{{- range $index,$instance := $c.Instances}}
- apiVersion: cluster.k8s.io/v1alpha1
  kind: Machine
  metadata:
    name: {{$c.ClusterName}}-master-{{$index}}
    namespace: openshift-cluster-api
    labels:
      sigs.k8s.io/cluster-api-cluster: {{$c.ClusterName}}
      sigs.k8s.io/cluster-api-machine-role: master
      sigs.k8s.io/cluster-api-machine-type: master
  spec:
    providerConfig:
      value:
        apiVersion: aws.cluster.k8s.io/v1alpha1
        kind: AWSMachineProviderConfig
        ami:
          id: {{$c.AMIID}}
        instanceType: {{$c.Machine.InstanceType}}
        placement:
          region: {{$c.Region}}
          availabilityZone: {{$instance.AvailabilityZone}}
        subnet:
          filters:
          - name: "tag:Name"
            values:
            - "{{$c.ClusterName}}-master-{{$instance.AvailabilityZone}}"
        iamInstanceProfile:
          id: "{{$c.ClusterName}}-master-profile"
        tags:
{{- range $key,$value := $c.Tags}}
          - name: "{{$key}}"
            value: "{{$value}}"
{{- end}}
        securityGroups:
          - filters:
            - name: "tag:Name"
              values:
              - "{{$c.ClusterName}}_master_sg"
        userDataSecret:
          name: "master-user-data-{{$index}}"
    versions:
      kubelet: ""
      controlPlane: ""
{{- end}}
`))

MasterMachineTmpl is a template for a list of master machines.

View Source
var WorkerMachineSetsTmpl = template.Must(template.New("aws-worker-machinesets").Parse(`
{{- $c := . -}}
kind: List
apiVersion: v1
metadata:
  resourceVersion: ""
  selfLink: ""
items:
{{- range $index,$instance := $c.Instances}}
- apiVersion: cluster.k8s.io/v1alpha1
  kind: MachineSet
  metadata:
    name: {{$c.ClusterName}}-worker-{{$index}}
    namespace: openshift-cluster-api
    labels:
      sigs.k8s.io/cluster-api-cluster: {{$c.ClusterName}}
      sigs.k8s.io/cluster-api-machine-role: worker
      sigs.k8s.io/cluster-api-machine-type: worker
  spec:
    replicas: {{$instance.Replicas}}
    selector:
      matchLabels:
        sigs.k8s.io/cluster-api-machineset: worker
        sigs.k8s.io/cluster-api-cluster: {{$c.ClusterName}}
    template:
      metadata:
        labels:
          sigs.k8s.io/cluster-api-machineset: worker
          sigs.k8s.io/cluster-api-cluster: {{$c.ClusterName}}
          sigs.k8s.io/cluster-api-machine-role: worker
          sigs.k8s.io/cluster-api-machine-type: worker
      spec:
        providerConfig:
          value:
            apiVersion: aws.cluster.k8s.io/v1alpha1
            kind: AWSMachineProviderConfig
            ami:
              id: {{$c.AMIID}}
            instanceType: {{$c.Machine.InstanceType}}
            placement:
              region: {{$c.Region}}
              availabilityZone: {{$instance.AvailabilityZone}}
            subnet:
              filters:
              - name: "tag:Name"
                values:
                - "{{$c.ClusterName}}-worker-{{$instance.AvailabilityZone}}"
            iamInstanceProfile:
              id: "{{$c.ClusterName}}-worker-profile"
            tags:
              {{- range $key,$value := $c.Tags}}
              - name: "{{$key}}"
                value: "{{$value}}"
              {{- end}}
            securityGroups:
              - filters:
                - name: "tag:Name"
                  values:
                  - "{{$c.ClusterName}}_worker_sg"
            userDataSecret:
              name: worker-user-data
        versions:
          kubelet: ""
          controlPlane: ""
{{- end}}
`))

WorkerMachineSetsTmpl is template for worker machinesets.

Functions

func AvailabilityZones

func AvailabilityZones(region string) ([]string, error)

AvailabilityZones retrieves a list of availability zones for the given region.

Types

type MachineConfig

type MachineConfig struct {
	ClusterName string
	AMIID       string
	Tags        map[string]string
	Region      string
	Machine     types.AWSMachinePoolPlatform
}

MachineConfig contains fields common to worker and master machine configurations

type MasterConfig

type MasterConfig struct {
	MachineConfig
	Instances []MasterInstance
}

MasterConfig is used to generate master machines

type MasterInstance

type MasterInstance struct {
	AvailabilityZone string
}

MasterInstance contains information specific to each master machine instance to create.

type WorkerConfig

type WorkerConfig struct {
	Instances []WorkerMachinesetInstance
	MachineConfig
}

WorkerConfig is used to generate the worker machinesets.

type WorkerMachinesetInstance

type WorkerMachinesetInstance struct {
	Replicas         int64
	AvailabilityZone string
}

WorkerMachinesetInstance constains information specific to one worker machineset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL