Skip to content

Commit

Permalink
fill in packet Platform and Metadata types
Browse files Browse the repository at this point in the history
  • Loading branch information
displague committed Jul 28, 2020
1 parent e649626 commit c039c08
Show file tree
Hide file tree
Showing 80 changed files with 3,024 additions and 4,604 deletions.
314 changes: 212 additions & 102 deletions docs/dev/adding-new-platform.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/ovirt/go-ovirt v0.0.0-20200613023950-320a86f9df27
github.com/ovirt/terraform-provider-ovirt v0.4.3-0.20200406133650-74a154c1d861
github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db // indirect
github.com/packethost/packngo v0.2.0
github.com/packethost/packngo v0.2.1-0.20200424110205-36917dbc292f
github.com/pborman/uuid v1.2.0
github.com/pierrec/lz4 v2.3.0+incompatible // indirect
github.com/pkg/errors v0.9.1
Expand All @@ -80,14 +80,14 @@ require (
github.com/terraform-providers/terraform-provider-ignition v1.2.1
github.com/terraform-providers/terraform-provider-local v1.4.0
github.com/terraform-providers/terraform-provider-openstack v1.28.0
github.com/terraform-providers/terraform-provider-packet v1.7.2
github.com/terraform-providers/terraform-provider-packet v1.7.3-0.20200512085448-9717adf77547
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f
github.com/terraform-providers/terraform-provider-vsphere v1.16.2
github.com/ulikunitz/xz v0.5.6
github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50
github.com/vmware/govmomi v0.22.2
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d
Expand Down
29 changes: 10 additions & 19 deletions go.sum

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/asset/cluster/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/openshift/installer/pkg/asset/cluster/libvirt"
"github.com/openshift/installer/pkg/asset/cluster/openstack"
"github.com/openshift/installer/pkg/asset/cluster/ovirt"
"github.com/openshift/installer/pkg/asset/cluster/packet"
"github.com/openshift/installer/pkg/asset/cluster/vsphere"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/types"
Expand All @@ -26,6 +27,7 @@ import (
nonetypes "github.com/openshift/installer/pkg/types/none"
openstacktypes "github.com/openshift/installer/pkg/types/openstack"
ovirttypes "github.com/openshift/installer/pkg/types/ovirt"
packettypes "github.com/openshift/installer/pkg/types/packet"
vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
)

Expand Down Expand Up @@ -83,6 +85,8 @@ func (m *Metadata) Generate(parents asset.Parents) (err error) {
metadata.ClusterPlatformMetadata.Ovirt = ovirt.Metadata(installConfig.Config)
case vspheretypes.Name:
metadata.ClusterPlatformMetadata.VSphere = vsphere.Metadata(installConfig.Config)
case packettypes.Name:
metadata.ClusterPlatformMetadata.Packet = packet.Metadata(installConfig.Config)
case nonetypes.Name:
default:
return errors.Errorf("no known platform")
Expand Down
7 changes: 5 additions & 2 deletions pkg/asset/cluster/packet/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import (
"github.com/openshift/installer/pkg/types/packet"
)

// Metadata converts an install configuration to ovirt metadata.
// Metadata converts an install configuration to Packet metadata.
func Metadata(config *types.InstallConfig) *packet.Metadata {
m := packet.Metadata{}
m := packet.Metadata{
FacilityCode: config.Platform.Packet.FacilityCode,
ProjectID: config.Platform.Packet.ProjectID,
}
return &m
}
6 changes: 6 additions & 0 deletions pkg/asset/ignition/machine/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
baremetaltypes "github.com/openshift/installer/pkg/types/baremetal"
openstacktypes "github.com/openshift/installer/pkg/types/openstack"
ovirttypes "github.com/openshift/installer/pkg/types/ovirt"
packettypes "github.com/openshift/installer/pkg/types/packet"
vspheretypes "github.com/openshift/installer/pkg/types/vsphere"
)

Expand All @@ -35,6 +36,11 @@ func pointerIgnitionConfig(installConfig *types.InstallConfig, rootCA []byte, ro
if installConfig.VSphere.APIVIP != "" {
ignitionHost = net.JoinHostPort(installConfig.VSphere.APIVIP, "22623")
}
case packettypes.Name:
if installConfig.Packet.APIVIP != "" {
ignitionHost = net.JoinHostPort(installConfig.Packet.APIVIP, "22623")

}
}
return &ignition.Config{
Ignition: ignition.Ignition{
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/installconfig/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func (a *InstallConfig) platformValidation() error {
}
if a.Config.Platform.OpenStack != nil {
return icopenstack.Validate(a.Config)
}
if a.Config.Platform.Packet != nil {
return icpacket.Validate(a.Config)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/types/packet/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ package packet

// Metadata contains packet metadata (e.g. for uninstalling the cluster).
type Metadata struct {
// FacilityCode represents the Packet region and datacenter where your devices will be provisioned (https://www.packet.com/developers/docs/getting-started/facilities/)
FacilityCode string `json:"facility_code,omitempty"`

// ProjectID represents the Packet project used for logical grouping and invoicing (https://www.packet.com/developers/docs/API/getting-started/)
ProjectID string `json:"project_id,omitempty"`
}
43 changes: 43 additions & 0 deletions pkg/types/packet/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,47 @@ type Platform struct {

// ProjectID represents the Packet project used for logical grouping and invoicing (https://www.packet.com/developers/docs/API/getting-started/)
ProjectID string `json:"project_id,omitempty"`

// APIVIP is the static IP on the nodes subnet that the api port for
// openshift will be assigned
// Default: will be set to the 5 on the first entry in the machineNetwork
// CIDR
// +optional
// +kubebuilder:validation:Format=ip
APIVIP string `json:"apivip,omitempty"`

// DefaultMachinePlatform is the default configuration used when
// installing on bare metal for machine pools which do not define their own
// platform configuration.
// +optional
DefaultMachinePlatform *MachinePool `json:"defaultMachinePlatform,omitempty"`

// Network specifies an existing VPC where the cluster should be created
// rather than provisioning a new one.
// +optional
Network string `json:"network,omitempty"`

// ControlPlaneSubnet is an existing subnet where the control plane will be deployed.
// The value should be the name of the subnet.
// +optional
ControlPlaneSubnet string `json:"controlPlaneSubnet,omitempty"`

// ComputeSubnet is an existing subnet where the compute nodes will be deployed.
// The value should be the name of the subnet.
// +optional
ComputeSubnet string `json:"computeSubnet,omitempty"`

// BootstrapOSImage is a URL to override the default OS image
// for the bootstrap node. The URL must contain a sha256 hash of the image
// e.g https://mirror.example.com/images/qemu.qcow2.gz?sha256=a07bd...
//
// +optional
BootstrapOSImage string `json:"bootstrapOSImage,omitempty" validate:"omitempty,osimageuri,urlexist"`

// ClusterOSImage is a URL to override the default OS image
// for cluster nodes. The URL must contain a sha256 hash of the image
// e.g https://mirror.example.com/images/metal.qcow2.gz?sha256=3b5a8...
//
// +optional
ClusterOSImage string `json:"clusterOSImage,omitempty" validate:"omitempty,osimageuri,urlexist"`
}
13 changes: 13 additions & 0 deletions vendor/github.com/hashicorp/go-retryablehttp/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c039c08

Please sign in to comment.