Skip to content
Merged
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
29 changes: 26 additions & 3 deletions Gopkg.lock

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

8 changes: 8 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@ required = [
branch = "master"
name = "github.com/metal3-io/baremetal-operator"
source = "https://github.com/openshift/baremetal-operator"

[[constraint]]
name = "github.com/ovirt/cluster-api-provider-ovirt"
revision ="f7b0ebc7f9ae17c0d5d5b4f5795a1b70972a5570"

[[constraint]]
name = "github.com/ovirt/go-ovirt"
version = "v4.3.9"
1 change: 1 addition & 0 deletions cmd/openshift-install/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
_ "github.com/openshift/installer/pkg/destroy/gcp"
_ "github.com/openshift/installer/pkg/destroy/libvirt"
_ "github.com/openshift/installer/pkg/destroy/openstack"
_ "github.com/openshift/installer/pkg/destroy/ovirt"
)

func newDestroyCmd() *cobra.Command {
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 @@ -25,12 +25,14 @@ import (
gathergcp "github.com/openshift/installer/pkg/terraform/gather/gcp"
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"
"github.com/openshift/installer/pkg/types"
awstypes "github.com/openshift/installer/pkg/types/aws"
azuretypes "github.com/openshift/installer/pkg/types/azure"
gcptypes "github.com/openshift/installer/pkg/types/gcp"
libvirttypes "github.com/openshift/installer/pkg/types/libvirt"
openstacktypes "github.com/openshift/installer/pkg/types/openstack"
ovirttypes "github.com/openshift/installer/pkg/types/ovirt"
)

func newGatherCmd() *cobra.Command {
Expand Down Expand Up @@ -182,6 +184,15 @@ func extractHostAddresses(config *types.InstallConfig, tfstate *terraform.State)
if err != nil {
logrus.Error(err)
}
case ovirttypes.Name:
bootstrap, err := gatherovirt.BootstrapIP(tfstate)
if err != nil {
return bootstrap, port, masters, err
}
masters, err = gatherovirt.ControlPlaneIPs(tfstate)
if err != nil {
logrus.Error(err)
}
default:
return "", port, nil, errUnSupportedGatherPlatform{Message: fmt.Sprintf("Cannot fetch the bootstrap and control plane host addresses from state file for %s platform", config.Platform.Name())}
}
Expand Down
22 changes: 14 additions & 8 deletions data/data/bootstrap/files/usr/local/bin/bootkube.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,20 @@ then
cp manifests/* /etc/mcc/bootstrap/
cp auth/kubeconfig-kubelet /etc/mcs/kubeconfig
cp mco-bootstrap/bootstrap/machineconfigoperator-bootstrap-pod.yaml /etc/kubernetes/manifests/
if [ -d mco-bootstrap/baremetal/manifests ]; then
cp mco-bootstrap/baremetal/manifests/* /etc/kubernetes/manifests/
cp --recursive mco-bootstrap/baremetal/static-pod-resources/* /etc/kubernetes/static-pod-resources/
fi
if [ -d mco-bootstrap/openstack/manifests ]; then
cp mco-bootstrap/openstack/manifests/* /etc/kubernetes/manifests/
cp --recursive mco-bootstrap/openstack/static-pod-resources/* /etc/kubernetes/static-pod-resources/
fi

copy_static_resources_for() {
# copy static resources from mco based on platform folder
local platform=$1
if [ -d mco-bootstrap/${platform}/manifests ]; then
cp mco-bootstrap/${platform}/manifests/* /etc/kubernetes/manifests/
cp --recursive mco-bootstrap/${platform}/static-pod-resources/* /etc/kubernetes/static-pod-resources/
fi
}

copy_static_resources_for baremetal
copy_static_resources_for openstack
copy_static_resources_for ovirt

cp mco-bootstrap/manifests/* manifests/

# /etc/ssl/mcs/tls.{crt, key} are locations for MachineConfigServer's tls assets.
Expand Down
2 changes: 2 additions & 0 deletions data/data/bootstrap/ovirt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
oVirt needs the same assets during setup except for ironic.
Please refer to https://github.com/openshift/installer/tree/master/data/data/bootstrap/baremetal
7 changes: 7 additions & 0 deletions data/data/bootstrap/ovirt/files/etc/dhcp/dhclient.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Specifies that the bootstrap node should use its own local DNS server for
# name resolution.
#
# For more information, see installer/data/data/bootstrap/baremetal/README.md
#

prepend domain-name-servers 127.0.0.1;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ metadata:
name: openstack-credentials
{{- else if .CloudCreds.VSphere}}
name: vsphere-creds
{{- else if .CloudCreds.Ovirt}}
name: ovirt-credentials
{{- end}}
data:
{{- if .CloudCreds.AWS}}
Expand All @@ -33,4 +35,10 @@ data:
{{- else if .CloudCreds.VSphere}}
{{.CloudCreds.VSphere.VCenter}}.username: {{.CloudCreds.VSphere.Base64encodeUsername}}
{{.CloudCreds.VSphere.VCenter}}.password: {{.CloudCreds.VSphere.Base64encodePassword}}
{{- else if .CloudCreds.Ovirt}}
ovirt_url: {{.CloudCreds.Ovirt.Base64encodeURL}}
ovirt_username: {{.CloudCreds.Ovirt.Base64encodeUsername}}
ovirt_password: {{.CloudCreds.Ovirt.Base64encodePassword}}
ovirt_cafile: {{.CloudCreds.Ovirt.Base64encodeCAFile}}
ovirt_insecure: {{.CloudCreds.Ovirt.Base64encodeInsecure}}
{{- end}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ metadata:
name: openstack-creds-secret-reader
{{- else if .CloudCreds.VSphere}}
name: vsphere-creds-secret-reader
{{- else if .CloudCreds.Ovirt}}
name: ovirt-creds-secret-reader
{{- end}}
rules:
- apiGroups: [""]
Expand All @@ -26,5 +28,7 @@ rules:
resourceNames: ["openstack-credentials"]
{{- else if .CloudCreds.VSphere}}
resourceNames: ["vsphere-creds"]
{{- else if .CloudCreds.Ovirt}}
resourceNames: ["ovirt-credentials"]
{{- end}}
verbs: ["get"]
11 changes: 11 additions & 0 deletions data/data/ovirt/bootstrap/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "ovirt_vm" "bootstrap" {
name = "${var.cluster_id}-bootstrap"
memory = "8192"
cores = "4"
cluster_id = var.ovirt_cluster_id
template_id = var.ovirt_template_id

initialization {
custom_script = var.ignition_bootstrap
}
}
29 changes: 29 additions & 0 deletions data/data/ovirt/bootstrap/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "cluster_id" {
description = "The ID of Openshift cluster"
}

variable "ovirt_cluster_id" {
type = string
description = "The ID of oVirt's cluster"
}

variable "ovirt_template_id" {
type = string
description = "The ID of oVirt's VM template"
}

variable "ignition_bootstrap" {
type = string
description = "bootstrap ignition config"
}

variable "openstack_base_image_name" {
type = string
description = "Name of the base image to use for the nodes."
}

variable "openstack_base_image_local_file_path" {
type = string
default = ""
description = "Local file path of the base image file to use for the nodes."
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new line required here.

3 changes: 3 additions & 0 deletions data/data/ovirt/bootstrap/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 0.12"
}
41 changes: 41 additions & 0 deletions data/data/ovirt/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
provider "ovirt" {
url = var.ovirt_url
username = var.ovirt_username
password = var.ovirt_password
}

module "template" {
source = "./template"
ovirt_cluster_id = var.ovirt_cluster_id
ovirt_storage_domain_id = var.ovirt_storage_domain_id
ignition_bootstrap = var.ignition_bootstrap
cluster_id = var.cluster_id
openstack_base_image_name = var.openstack_base_image_name
openstack_base_image_local_file_path = var.openstack_base_image_local_file_path
ovirt_template_cpu = var.ovirt_template_cpu
ovirt_template_mem = var.ovirt_template_mem
disk_size_gib = var.ovirt_template_disk_size_gib
ovirt_network_name = var.ovirt_network_name
}

module "bootstrap" {
source = "./bootstrap"
ovirt_cluster_id = var.ovirt_cluster_id
ovirt_template_id = module.template.releaseimage_template_id
ignition_bootstrap = var.ignition_bootstrap
cluster_id = var.cluster_id
openstack_base_image_name = var.openstack_base_image_name
openstack_base_image_local_file_path = var.openstack_base_image_local_file_path
}

module "masters" {
source = "./masters"
master_count = var.master_count
ovirt_cluster_id = var.ovirt_cluster_id
ovirt_template_id = module.template.releaseimage_template_id
ignition_master = var.ignition_master
cluster_domain = var.cluster_domain
cluster_id = var.cluster_id
ovirt_master_cpu = var.ovirt_master_cpu
ovirt_master_mem = var.ovirt_master_mem
}
18 changes: 18 additions & 0 deletions data/data/ovirt/masters/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "ovirt_vm" "master" {
count = var.master_count
name = "${var.cluster_id}-master-${count.index}"
cluster_id = var.ovirt_cluster_id
template_id = var.ovirt_template_id
cores = var.ovirt_master_cpu
memory = var.ovirt_master_mem

initialization {
host_name = "${var.cluster_id}-master-${count.index}"
custom_script = var.ignition_master
}
}

resource "ovirt_tag" "cluster_tag" {
name = var.cluster_id
vm_ids = [for instance in ovirt_vm.master.* : instance.id]
}
36 changes: 36 additions & 0 deletions data/data/ovirt/masters/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
variable "cluster_id" {
description = "The ID of Openshift cluster"
}

variable "cluster_domain" {
description = "The domain name of Openshift cluster"
}

variable "master_count" {
type = string
description = "Number of masters"
default = 3
}

variable "ovirt_cluster_id" {
type = string
description = "The ID of oVirt's cluster"
}

variable "ovirt_template_id" {
type = string
description = "The ID of oVirt's VM template"
}

variable "ignition_master" {
type = string
description = "master ignition config"
}

variable "ovirt_master_mem" {
type = string
}

variable "ovirt_master_cpu" {
type = string
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: new line required here.

Loading