Skip to content

Commit

Permalink
Rename lbFloatingIP to apiFloatingIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedosin committed Oct 7, 2020
1 parent 887875e commit 712799d
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion data/data/openstack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module "topology" {
external_network = var.openstack_external_network
external_network_id = var.openstack_external_network_id
masters_count = var.master_count
lb_floating_ip = var.openstack_lb_floating_ip
api_floating_ip = var.openstack_api_floating_ip
ingress_floating_ip = var.openstack_ingress_floating_ip
api_int_ip = var.openstack_api_int_ip
ingress_ip = var.openstack_ingress_ip
Expand Down
4 changes: 2 additions & 2 deletions data/data/openstack/topology/private-network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ resource "openstack_networking_trunk_v2" "masters" {
// as expected.

resource "openstack_networking_floatingip_associate_v2" "api_fip" {
count = length(var.lb_floating_ip) == 0 ? 0 : 1
count = length(var.api_floating_ip) == 0 ? 0 : 1
port_id = openstack_networking_port_v2.api_port.id
floating_ip = var.lb_floating_ip
floating_ip = var.api_floating_ip
depends_on = [openstack_networking_router_interface_v2.nodes_router_interface]
}

Expand Down
4 changes: 2 additions & 2 deletions data/data/openstack/topology/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ variable "external_network_id" {
default = ""
}

variable "lb_floating_ip" {
description = "(optional) Existing floating IP address to attach to the load balancer created by the installer."
variable "api_floating_ip" {
description = "(optional) Existing floating IP address to attach to the OpenShift API created by the installer."
type = string
default = ""
}
Expand Down
4 changes: 2 additions & 2 deletions data/data/openstack/variables-openstack.tf
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ EOF

}

variable "openstack_lb_floating_ip" {
variable "openstack_api_floating_ip" {
type = string
default = ""

description = <<EOF
(optional) Existing Floating IP to attach to the load balancer created by the installer.
(optional) Existing Floating IP to attach to the OpenShift API created by the installer.
EOF

}
Expand Down
2 changes: 1 addition & 1 deletion docs/user/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ If you're unable to create and publish these DNS records, you can add them to yo

##### External API Access

If you have specified the API floating IP (either via the installer prompt or by adding the `lbFloatingIP` entry in your `install-config.yaml`) the installer will attach the Floating IP address to the `api-port` automatically.
If you have specified the API floating IP (either via the installer prompt or by adding the `apiFloatingIP` entry in your `install-config.yaml`) the installer will attach the Floating IP address to the `api-port` automatically.

If you have created the API DNS record, you should be able access the OpenShift API.

Expand Down
8 changes: 4 additions & 4 deletions docs/user/openstack/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Beyond the [platform-agnostic `install-config.yaml` properties](../customization
* `computeFlavor` (required string): The OpenStack flavor to use for compute and control-plane machines.
This is currently required, but has lower precedence than [the `type` property](#machine-pools) on [the `compute` and `controlPlane` machine-pools](../customization.md#platform-customization).
* `externalDNS` (optional list of strings): The IP addresses of DNS servers to be used for the DNS resolution of all instances in the cluster
* `externalNetwork` (optional string): Name of external network the installer will use to provide access to the cluster. If defined, a floating ip from this network will be created and associated with the bootstrap node to facilitate debugging and connection to the bootstrap node during installation. The lbFloatingIP property is a floating ip address selected from this network.
* `lbFloatingIP` (optional string): Address of existing Floating IP from externalNetwork the installer will associate with the API load balancer. This property is only valid if externalNetwork is defined. If externalNetwork is not defined, the installer will throw an error.
* `externalNetwork` (optional string): Name of external network the installer will use to provide access to the cluster. If defined, a floating ip from this network will be created and associated with the bootstrap node to facilitate debugging and connection to the bootstrap node during installation. The `apiFloatingIP` property is a floating ip address selected from this network.
* `apiFloatingIP` (optional string): Address of existing Floating IP from externalNetwork the installer will associate with the OpenShift API. This property is only valid if externalNetwork is defined. If externalNetwork is not defined, the installer will throw an error.
* `ingressFloatingIP` (optional string): Address of an existing Floating IP from externalNetwork the installer will associate with the ingress port. This property is only valid if externalNetwork is defined. If externalNetwork is not defined, the installer will throw an error.
* `octaviaSupport` (deprecated string): Whether OpenStack supports Octavia (`1` for true or `0` for false)
* `region` (deprecated string): The OpenStack region where the cluster will be created. Currently this value is not used by the installer.
Expand Down Expand Up @@ -65,13 +65,13 @@ metadata:
name: test-cluster
platform:
openstack:
apiFloatingIP: 128.0.0.1
cloud: mycloud
computeFlavor: m1.s2.xlarge
externalNetwork: external
externalDNS:
- "8.8.8.8"
- "192.168.1.12"
lbFloatingIP: 128.0.0.1
pullSecret: '{"auths": ...}'
sshKey: ssh-ed25519 AAAA...
```
Expand Down Expand Up @@ -99,10 +99,10 @@ metadata:
name: test-cluster
platform:
openstack:
apiFloatingIP: 128.0.0.1
cloud: mycloud
computeFlavor: m1.s2.xlarge
externalNetwork: external
lbFloatingIP: 128.0.0.1
pullSecret: '{"auths": ...}'
sshKey: ssh-ed25519 AAAA...
```
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
installConfig.Config.Platform.OpenStack.Cloud,
installConfig.Config.Platform.OpenStack.ExternalNetwork,
installConfig.Config.Platform.OpenStack.ExternalDNS,
installConfig.Config.Platform.OpenStack.LbFloatingIP,
installConfig.Config.Platform.OpenStack.APIFloatingIP,
installConfig.Config.Platform.OpenStack.IngressFloatingIP,
installConfig.Config.Platform.OpenStack.APIVIP,
installConfig.Config.Platform.OpenStack.IngressVIP,
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/installconfig/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func Platform() (*openstack.Platform, error) {
return nil, err
}

var lbFloatingIP string
var apiFloatingIP string
if extNet != "" {
floatingIPNames, err := getFloatingIPNames(cloud, extNet)
if err != nil {
Expand All @@ -106,7 +106,7 @@ func Platform() (*openstack.Platform, error) {
return nil
}),
},
}, &lbFloatingIP)
}, &apiFloatingIP)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -140,9 +140,9 @@ func Platform() (*openstack.Platform, error) {
}

return &openstack.Platform{
APIFloatingIP: apiFloatingIP,
Cloud: cloud,
ExternalNetwork: extNet,
FlavorName: flavor,
LbFloatingIP: lbFloatingIP,
}, nil
}
2 changes: 1 addition & 1 deletion pkg/asset/installconfig/openstack/validation/cloudinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (ci *CloudInfo) collectInfo(ic *types.InstallConfig) error {
return errors.Wrap(err, "failed to fetch machine subnet info")
}

ci.APIFIP, err = ci.getFloatingIP(ic.OpenStack.LbFloatingIP)
ci.APIFIP, err = ci.getFloatingIP(ic.OpenStack.APIFloatingIP)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/asset/installconfig/openstack/validation/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func validatePlatformFlavor(p *openstack.Platform, ci *CloudInfo, fldPath *field
}

func validateFloatingIPs(p *openstack.Platform, ci *CloudInfo, fldPath *field.Path) (allErrs field.ErrorList) {
if p.LbFloatingIP != "" {
if p.APIFloatingIP != "" {
if ci.APIFIP == nil {
allErrs = append(allErrs, field.NotFound(fldPath.Child("lbFloatingIP"), p.LbFloatingIP))
allErrs = append(allErrs, field.NotFound(fldPath.Child("apiFloatingIP"), p.APIFloatingIP))
} else if ci.APIFIP.Status != "DOWN" {
allErrs = append(allErrs, field.Invalid(fldPath.Child("lbFloatingIP"), p.LbFloatingIP, "Floating IP already in use"))
allErrs = append(allErrs, field.Invalid(fldPath.Child("apiFloatingIP"), p.APIFloatingIP, "Floating IP already in use"))
} else if p.ExternalNetwork == "" {
allErrs = append(allErrs, field.Invalid(fldPath.Child("lbFloatingIP"), p.LbFloatingIP, "Cannot set floating ips when external network not specified"))
allErrs = append(allErrs, field.Invalid(fldPath.Child("apiFloatingIP"), p.APIFloatingIP, "Cannot set floating ips when external network not specified"))
}
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/asset/installconfig/openstack/validation/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ var (
// Returns a default install
func validPlatform() *openstack.Platform {
return &openstack.Platform{
APIFloatingIP: validFIP1,
Cloud: validCloud,
ExternalNetwork: validExternalNetwork,
FlavorName: validCtrlPlaneFlavor,
LbFloatingIP: validFIP1,
IngressFloatingIP: validFIP2,
}
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestOpenStackPlatformValidation(t *testing.T) {
}(),
networking: validNetworking(),
expectedError: true,
expectedErrMsg: `platform.openstack.lbFloatingIP: Not found: "128.35.27.8"`,
expectedErrMsg: `platform.openstack.apiFloatingIP: Not found: "128.35.27.8"`,
},
{
name: "not found ingress FIP",
Expand All @@ -157,7 +157,7 @@ func TestOpenStackPlatformValidation(t *testing.T) {
}(),
networking: validNetworking(),
expectedError: true,
expectedErrMsg: `[platform.openstack.lbFloatingIP: Not found: "128.35.27.8", platform.openstack.ingressFloatingIP: Not found: "128.35.27.13"]`,
expectedErrMsg: `[platform.openstack.apiFloatingIP: Not found: "128.35.27.8", platform.openstack.ingressFloatingIP: Not found: "128.35.27.13"]`,
},
{
name: "in use ingress FIP",
Expand All @@ -181,7 +181,7 @@ func TestOpenStackPlatformValidation(t *testing.T) {
}(),
networking: validNetworking(),
expectedError: true,
expectedErrMsg: `platform.openstack.lbFloatingIP: Invalid value: "128.35.27.8": Floating IP already in use`,
expectedErrMsg: `platform.openstack.apiFloatingIP: Invalid value: "128.35.27.8": Floating IP already in use`,
},
{
name: "invalid usage both FIPs",
Expand All @@ -193,14 +193,14 @@ func TestOpenStackPlatformValidation(t *testing.T) {
cloudInfo: validPlatformCloudInfo(),
networking: validNetworking(),
expectedError: true,
expectedErrMsg: `[platform.openstack.ingressFloatingIP: Invalid value: "128.35.27.13": Cannot set floating ips when external network not specified, platform.openstack.lbFloatingIP: Invalid value: "128.35.27.8": Cannot set floating ips when external network not specified]`,
expectedErrMsg: `[platform.openstack.ingressFloatingIP: Invalid value: "128.35.27.13": Cannot set floating ips when external network not specified, platform.openstack.apiFloatingIP: Invalid value: "128.35.27.8": Cannot set floating ips when external network not specified]`,
},
{
name: "no external network provided",
platform: func() *openstack.Platform {
p := validPlatform()
p.ExternalNetwork = ""
p.LbFloatingIP = ""
p.APIFloatingIP = ""
p.IngressFloatingIP = ""
p.APIVIP = ""
return p
Expand Down
6 changes: 3 additions & 3 deletions pkg/tfvars/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type config struct {
ExternalNetwork string `json:"openstack_external_network,omitempty"`
Cloud string `json:"openstack_credentials_cloud,omitempty"`
FlavorName string `json:"openstack_master_flavor_name,omitempty"`
LbFloatingIP string `json:"openstack_lb_floating_ip,omitempty"`
APIFloatingIP string `json:"openstack_api_floating_ip,omitempty"`
IngressFloatingIP string `json:"openstack_ingress_floating_ip,omitempty"`
APIVIP string `json:"openstack_api_int_ip,omitempty"`
IngressVIP string `json:"openstack_ingress_ip,omitempty"`
Expand All @@ -46,7 +46,7 @@ type config struct {
}

// TFVars generates OpenStack-specific Terraform variables.
func TFVars(masterConfigs []*v1alpha1.OpenstackProviderSpec, cloud string, externalNetwork string, externalDNS []string, lbFloatingIP string, ingressFloatingIP string, apiVIP string, ingressVIP string, baseImage string, infraID string, userCA string, bootstrapIgn string, mpool *types_openstack.MachinePool, machinesSubnet string) ([]byte, error) {
func TFVars(masterConfigs []*v1alpha1.OpenstackProviderSpec, cloud string, externalNetwork string, externalDNS []string, apiFloatingIP string, ingressFloatingIP string, apiVIP string, ingressVIP string, baseImage string, infraID string, userCA string, bootstrapIgn string, mpool *types_openstack.MachinePool, machinesSubnet string) ([]byte, error) {
zones := []string{}
seen := map[string]bool{}
for _, config := range masterConfigs {
Expand All @@ -60,7 +60,7 @@ func TFVars(masterConfigs []*v1alpha1.OpenstackProviderSpec, cloud string, exter
ExternalNetwork: externalNetwork,
Cloud: cloud,
FlavorName: masterConfigs[0].Flavor,
LbFloatingIP: lbFloatingIP,
APIFloatingIP: apiFloatingIP,
IngressFloatingIP: ingressFloatingIP,
APIVIP: apiVIP,
IngressVIP: ingressVIP,
Expand Down
8 changes: 7 additions & 1 deletion pkg/types/openstack/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ type Platform struct {

// LbFloatingIP is the IP address of an available floating IP in your OpenStack cluster
// to associate with the OpenShift load balancer.
// Deprecated: this value has been renamed to apiFloatingIP.
// +optional
LbFloatingIP string `json:"lbFloatingIP,omitempty"`
DeprecatedLbFloatingIP string `json:"lbFloatingIP,omitempty"`

// APIFloatingIP is the IP address of an available floating IP in your OpenStack cluster
// to associate with the OpenShift API load balancer.
// +optional
APIFloatingIP string `json:"apiFloatingIP,omitempty"`

// IngressFloatingIP is the ID of an available floating IP in your OpenStack cluster
// that will be associated with the OpenShift ingress port
Expand Down

0 comments on commit 712799d

Please sign in to comment.