From a398348793d134615cd8757a0e64569816044159 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Tue, 11 Sep 2018 19:40:37 -0700 Subject: [PATCH 1/2] vendor: update installer for https://github.com/openshift/installer/pull/222 --- Gopkg.lock | 10 ++-- .../openshift/installer/pkg/ipnet/ipnet.go | 49 +++++++++++++++++++ .../installer/pkg/types/installconfig.go | 7 ++- .../installer/pkg/types/machinepools.go | 4 +- .../{joining_workers => infra}/aws/config.tf | 0 .../aws/variables-aws.tf | 0 .../libvirt/config.tf | 0 .../libvirt/variables-libvirt.tf | 0 .../installer/steps/masters/aws/config.tf | 1 - .../steps/masters/aws/variables-aws.tf | 1 - .../installer/steps/masters/libvirt/config.tf | 1 - .../masters/libvirt/variables-libvirt.tf | 1 - .../installer/steps/topology/aws/config.tf | 1 - .../steps/topology/aws/variables-aws.tf | 1 - .../steps/topology/libvirt/config.tf | 1 - .../topology/libvirt/variables-libvirt.tf | 1 - 16 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 vendor/github.com/openshift/installer/pkg/ipnet/ipnet.go rename vendor/github.com/openshift/installer/steps/{joining_workers => infra}/aws/config.tf (100%) rename vendor/github.com/openshift/installer/steps/{joining_workers => infra}/aws/variables-aws.tf (100%) rename vendor/github.com/openshift/installer/steps/{joining_workers => infra}/libvirt/config.tf (100%) rename vendor/github.com/openshift/installer/steps/{joining_workers => infra}/libvirt/variables-libvirt.tf (100%) delete mode 120000 vendor/github.com/openshift/installer/steps/masters/aws/config.tf delete mode 120000 vendor/github.com/openshift/installer/steps/masters/aws/variables-aws.tf delete mode 120000 vendor/github.com/openshift/installer/steps/masters/libvirt/config.tf delete mode 120000 vendor/github.com/openshift/installer/steps/masters/libvirt/variables-libvirt.tf delete mode 120000 vendor/github.com/openshift/installer/steps/topology/aws/config.tf delete mode 120000 vendor/github.com/openshift/installer/steps/topology/aws/variables-aws.tf delete mode 120000 vendor/github.com/openshift/installer/steps/topology/libvirt/config.tf delete mode 120000 vendor/github.com/openshift/installer/steps/topology/libvirt/variables-libvirt.tf diff --git a/Gopkg.lock b/Gopkg.lock index ff1d881c5c..dd4d452f91 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -346,11 +346,14 @@ [[projects]] branch = "master" - digest = "1:7a866b4639d3b7e4b3c44d9ccafed86f18706939bcf37161123440e5ea03d46f" + digest = "1:e1397de7eda15e425e712b890b41d22cc1c96610ba7dceb1074bd54667d635f7" name = "github.com/openshift/installer" - packages = ["pkg/types"] + packages = [ + "pkg/ipnet", + "pkg/types", + ] pruneopts = "NUT" - revision = "f2e6b3ed56aa114cd263369fd626d6b0e493e6ed" + revision = "ae20cf6ddc6872c79600a3342598ff61bf4925fd" [[projects]] digest = "1:f7646c654e93258958dba300641f8f674d5a9ed015c11119793ba1156e2acbe9" @@ -860,7 +863,6 @@ "github.com/openshift/kubernetes-drain", "github.com/spf13/cobra", "github.com/vincent-petithory/dataurl", - "gopkg.in/yaml.v2", "k8s.io/api/apps/v1", "k8s.io/api/core/v1", "k8s.io/api/rbac/v1", diff --git a/vendor/github.com/openshift/installer/pkg/ipnet/ipnet.go b/vendor/github.com/openshift/installer/pkg/ipnet/ipnet.go new file mode 100644 index 0000000000..48ca01e670 --- /dev/null +++ b/vendor/github.com/openshift/installer/pkg/ipnet/ipnet.go @@ -0,0 +1,49 @@ +// Package ipnet wraps net.IPNet to get CIDR serialization. +package ipnet + +import ( + "encoding/json" + "net" + "reflect" +) + +var nullString = "null" +var nullBytes = []byte(nullString) +var emptyIPNet = net.IPNet{} + +// IPNet wraps net.IPNet to get CIDR serialization. +type IPNet struct { + net.IPNet +} + +// MarshalJSON interface for an IPNet +func (ipnet IPNet) MarshalJSON() (data []byte, err error) { + if reflect.DeepEqual(ipnet.IPNet, emptyIPNet) { + return nullBytes, nil + } + + return json.Marshal(ipnet.String()) +} + +// UnmarshalJSON interface for an IPNet +func (ipnet *IPNet) UnmarshalJSON(b []byte) (err error) { + if string(b) == nullString { + ipnet.IP = net.IP{} + ipnet.Mask = net.IPMask{} + return nil + } + + var cidr string + err = json.Unmarshal(b, &cidr) + if err != nil { + return err + } + + ip, net, err := net.ParseCIDR(cidr) + if err != nil { + return err + } + ipnet.IP = ip + ipnet.Mask = net.Mask + return nil +} diff --git a/vendor/github.com/openshift/installer/pkg/types/installconfig.go b/vendor/github.com/openshift/installer/pkg/types/installconfig.go index 399d54aaf9..9322a8fb05 100644 --- a/vendor/github.com/openshift/installer/pkg/types/installconfig.go +++ b/vendor/github.com/openshift/installer/pkg/types/installconfig.go @@ -3,6 +3,7 @@ package types import ( "net" + "github.com/openshift/installer/pkg/ipnet" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -58,8 +59,8 @@ type Platform struct { // Networking defines the pod network provider in the cluster. type Networking struct { Type NetworkType `json:"type"` - ServiceCIDR net.IPNet `json:"serviceCIDR"` - PodCIDR net.IPNet `json:"podCIDR"` + ServiceCIDR ipnet.IPNet `json:"serviceCIDR"` + PodCIDR ipnet.IPNet `json:"podCIDR"` } // NetworkType defines the pod network provider in the cluster. @@ -107,8 +108,6 @@ type LibvirtNetwork struct { Name string `json:"name"` // IfName is the name of the network interface. IfName string `json:"if"` - // DNSServer is the name of the DNS server. - DNSServer string `json:"resolver"` // IPRange is the range of IPs to use. IPRange string `json:"ipRange"` } diff --git a/vendor/github.com/openshift/installer/pkg/types/machinepools.go b/vendor/github.com/openshift/installer/pkg/types/machinepools.go index f1a94da5ca..45e5da791c 100644 --- a/vendor/github.com/openshift/installer/pkg/types/machinepools.go +++ b/vendor/github.com/openshift/installer/pkg/types/machinepools.go @@ -3,13 +3,13 @@ package types // MachinePool is a pool of machines to be installed. type MachinePool struct { // Name is the name of the machine pool. - Name string + Name string `json:"name"` // Replicas is the count of machines for this machine pool. // Default is 1. Replicas *int64 `json:"replicas"` - // PlatformConfig is configuration for machine pool specfic to the platfrom. + // PlatformConfig is configuration for machine pool specific to the platfrom. PlatformConfig MachinePoolPlatformConfig `json:"platformConfig"` } diff --git a/vendor/github.com/openshift/installer/steps/joining_workers/aws/config.tf b/vendor/github.com/openshift/installer/steps/infra/aws/config.tf similarity index 100% rename from vendor/github.com/openshift/installer/steps/joining_workers/aws/config.tf rename to vendor/github.com/openshift/installer/steps/infra/aws/config.tf diff --git a/vendor/github.com/openshift/installer/steps/joining_workers/aws/variables-aws.tf b/vendor/github.com/openshift/installer/steps/infra/aws/variables-aws.tf similarity index 100% rename from vendor/github.com/openshift/installer/steps/joining_workers/aws/variables-aws.tf rename to vendor/github.com/openshift/installer/steps/infra/aws/variables-aws.tf diff --git a/vendor/github.com/openshift/installer/steps/joining_workers/libvirt/config.tf b/vendor/github.com/openshift/installer/steps/infra/libvirt/config.tf similarity index 100% rename from vendor/github.com/openshift/installer/steps/joining_workers/libvirt/config.tf rename to vendor/github.com/openshift/installer/steps/infra/libvirt/config.tf diff --git a/vendor/github.com/openshift/installer/steps/joining_workers/libvirt/variables-libvirt.tf b/vendor/github.com/openshift/installer/steps/infra/libvirt/variables-libvirt.tf similarity index 100% rename from vendor/github.com/openshift/installer/steps/joining_workers/libvirt/variables-libvirt.tf rename to vendor/github.com/openshift/installer/steps/infra/libvirt/variables-libvirt.tf diff --git a/vendor/github.com/openshift/installer/steps/masters/aws/config.tf b/vendor/github.com/openshift/installer/steps/masters/aws/config.tf deleted file mode 120000 index 7b4967dbe1..0000000000 --- a/vendor/github.com/openshift/installer/steps/masters/aws/config.tf +++ /dev/null @@ -1 +0,0 @@ -../../../config.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/masters/aws/variables-aws.tf b/vendor/github.com/openshift/installer/steps/masters/aws/variables-aws.tf deleted file mode 120000 index d0ec4db321..0000000000 --- a/vendor/github.com/openshift/installer/steps/masters/aws/variables-aws.tf +++ /dev/null @@ -1 +0,0 @@ -../../variables-aws.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/masters/libvirt/config.tf b/vendor/github.com/openshift/installer/steps/masters/libvirt/config.tf deleted file mode 120000 index 7b4967dbe1..0000000000 --- a/vendor/github.com/openshift/installer/steps/masters/libvirt/config.tf +++ /dev/null @@ -1 +0,0 @@ -../../../config.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/masters/libvirt/variables-libvirt.tf b/vendor/github.com/openshift/installer/steps/masters/libvirt/variables-libvirt.tf deleted file mode 120000 index 0b2a79a7f6..0000000000 --- a/vendor/github.com/openshift/installer/steps/masters/libvirt/variables-libvirt.tf +++ /dev/null @@ -1 +0,0 @@ -../../variables-libvirt.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/topology/aws/config.tf b/vendor/github.com/openshift/installer/steps/topology/aws/config.tf deleted file mode 120000 index 7b4967dbe1..0000000000 --- a/vendor/github.com/openshift/installer/steps/topology/aws/config.tf +++ /dev/null @@ -1 +0,0 @@ -../../../config.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/topology/aws/variables-aws.tf b/vendor/github.com/openshift/installer/steps/topology/aws/variables-aws.tf deleted file mode 120000 index d0ec4db321..0000000000 --- a/vendor/github.com/openshift/installer/steps/topology/aws/variables-aws.tf +++ /dev/null @@ -1 +0,0 @@ -../../variables-aws.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/topology/libvirt/config.tf b/vendor/github.com/openshift/installer/steps/topology/libvirt/config.tf deleted file mode 120000 index 7b4967dbe1..0000000000 --- a/vendor/github.com/openshift/installer/steps/topology/libvirt/config.tf +++ /dev/null @@ -1 +0,0 @@ -../../../config.tf \ No newline at end of file diff --git a/vendor/github.com/openshift/installer/steps/topology/libvirt/variables-libvirt.tf b/vendor/github.com/openshift/installer/steps/topology/libvirt/variables-libvirt.tf deleted file mode 120000 index 0b2a79a7f6..0000000000 --- a/vendor/github.com/openshift/installer/steps/topology/libvirt/variables-libvirt.tf +++ /dev/null @@ -1 +0,0 @@ -../../variables-libvirt.tf \ No newline at end of file From ccc5a8da6ff841f813f99bf15f381322cb166203 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Tue, 11 Sep 2018 19:40:54 -0700 Subject: [PATCH 2/2] pkg/operator: add missing error --- pkg/operator/bootstrap.go | 2 +- pkg/operator/render_test.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/operator/bootstrap.go b/pkg/operator/bootstrap.go index 30f1b66647..c741278811 100644 --- a/pkg/operator/bootstrap.go +++ b/pkg/operator/bootstrap.go @@ -38,7 +38,7 @@ func RenderBootstrap( mcoconfig, err := discoverMCOConfig(getInstallConfigFromFile(filesData[clusterConfigConfigMapFile])) if err != nil { - return fmt.Errorf("error discovering MCOConfig from %q", clusterConfigConfigMapFile) + return fmt.Errorf("error discovering MCOConfig from %q: %v", clusterConfigConfigMapFile, err) } obji, err := runtime.Decode(scheme.Codecs.UniversalDecoder(corev1.SchemeGroupVersion), filesData[imagesConfigMapFile]) diff --git a/pkg/operator/render_test.go b/pkg/operator/render_test.go index 609bc8b89b..0212e76af9 100644 --- a/pkg/operator/render_test.go +++ b/pkg/operator/render_test.go @@ -62,12 +62,8 @@ metadata: creationTimestamp: null name: test-0 networking: - podCIDR: - IP: 10.2.0.0 - Mask: //8AAA== - serviceCIDR: - IP: 10.3.0.0 - Mask: //8AAA== + podCIDR: 10.2.0.0/16 + serviceCIDR: 10.3.0.0/16 type: flannel platform: libvirt: