Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/bin/
.openshift_install_state.json
.openshift_install.log
.vscode
4 changes: 4 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ aliases:
- Gal-Zaidman
- gekorob
- rgolangh
packet-approvers:
- displague
packet-reviewers:
- displague
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [OpenStack](docs/user/openstack/README.md)
* [OpenStack (UPI) (Experimental)](docs/user/openstack/install_upi.md)
* [oVirt](docs/user/ovirt/install_ipi.md)
* [Packet](docs/user/packet/install_ipi.md)
* [vSphere](docs/user/vsphere/README.md)
* [vSphere (UPI)](docs/user/vsphere/install_upi.md)

Expand Down
1 change: 1 addition & 0 deletions cmd/openshift-install/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
_ "github.com/openshift/installer/pkg/destroy/libvirt"
_ "github.com/openshift/installer/pkg/destroy/openstack"
_ "github.com/openshift/installer/pkg/destroy/ovirt"
_ "github.com/openshift/installer/pkg/destroy/packet"
_ "github.com/openshift/installer/pkg/destroy/vsphere"
timer "github.com/openshift/installer/pkg/metrics/timer"
"github.com/openshift/installer/pkg/terraform"
Expand Down
11 changes: 11 additions & 0 deletions cmd/openshift-install/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
gatherlibvirt "github.com/openshift/installer/pkg/terraform/gather/libvirt"
gatheropenstack "github.com/openshift/installer/pkg/terraform/gather/openstack"
gatherovirt "github.com/openshift/installer/pkg/terraform/gather/ovirt"
gatherpacket "github.com/openshift/installer/pkg/terraform/gather/packet"
gathervsphere "github.com/openshift/installer/pkg/terraform/gather/vsphere"
"github.com/openshift/installer/pkg/types"
awstypes "github.com/openshift/installer/pkg/types/aws"
Expand All @@ -41,6 +42,7 @@ import (
libvirttypes "github.com/openshift/installer/pkg/types/libvirt"
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 @@ -228,6 +230,15 @@ func extractHostAddresses(config *types.InstallConfig, tfstate *terraform.State)
return bootstrap, port, masters, err
}
masters, err = gatherovirt.ControlPlaneIPs(tfstate)
case packettypes.Name:
bootstrap, err = gatherpacket.BootstrapIP(tfstate)
if err != nil {
return bootstrap, port, masters, err
}
masters, err = gatherpacket.ControlPlaneIPs(tfstate)
if err != nil {
logrus.Error(err)
}
case vspheretypes.Name:
bootstrap, err = gathervsphere.BootstrapIP(config, tfstate)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ then
copy_static_resources_for baremetal
copy_static_resources_for openstack
copy_static_resources_for ovirt
copy_static_resources_for packet
copy_static_resources_for vsphere

cp mco-bootstrap/manifests/* manifests/
Expand Down
7 changes: 7 additions & 0 deletions data/data/bootstrap/packet/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md
# This file just uses aliases defined in OWNERS_ALIASES.

approvers:
- packet-approvers
reviewers:
- packet-reviewers
55 changes: 55 additions & 0 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ spec:
- high_performance
type: string
type: object
packet:
description: Packet is the configuration used when installing
on Packet.
type: object
vsphere:
description: VSphere is the configuration used when installing
on vSphere.
Expand Down Expand Up @@ -573,6 +577,10 @@ spec:
- high_performance
type: string
type: object
packet:
description: Packet is the configuration used when installing
on Packet.
type: object
vsphere:
description: VSphere is the configuration used when installing
on vSphere.
Expand Down Expand Up @@ -1433,6 +1441,53 @@ spec:
- ovirt_cluster_id
- ovirt_storage_domain_id
type: object
packet:
description: Packet is the configuration used when installing on Packet.
properties:
apivip:
description: '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'
format: ip
type: string
bootstrapOSImage:
description: 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...
type: string
clusterOSImage:
description: 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...
type: string
computeSubnet:
description: ComputeSubnet is an existing subnet where the compute
nodes will be deployed. The value should be the name of the
subnet.
type: string
controlPlaneSubnet:
description: ControlPlaneSubnet is an existing subnet where the
control plane will be deployed. The value should be the name
of the subnet.
type: string
defaultMachinePlatform:
description: DefaultMachinePlatform is the default configuration
used when installing on bare metal for machine pools which do
not define their own platform configuration.
type: object
facility_code:
description: FacilityCode represents the Packet region and datacenter
where your devices will be provisioned (https://www.packet.com/developers/docs/getting-started/facilities/)
type: string
network:
description: Network specifies an existing VPC where the cluster
should be created rather than provisioning a new one.
type: string
project_id:
description: ProjectID represents the Packet project used for
logical grouping and invoicing (https://www.packet.com/developers/docs/API/getting-started/)
type: string
type: object
vsphere:
description: VSphere is the configuration used when installing on
vSphere.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ metadata:
name: vsphere-creds
{{- else if .CloudCreds.Ovirt}}
name: ovirt-credentials
{{- else if .CloudCreds.Packet}}
name: packet-credentials
{{- end}}
data:
{{- if .CloudCreds.AWS}}
Expand Down Expand Up @@ -42,4 +44,11 @@ data:
ovirt_cafile: {{.CloudCreds.Ovirt.Base64encodeCAFile}}
ovirt_insecure: {{.CloudCreds.Ovirt.Base64encodeInsecure}}
ovirt_ca_bundle: {{.CloudCreds.Ovirt.Base64encodeCABundle}}
{{- else if .CloudCreds.Packet}}
packet_url: {{.CloudCreds.Packet.Base64encodeURL}}
packet_username: {{.CloudCreds.Packet.Base64encodeUsername}}
packet_password: {{.CloudCreds.Packet.Base64encodePassword}}
packet_cafile: {{.CloudCreds.Packet.Base64encodeCAFile}}
packet_insecure: {{.CloudCreds.Packet.Base64encodeInsecure}}
packet_ca_bundle: {{.CloudCreds.Packet.Base64encodeCABundle}}
{{- end}}
7 changes: 7 additions & 0 deletions data/data/packet/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md
# This file just uses aliases defined in OWNERS_ALIASES.

approvers:
- packet-approvers
reviewers:
- packet-reviewers
Empty file.
155 changes: 155 additions & 0 deletions data/data/packet/bootstrap/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@

locals {
arch = "x86_64"
coreos_baseurl = "http://54.172.173.155/pub/openshift-v4/dependencies/rhcos"
coreos_url = "${local.coreos_baseurl}/${var.ocp_version}/${var.ocp_version}.${var.ocp_version_zstream}"
coreos_filenm = "rhcos-${var.ocp_version}.${var.ocp_version_zstream}-${local.arch}"
coreos_img = "${local.coreos_filenm}-metal.${local.arch}.raw.gz"
coreos_kernel = "${local.coreos_filenm}-installer-kernel-${local.arch}"
coreos_initrd = "${local.coreos_filenm}-installer-initramfs.${local.arch}.img"
}

data "template_file" "user_data" {
template = file("${path.module}/templates/user_data_${var.operating_system}.sh")
}

data "template_file" "ipxe_script" {
depends_on = [packet_device.lb]
for_each = toset(var.nodes)
template = file("${path.module}/templates/ipxe.tpl")

vars = {
node_type = each.value
bastion_ip = packet_device.lb.access_public_ipv4
ocp_version = var.ocp_version
ocp_version_zstream = var.ocp_version_zstream
}
}

data "template_file" "ignition_append" {
depends_on = [packet_device.lb]
for_each = toset(var.nodes)
template = file("${path.module}/templates/ignition-append.json.tpl")

vars = {
node_type = each.value
bastion_ip = packet_device.lb.access_public_ipv4
cluster_name = var.cluster_name
cluster_basedomain = var.cluster_basedomain
}
}

resource "packet_device" "lb" {
hostname = "lb-0.${var.cluster_name}.${var.cluster_basedomain}"
plan = var.plan
facilities = [var.facility]
operating_system = var.operating_system
billing_cycle = var.billing_cycle
project_id = var.project_id
user_data = data.template_file.user_data.rendered

}

resource "null_resource" "dircheck" {

provisioner "remote-exec" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}


inline = [
"while [ ! -d /usr/share/nginx/html ]; do sleep 2; done; ls /usr/share/nginx/html/",
"while [ ! -f /usr/lib/systemd/system/nfs-server.service ]; do sleep 2; done; ls /usr/lib/systemd/system/nfs-server.service"
]
}
}

resource "null_resource" "ocp_install_ignition" {

depends_on = [null_resource.dircheck]


provisioner "remote-exec" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}


inline = [
"curl -o /usr/share/nginx/html/${local.coreos_img} ${local.coreos_url}/${local.coreos_img}",
"curl -o /usr/share/nginx/html/${local.coreos_kernel} ${local.coreos_url}/${local.coreos_kernel}",
"curl -o /usr/share/nginx/html/${local.coreos_initrd} ${local.coreos_url}/${local.coreos_initrd}",
"chmod -R 0755 /usr/share/nginx/html/"
]
}
}

resource "null_resource" "ipxe_files" {

depends_on = [null_resource.dircheck]
for_each = data.template_file.ipxe_script

provisioner "file" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}

content = each.value.rendered
destination = "/usr/share/nginx/html/${each.key}.ipxe"
}

provisioner "remote-exec" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}


inline = [
"chmod -R 0755 /usr/share/nginx/html/",
]
}
}

resource "null_resource" "ignition_append_files" {

depends_on = [null_resource.dircheck]
for_each = data.template_file.ignition_append

provisioner "file" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}

content = each.value.rendered
destination = "/usr/share/nginx/html/${each.key}-append.ign"
}

provisioner "remote-exec" {

connection {
private_key = file(var.ssh_private_key_path)
host = packet_device.lb.access_public_ipv4
}


inline = [
"chmod -R 0755 /usr/share/nginx/html/",
]
}
}

output "finished" {
depends_on = [null_resource.file_uploads, null_resource.ipxe_files]
value = "Loadbalancer provisioning finished."
}
3 changes: 3 additions & 0 deletions data/data/packet/bootstrap/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "lb_ip" {
value = packet_device.lb.access_public_ipv4
}
17 changes: 17 additions & 0 deletions data/data/packet/bootstrap/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
variable "depends" {
type = any
default = null
}

variable "ssh_private_key_path" {}
variable "cluster_name" {}
variable "cluster_basedomain" {}
variable "cf_zone_id" {}
variable "ocp_version" {}
variable "ocp_version_zstream" {}
variable "nodes" {
description = "Generic list of OpenShift node types"
type = list(string)
default = ["bootstrap", "master", "worker"]
}

3 changes: 3 additions & 0 deletions data/data/packet/bootstrap/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 0.12"
}
Loading