diff --git a/glide.lock b/glide.lock index 912c761323..b1c9baadb9 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ hash: 04f0a84ca5c855059ac263ec6abe44f9e873b79018933b771194631422d3331e -updated: 2019-08-12T12:01:15.09921-04:00 +updated: 2019-08-27T11:39:24.790557-04:00 imports: - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 @@ -113,7 +113,7 @@ imports: - name: github.com/go-openapi/swag version: 5899d5c5e619fda5fa86e14795a835f473ca284c - name: github.com/go-test/deep - version: 1888facc153dfaea996367ec0e53d0c42d1b8454 + version: 597fd8504439ea8b0a72c2557de5c6cab932e8f0 - name: github.com/gogo/protobuf version: 342cbe0a04158f6dcb03ca0079991a51a4248c02 subpackages: @@ -172,7 +172,7 @@ imports: - name: github.com/NYTimes/gziphandler version: 56545f4a5d46df9a6648819d1664c3a03a13ffdb - name: github.com/openshift/api - version: 27fb16909b15a19136ab22c12aa34e688d0d24bb + version: 58aab2885e38fd7f4fd57f2615f5f9fe38039e22 subpackages: - apps - apps/v1 @@ -218,7 +218,7 @@ imports: - webconsole - webconsole/v1 - name: github.com/openshift/client-go - version: e9678e3b850da36470c5554609c6cd110aace47e + version: 5a5508328169b8a6992ea4ef711add89ddce3c6d subpackages: - config/clientset/versioned - config/clientset/versioned/scheme @@ -256,7 +256,7 @@ imports: - route/informers/externalversions/route/v1 - route/listers/route/v1 - name: github.com/openshift/library-go - version: 211d32684d6cd8b9a50db92e213d4b6ea827bb63 + version: 7591501955d9277b5f5cd27e600a58d977736cd1 subpackages: - pkg/config/client - pkg/config/clusteroperator/v1helpers @@ -274,6 +274,7 @@ imports: - pkg/operator/resource/resourceapply - pkg/operator/resource/resourcemerge - pkg/operator/resourcesynccontroller + - pkg/operator/staleconditions - pkg/operator/status - pkg/operator/unsupportedconfigoverridescontroller - pkg/operator/v1helpers diff --git a/vendor/github.com/go-test/deep/CHANGES.md b/vendor/github.com/go-test/deep/CHANGES.md index 8924cda19e..b4306986a3 100644 --- a/vendor/github.com/go-test/deep/CHANGES.md +++ b/vendor/github.com/go-test/deep/CHANGES.md @@ -1,6 +1,6 @@ # go-test/deep Changelog -## v1.0.3 +## v1.0.3 released 2019-08-18 * Fixed issue #31: panic on typed primitives that implement error interface diff --git a/vendor/github.com/openshift/api/apps/v1/generated.pb.go b/vendor/github.com/openshift/api/apps/v1/generated.pb.go index ae30800935..fd7e79fa05 100644 --- a/vendor/github.com/openshift/api/apps/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/apps/v1/generated.pb.go @@ -34,21 +34,27 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import k8s_io_apimachinery_pkg_util_intstr "k8s.io/apimachinery/pkg/util/intstr" + math "math" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + k8s_io_api_core_v1 "k8s.io/api/core/v1" -import strings "strings" -import reflect "reflect" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -import io "io" + k8s_io_apimachinery_pkg_util_intstr "k8s.io/apimachinery/pkg/util/intstr" + + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/authorization/v1/generated.pb.go b/vendor/github.com/openshift/api/authorization/v1/generated.pb.go index c8e008826a..245fffeafb 100644 --- a/vendor/github.com/openshift/api/authorization/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/authorization/v1/generated.pb.go @@ -46,18 +46,25 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" -import k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import strings "strings" -import reflect "reflect" + math "math" -import io "io" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + + k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" + + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/build/v1/generated.pb.go b/vendor/github.com/openshift/api/build/v1/generated.pb.go index bcec53e134..83221ca919 100644 --- a/vendor/github.com/openshift/api/build/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/build/v1/generated.pb.go @@ -65,21 +65,27 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import time "time" + math "math" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + k8s_io_api_core_v1 "k8s.io/api/core/v1" -import strings "strings" -import reflect "reflect" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -import io "io" + time "time" + + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/config/v1/types_build.go b/vendor/github.com/openshift/api/config/v1/types_build.go index c7ed7e958b..fa4088ca7e 100644 --- a/vendor/github.com/openshift/api/config/v1/types_build.go +++ b/vendor/github.com/openshift/api/config/v1/types_build.go @@ -9,7 +9,10 @@ import ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Build holds cluster-wide information on how to handle builds. The canonical name is `cluster` +// Build configures the behavior of OpenShift builds for the entire cluster. +// This includes default settings that can be overridden in BuildConfig objects, and overrides which are applied to all builds. +// +// The canonical name is "cluster" type Build struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -23,6 +26,10 @@ type BuildSpec struct { // AdditionalTrustedCA is a reference to a ConfigMap containing additional CAs that // should be trusted for image pushes and pulls during builds. // The namespace for this config map is openshift-config. + // + // DEPRECATED: Additional CAs for image pull and push should be set on + // image.config.openshift.io/cluster instead. + // // +optional AdditionalTrustedCA ConfigMapNameReference `json:"additionalTrustedCA"` // BuildDefaults controls the default information for Builds diff --git a/vendor/github.com/openshift/api/config/v1/types_ingress.go b/vendor/github.com/openshift/api/config/v1/types_ingress.go index 484a1af0bc..d161eb8476 100644 --- a/vendor/github.com/openshift/api/config/v1/types_ingress.go +++ b/vendor/github.com/openshift/api/config/v1/types_ingress.go @@ -6,8 +6,8 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Ingress holds cluster-wide information about Ingress. The canonical name is `cluster` -// TODO this object is an example of a possible grouping and is subject to change or removal +// Ingress holds cluster-wide information about ingress, including the default ingress domain +// used for routes. The canonical name is `cluster`. type Ingress struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. @@ -24,8 +24,13 @@ type Ingress struct { type IngressSpec struct { // domain is used to generate a default host name for a route when the - // route's host name is empty. The generated host name will follow this + // route's host name is empty. The generated host name will follow this // pattern: "..". + // + // It is also used as the default wildcard domain suffix for ingress. The + // default ingresscontroller domain will follow this pattern: "*.". + // + // Once set, changing domain is not currently supported. Domain string `json:"domain"` } diff --git a/vendor/github.com/openshift/api/config/v1/types_network.go b/vendor/github.com/openshift/api/config/v1/types_network.go index a60c5f7dcc..615a6a0d22 100644 --- a/vendor/github.com/openshift/api/config/v1/types_network.go +++ b/vendor/github.com/openshift/api/config/v1/types_network.go @@ -6,14 +6,17 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Network holds cluster-wide information about Network. The canonical name is `cluster` -// TODO this object is an example of a possible grouping and is subject to change or removal +// Network holds cluster-wide information about Network. The canonical name is `cluster`. It is used to configure the desired network configuration, such as: IP address pools for services/pod IPs, network plugin, etc. +// Please view network.spec for an explanation on what applies when configuring this resource. type Network struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. metav1.ObjectMeta `json:"metadata,omitempty"` // spec holds user settable values for configuration. + // As a general rule, this SHOULD NOT be read directly. Instead, you should + // consume the NetworkStatus, as it indicates the currently deployed configuration. + // Currently, most spec fields are immutable after installation. Please view the individual ones for further details on each. // +kubebuilder:validation:Required // +required Spec NetworkSpec `json:"spec"` @@ -25,14 +28,15 @@ type Network struct { // NetworkSpec is the desired network configuration. // As a general rule, this SHOULD NOT be read directly. Instead, you should // consume the NetworkStatus, as it indicates the currently deployed configuration. -// Currently, changing ClusterNetwork, ServiceNetwork, or NetworkType after -// installation is not supported. +// Currently, most spec fields are immutable after installation. Please view the individual ones for further details on each. type NetworkSpec struct { - // IP address pool to use for pod IPs. + // IP address pool to use for pod IPs. + // This field is immutable after installation. ClusterNetwork []ClusterNetworkEntry `json:"clusterNetwork"` // IP address pool for services. // Currently, we only support a single entry here. + // This field is immutable after installation. ServiceNetwork []string `json:"serviceNetwork"` // NetworkType is the plugin that is to be deployed (e.g. OpenShiftSDN). @@ -40,6 +44,7 @@ type NetworkSpec struct { // or else no networking will be installed. // Currently supported values are: // - OpenShiftSDN + // This field is immutable after installation. NetworkType string `json:"networkType"` // externalIP defines configuration for controllers that diff --git a/vendor/github.com/openshift/api/config/v1/types_operatorhub.go b/vendor/github.com/openshift/api/config/v1/types_operatorhub.go index cf821f9e37..31291dec2f 100644 --- a/vendor/github.com/openshift/api/config/v1/types_operatorhub.go +++ b/vendor/github.com/openshift/api/config/v1/types_operatorhub.go @@ -6,10 +6,19 @@ import ( // OperatorHubSpec defines the desired state of OperatorHub type OperatorHubSpec struct { + // disableAllDefaultSources allows you to disable all the default hub + // sources. If this is true, a specific entry in sources can be used to + // enable a default source. If this is false, a specific entry in + // sources can be used to disable or enable a default source. + // +optional + DisableAllDefaultSources bool `json:"disableAllDefaultSources,omitempty"` // sources is the list of default hub sources and their configuration. - // If the list is empty, it indicates that the default hub sources are - // enabled on the cluster. The list of default hub sources and their - // current state will always be reflected in the status block. + // If the list is empty, it implies that the default hub sources are + // enabled on the cluster unless disableAllDefaultSources is true. + // If disableAllDefaultSources is true and sources is not empty, + // the configuration present in sources will take precedence. The list of + // default hub sources and their current state will always be reflected in + // the status block. // +optional Sources []HubSource `json:"sources,omitempty"` } @@ -61,9 +70,9 @@ type HubSource struct { // HubSourceStatus is used to reflect the current state of applying the // configuration to a default source type HubSourceStatus struct { - HubSource + HubSource `json:"",omitempty` // status indicates success or failure in applying the configuration - Status string `json:"status"` + Status string `json:"status,omitempty"` // message provides more information regarding failures Message string `json:"message,omitempty"` } diff --git a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go index 6bd877a4f4..890521621b 100644 --- a/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/config/v1/zz_generated.swagger_doc_generated.go @@ -326,7 +326,7 @@ func (WebhookTokenAuthenticator) SwaggerDoc() map[string]string { } var map_Build = map[string]string{ - "": "Build holds cluster-wide information on how to handle builds. The canonical name is `cluster`", + "": "Build configures the behavior of OpenShift builds for the entire cluster. This includes default settings that can be overridden in BuildConfig objects, and overrides which are applied to all builds.\n\nThe canonical name is \"cluster\"", "spec": "Spec holds user-settable values for the build controller configuration", } @@ -365,7 +365,7 @@ func (BuildOverrides) SwaggerDoc() map[string]string { } var map_BuildSpec = map[string]string{ - "additionalTrustedCA": "AdditionalTrustedCA is a reference to a ConfigMap containing additional CAs that should be trusted for image pushes and pulls during builds. The namespace for this config map is openshift-config.", + "additionalTrustedCA": "AdditionalTrustedCA is a reference to a ConfigMap containing additional CAs that should be trusted for image pushes and pulls during builds. The namespace for this config map is openshift-config.\n\nDEPRECATED: Additional CAs for image pull and push should be set on image.config.openshift.io/cluster instead.", "buildDefaults": "BuildDefaults controls the default information for Builds", "buildOverrides": "BuildOverrides controls override settings for builds", } @@ -828,7 +828,7 @@ func (PlatformStatus) SwaggerDoc() map[string]string { } var map_Ingress = map[string]string{ - "": "Ingress holds cluster-wide information about Ingress. The canonical name is `cluster`", + "": "Ingress holds cluster-wide information about ingress, including the default ingress domain used for routes. The canonical name is `cluster`.", "metadata": "Standard object's metadata.", "spec": "spec holds user settable values for configuration", "status": "status holds observed values from the cluster. They may not be overridden.", @@ -847,7 +847,7 @@ func (IngressList) SwaggerDoc() map[string]string { } var map_IngressSpec = map[string]string{ - "domain": "domain is used to generate a default host name for a route when the route's host name is empty. The generated host name will follow this pattern: \"..\".", + "domain": "domain is used to generate a default host name for a route when the route's host name is empty. The generated host name will follow this pattern: \"..\".\n\nIt is also used as the default wildcard domain suffix for ingress. The default ingresscontroller domain will follow this pattern: \"*.\".\n\nOnce set, changing domain is not currently supported.", } func (IngressSpec) SwaggerDoc() map[string]string { @@ -885,9 +885,9 @@ func (ExternalIPPolicy) SwaggerDoc() map[string]string { } var map_Network = map[string]string{ - "": "Network holds cluster-wide information about Network. The canonical name is `cluster`", + "": "Network holds cluster-wide information about Network. The canonical name is `cluster`. It is used to configure the desired network configuration, such as: IP address pools for services/pod IPs, network plugin, etc. Please view network.spec for an explanation on what applies when configuring this resource.", "metadata": "Standard object's metadata.", - "spec": "spec holds user settable values for configuration.", + "spec": "spec holds user settable values for configuration. As a general rule, this SHOULD NOT be read directly. Instead, you should consume the NetworkStatus, as it indicates the currently deployed configuration. Currently, most spec fields are immutable after installation. Please view the individual ones for further details on each.", "status": "status holds observed values from the cluster. They may not be overridden.", } @@ -904,10 +904,10 @@ func (NetworkList) SwaggerDoc() map[string]string { } var map_NetworkSpec = map[string]string{ - "": "NetworkSpec is the desired network configuration. As a general rule, this SHOULD NOT be read directly. Instead, you should consume the NetworkStatus, as it indicates the currently deployed configuration. Currently, changing ClusterNetwork, ServiceNetwork, or NetworkType after installation is not supported.", - "clusterNetwork": "IP address pool to use for pod IPs.", - "serviceNetwork": "IP address pool for services. Currently, we only support a single entry here.", - "networkType": "NetworkType is the plugin that is to be deployed (e.g. OpenShiftSDN). This should match a value that the cluster-network-operator understands, or else no networking will be installed. Currently supported values are: - OpenShiftSDN", + "": "NetworkSpec is the desired network configuration. As a general rule, this SHOULD NOT be read directly. Instead, you should consume the NetworkStatus, as it indicates the currently deployed configuration. Currently, most spec fields are immutable after installation. Please view the individual ones for further details on each.", + "clusterNetwork": "IP address pool to use for pod IPs. This field is immutable after installation.", + "serviceNetwork": "IP address pool for services. Currently, we only support a single entry here. This field is immutable after installation.", + "networkType": "NetworkType is the plugin that is to be deployed (e.g. OpenShiftSDN). This should match a value that the cluster-network-operator understands, or else no networking will be installed. Currently supported values are: - OpenShiftSDN This field is immutable after installation.", "externalIP": "externalIP defines configuration for controllers that affect Service.ExternalIP", } @@ -1183,8 +1183,9 @@ func (OperatorHubList) SwaggerDoc() map[string]string { } var map_OperatorHubSpec = map[string]string{ - "": "OperatorHubSpec defines the desired state of OperatorHub", - "sources": "sources is the list of default hub sources and their configuration. If the list is empty, it indicates that the default hub sources are enabled on the cluster. The list of default hub sources and their current state will always be reflected in the status block.", + "": "OperatorHubSpec defines the desired state of OperatorHub", + "disableAllDefaultSources": "disableAllDefaultSources allows you to disable all the default hub sources. If this is true, a specific entry in sources can be used to enable a default source. If this is false, a specific entry in sources can be used to disable or enable a default source.", + "sources": "sources is the list of default hub sources and their configuration. If the list is empty, it implies that the default hub sources are enabled on the cluster unless disableAllDefaultSources is true. If disableAllDefaultSources is true and sources is not empty, the configuration present in sources will take precedence. The list of default hub sources and their current state will always be reflected in the status block.", } func (OperatorHubSpec) SwaggerDoc() map[string]string { diff --git a/vendor/github.com/openshift/api/image/v1/generated.pb.go b/vendor/github.com/openshift/api/image/v1/generated.pb.go index ae113b7d35..f985843fd3 100644 --- a/vendor/github.com/openshift/api/image/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/image/v1/generated.pb.go @@ -45,19 +45,25 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + math "math" -import strings "strings" -import reflect "reflect" + k8s_io_api_core_v1 "k8s.io/api/core/v1" -import io "io" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/network/v1/generated.pb.go b/vendor/github.com/openshift/api/network/v1/generated.pb.go index 9264f76646..34a5dabb95 100644 --- a/vendor/github.com/openshift/api/network/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/network/v1/generated.pb.go @@ -23,14 +23,19 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import strings "strings" -import reflect "reflect" + proto "github.com/gogo/protobuf/proto" -import io "io" + math "math" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/oauth/v1/generated.pb.go b/vendor/github.com/openshift/api/oauth/v1/generated.pb.go index 0a4f507f12..13ce3d9111 100644 --- a/vendor/github.com/openshift/api/oauth/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/oauth/v1/generated.pb.go @@ -23,14 +23,19 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import strings "strings" -import reflect "reflect" + proto "github.com/gogo/protobuf/proto" -import io "io" + math "math" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/operator/v1/types_network.go b/vendor/github.com/openshift/api/operator/v1/types_network.go index cdc3fd0f97..953b30f8d3 100644 --- a/vendor/github.com/openshift/api/operator/v1/types_network.go +++ b/vendor/github.com/openshift/api/operator/v1/types_network.go @@ -236,6 +236,20 @@ type KuryrConfig struct { // The port kuryr-controller will listen for readiness and liveness requests. // +optional ControllerProbesPort *uint32 `json:"controllerProbesPort,omitempty"` + + // openStackServiceNetwork contains the CIDR of network from which to allocate IPs for + // OpenStack Octavia's Amphora VMs. Please note that with Amphora driver Octavia uses + // two IPs from that network for each loadbalancer - one given by OpenShift and second + // for VRRP connections. As the first one is managed by OpenShift's and second by Neutron's + // IPAMs, those need to come from different pools. Therefore `openStackServiceNetwork` + // needs to be at least twice the size of `serviceNetwork`, and whole `serviceNetwork` + // must be overlapping with `openStackServiceNetwork`. cluster-network-operator will then + // make sure VRRP IPs are taken from the ranges inside `openStackServiceNetwork` that + // are not overlapping with `serviceNetwork`, effectivly preventing conflicts. If not set + // cluster-network-operator will use `serviceNetwork` expanded by decrementing the prefix + // size by 1. + // +optional + OpenStackServiceNetwork string `json:"openStackServiceNetwork,omitempty"` } // ovnKubernetesConfig is the proposed configuration parameters for networks diff --git a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go index feee6b5480..6427b6a283 100644 --- a/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/github.com/openshift/api/operator/v1/zz_generated.swagger_doc_generated.go @@ -401,9 +401,10 @@ func (IPAMConfig) SwaggerDoc() map[string]string { } var map_KuryrConfig = map[string]string{ - "": "KuryrConfig configures the Kuryr-Kubernetes SDN", - "daemonProbesPort": "The port kuryr-daemon will listen for readiness and liveness requests.", - "controllerProbesPort": "The port kuryr-controller will listen for readiness and liveness requests.", + "": "KuryrConfig configures the Kuryr-Kubernetes SDN", + "daemonProbesPort": "The port kuryr-daemon will listen for readiness and liveness requests.", + "controllerProbesPort": "The port kuryr-controller will listen for readiness and liveness requests.", + "openStackServiceNetwork": "openStackServiceNetwork contains the CIDR of network from which to allocate IPs for OpenStack Octavia's Amphora VMs. Please note that with Amphora driver Octavia uses two IPs from that network for each loadbalancer - one given by OpenShift and second for VRRP connections. As the first one is managed by OpenShift's and second by Neutron's IPAMs, those need to come from different pools. Therefore `openStackServiceNetwork` needs to be at least twice the size of `serviceNetwork`, and whole `serviceNetwork` must be overlapping with `openStackServiceNetwork`. cluster-network-operator will then make sure VRRP IPs are taken from the ranges inside `openStackServiceNetwork` that are not overlapping with `serviceNetwork`, effectivly preventing conflicts. If not set cluster-network-operator will use `serviceNetwork` expanded by decrementing the prefix size by 1.", } func (KuryrConfig) SwaggerDoc() map[string]string { diff --git a/vendor/github.com/openshift/api/project/v1/generated.pb.go b/vendor/github.com/openshift/api/project/v1/generated.pb.go index 018c6acd1f..7124798120 100644 --- a/vendor/github.com/openshift/api/project/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/project/v1/generated.pb.go @@ -16,16 +16,21 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" + proto "github.com/gogo/protobuf/proto" -import strings "strings" -import reflect "reflect" + math "math" -import io "io" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/quota/v1/generated.pb.go b/vendor/github.com/openshift/api/quota/v1/generated.pb.go index 94ff472379..3c6dedc78e 100644 --- a/vendor/github.com/openshift/api/quota/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/quota/v1/generated.pb.go @@ -19,18 +19,23 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + math "math" -import strings "strings" -import reflect "reflect" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -import io "io" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/route/v1/generated.pb.go b/vendor/github.com/openshift/api/route/v1/generated.pb.go index dde33a9943..6210b9ff7c 100644 --- a/vendor/github.com/openshift/api/route/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/route/v1/generated.pb.go @@ -21,18 +21,23 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + proto "github.com/gogo/protobuf/proto" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" + math "math" -import strings "strings" -import reflect "reflect" + k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -import io "io" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/security/v1/generated.pb.go b/vendor/github.com/openshift/api/security/v1/generated.pb.go index 02fbad99be..4d73de0751 100644 --- a/vendor/github.com/openshift/api/security/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/security/v1/generated.pb.go @@ -30,16 +30,21 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" + proto "github.com/gogo/protobuf/proto" -import strings "strings" -import reflect "reflect" + math "math" -import io "io" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/template/v1/generated.pb.go b/vendor/github.com/openshift/api/template/v1/generated.pb.go index 1de3d14173..a497b86e20 100644 --- a/vendor/github.com/openshift/api/template/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/template/v1/generated.pb.go @@ -25,20 +25,25 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import k8s_io_api_core_v1 "k8s.io/api/core/v1" + proto "github.com/gogo/protobuf/proto" -import k8s_io_apimachinery_pkg_runtime "k8s.io/apimachinery/pkg/runtime" + math "math" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + k8s_io_api_core_v1 "k8s.io/api/core/v1" -import strings "strings" -import reflect "reflect" + k8s_io_apimachinery_pkg_runtime "k8s.io/apimachinery/pkg/runtime" -import io "io" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/api/user/v1/generated.pb.go b/vendor/github.com/openshift/api/user/v1/generated.pb.go index 172e4a7cb7..796f475535 100644 --- a/vendor/github.com/openshift/api/user/v1/generated.pb.go +++ b/vendor/github.com/openshift/api/user/v1/generated.pb.go @@ -19,16 +19,21 @@ */ package v1 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + proto "github.com/gogo/protobuf/proto" -import strings "strings" -import reflect "reflect" + math "math" -import io "io" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + + strings "strings" + + reflect "reflect" + + io "io" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/vendor/github.com/openshift/client-go/glide.lock b/vendor/github.com/openshift/client-go/glide.lock index f5c8c1538d..1608395ba7 100644 --- a/vendor/github.com/openshift/client-go/glide.lock +++ b/vendor/github.com/openshift/client-go/glide.lock @@ -1,5 +1,5 @@ hash: 595563cffda70c75833adcf07415011d115db7218cbbddc4c14f1684ad39638a -updated: 2019-08-06T10:39:29.760053178-04:00 +updated: 2019-08-13T12:05:19.648281606-04:00 imports: - name: github.com/davecgh/go-spew version: 782f4967f2dc4564575ca782fe2d04090b5faca8 @@ -41,7 +41,7 @@ imports: - name: github.com/modern-go/reflect2 version: 94122c33edd36123c84d5368cfb2b69df93a0ec8 - name: github.com/openshift/api - version: 9ef0612c775d8571388e16d1bc68c4b3df83e7fb + version: b5570061b31fed3b06c24077c534b1a1bf7ecf8b subpackages: - apps/v1 - authorization/v1 diff --git a/vendor/github.com/openshift/library-go/Makefile b/vendor/github.com/openshift/library-go/Makefile index c7f0ce5dfc..2704d89e47 100644 --- a/vendor/github.com/openshift/library-go/Makefile +++ b/vendor/github.com/openshift/library-go/Makefile @@ -2,7 +2,7 @@ all: build .PHONY: all # All the go packages (e.g. for verfy) -GO_PACKAGES :=./pkg/... ./cmd/... +GO_PACKAGES :=./pkg/... # Packages to be compiled GO_BUILD_PACKAGES :=$(GO_PACKAGES) # Do not auto-expand packages for libraries or it would compile them separately diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/doc.go new file mode 100644 index 0000000000..a093b4bd17 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/doc.go @@ -0,0 +1,14 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery + +// this is a dependency magnet to make it easier to pull in the build-machinery. We want a single import to pull all of it in. +import ( + _ "github.com/openshift/library-go/alpha-build-machinery/make" + _ "github.com/openshift/library-go/alpha-build-machinery/make/lib" + _ "github.com/openshift/library-go/alpha-build-machinery/make/targets" + _ "github.com/openshift/library-go/alpha-build-machinery/make/targets/golang" + _ "github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift" + _ "github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/operator" + _ "github.com/openshift/library-go/alpha-build-machinery/scripts" +) diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/lib/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/lib/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/lib/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/golang/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/golang/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/golang/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/operator/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/operator/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/make/targets/openshift/operator/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/alpha-build-machinery/scripts/doc.go b/vendor/github.com/openshift/library-go/alpha-build-machinery/scripts/doc.go new file mode 100644 index 0000000000..66ba5512e1 --- /dev/null +++ b/vendor/github.com/openshift/library-go/alpha-build-machinery/scripts/doc.go @@ -0,0 +1,3 @@ +// required for gomod to pull in packages. + +package alpha_build_machinery diff --git a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go b/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go deleted file mode 100755 index cb37958a23..0000000000 --- a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/generator/generator.go +++ /dev/null @@ -1,391 +0,0 @@ -package generator - -import ( - "flag" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "reflect" - "strings" - - "github.com/evanphx/json-patch" - "gopkg.in/yaml.v2" - - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - utilyaml "k8s.io/apimachinery/pkg/util/yaml" - crdgenerator "sigs.k8s.io/controller-tools/pkg/crd/generator" -) - -var ( - scheme = runtime.NewScheme() - codecs = serializer.NewCodecFactory(scheme) -) - -func init() { - v1beta1.AddToScheme(scheme) -} - -func Run() error { - apisDir := flag.String("apis-dir", "pkg/apis", "the (relative) path to the package with API definitions") - apis := flag.String("apis", "*", "the apis to generate from the apis-dir, in bash glob syntax") - manifestDir := flag.String("manifests-dir", "manifests", "the directory with existing CRD manifests") - outputDir := flag.String("output-dir", "", "optional directory to output the kubebuilder CRDs. By default a temporary directory is used.") - verifyOnly := flag.Bool("verify-only", false, "do not write files, only compare and return with return code 1 if dirty") - domain := flag.String("domain", "", "the domain appended to group names.") - repo := flag.String("repo", "", "the repository package name (optional).") - - flag.Parse() - - // load existing manifests from manifests/ dir - existing, err := crdsFromDirectory(*manifestDir) - if err != nil { - return err - } - - // create temp dir - pwd, err := os.Getwd() - if err != nil { - return err - } - tmpDir, err := ioutil.TempDir(pwd, "") - if err != nil { - return fmt.Errorf("error creating temp directory: %v\n", err) - } - defer os.RemoveAll(tmpDir) - relTmpDir := tmpDir[len(pwd)+1:] - - // find repo in GOPATH - sep := string([]rune{os.PathSeparator}) - GOPATH := strings.TrimRight(os.Getenv("GOPATH"), sep) - if len(*repo) == 0 && len(GOPATH) > 0 && strings.HasPrefix(pwd, filepath.Join(GOPATH, "src")+sep) { - *repo = pwd[len(filepath.Join(GOPATH, "src")+sep):] - fmt.Printf("Derived repo %q from GOPATH and working directory.\n", *repo) - } - - // validate params - if len(*repo) == 0 { - return fmt.Errorf("repo cannot be empty. Run crd-schema-gen in GOPATH or specify repo explicitly.") - } - if len(*domain) == 0 { - return fmt.Errorf("domain cannot be empty.") - } - - // copy APIs to temp dir - fmt.Printf("Copying vendor/github.com/openshift/api/config to temporary pkg/apis...\n") - if err := os.MkdirAll(filepath.Join(tmpDir, "pkg/apis"), 0755); err != nil { - return err - } - cmd := fmt.Sprintf("cp -av \"%s/\"%s \"%s\"", *apisDir, *apis, filepath.Join(tmpDir, "pkg/apis")) - out, err := exec.Command("/bin/bash", "-c", cmd).CombinedOutput() - if err != nil { - fmt.Print(string(out)) - return err - } - if err := ioutil.WriteFile(filepath.Join(tmpDir, "PROJECT"), []byte(fmt.Sprintf(` -domain: %s -repo: %s/%s -`, *domain, *repo, relTmpDir)), 0644); err != nil { - return err - } - - // generate kubebuilder KindGroupYaml manifests into temp dir - g := crdgenerator.Generator{ - RootPath: tmpDir, - OutputDir: filepath.Join(tmpDir, "manifests"), - SkipMapValidation: true, - } - - if len(*outputDir) != 0 { - g.OutputDir = *outputDir - fmt.Printf("Creating kubebuilder manifests %q ...\n", *outputDir) - } else { - fmt.Printf("Creating kubebuilder manifests ...\n") - } - - if err := g.ValidateAndInitFields(); err != nil { - return err - } - if err := g.Do(); err != nil { - return err - } - - // the generator changes the directory for some reason - os.Chdir(pwd) - - // load kubebuilder manifests from temp dir - fromKubebuilder, err := crdsFromDirectory(g.OutputDir) - if err != nil { - return err - } - - existingFileNames := map[string]string{} - for fn, crd := range existing { - existingFileNames[crd.KindGroup] = fn - } - - // update existing manifests with validations of kubebuilder output - dirty := false - noneFound := true - for fn, withValidation := range fromKubebuilder { - existingFileName, ok := existingFileNames[withValidation.KindGroup] - if !ok { - continue - } - noneFound = false - - crd := existing[existingFileName] - - // TODO: support multiple versions - validation, _, err := nested(withValidation.Yaml, "spec", "validation") - if err != nil { - return fmt.Errorf("failed to access spec.validation in %s: %v", fn, err) - } - - // yaml merge patch exists? - patchFileName := existingFileName + "-merge-patch" - if _, err := os.Stat(patchFileName); err == nil { - fmt.Printf("Applying patch %q ...\n", patchFileName) - - yamlPatch, err := ioutil.ReadFile(patchFileName) - if err != nil { - return fmt.Errorf("failed to read yaml-merge-patch %q: %v", patchFileName, err) - } - var patch yaml.MapSlice - if err := yaml.Unmarshal(yamlPatch, &patch); err != nil { - return fmt.Errorf("failed to unmarshal yaml merge patch %q: %v", patchFileName, err) - } - if !onlyHasNoneOr(patch, "spec", "validation") { - return fmt.Errorf("patch in %q can only have spec.validation", patchFileName) - } - validationPatch, _, err := nested(patch, "spec", "validation") - if err != nil { - return fmt.Errorf("failed to get spec.validation from %q: %v", patchFileName, err) - } - if yamlPatch, err = yaml.Marshal(validationPatch); err != nil { - return fmt.Errorf("failed to marshal spec.validation of %q: %v", patchFileName, err) - } - jsonPatch, err := utilyaml.ToJSON(yamlPatch) - if err != nil { - return fmt.Errorf("failed to convert yaml of %q to json: %v", patchFileName, err) - } - yamlValidation, err := yaml.Marshal(validation) - if err != nil { - return fmt.Errorf("failed to marshal generated validation schema of %q: %v", existingFileName, err) - } - jsonValidation, err := utilyaml.ToJSON(yamlValidation) - if err != nil { - return fmt.Errorf("failed to convert yaml validation of %q to json: %v", existingFileName, err) - } - if jsonValidation, err = jsonpatch.MergePatch(jsonValidation, jsonPatch); err != nil { - return fmt.Errorf("failed to patch %q with %q: %v", existingFileName, patchFileName, err) - } - if err := yaml.Unmarshal(jsonValidation, &validation); err != nil { - return fmt.Errorf("failed to unmarshal patched validation schema of %q: %v", existingFileName, err) - } - } - - if validation == nil { - continue - } - - updated, err := set(crd.Yaml, validation, "spec", "validation") - if err != nil { - return fmt.Errorf("failed to set spec.validation in %s: %v", existingFileName, err) - } - if reflect.DeepEqual(updated, crd.Yaml) { - fmt.Printf("Validation of %s in %s did not change.\n", crd.KindGroup, existingFileName) - continue - } - - bs, err := yaml.Marshal(updated) - if err != nil { - return err - } - - // write updated file, either to old location, or to temp dir in verify mode - newFn := existingFileName - if *verifyOnly { - newFn = filepath.Join(tmpDir, filepath.Base(existingFileName)) - } else { - fmt.Printf("Updating validation of %s in %s.\n", crd.KindGroup, existingFileName) - } - if err := ioutil.WriteFile(newFn, bs, 0644); err != nil { - return err - } - - // compare old and new file - if *verifyOnly { - out, err := exec.Command("diff", "-u", existingFileName, newFn).CombinedOutput() - if err != nil { - fmt.Println(string(out)) - dirty = true - } - } - } - - if noneFound { - fmt.Printf("None of the found API types has a corresponding CRD manifest. These API types where found:\n\n") - for _, withValidation := range fromKubebuilder { - fmt.Printf(" %s\n", withValidation.KindGroup) - } - fmt.Printf("These CRDs were found:\n\n") - for existingKindGroup := range existingFileNames { - fmt.Printf(" %s\n", existingKindGroup) - } - return fmt.Errorf("no API type for found CRD manifests") - } - - if *verifyOnly && dirty { - return fmt.Errorf("verification failed") - } - - return nil -} - -func nested(x interface{}, pth ...string) (interface{}, bool, error) { - if len(pth) == 0 { - return x, true, nil - } - m, ok := x.(yaml.MapSlice) - if !ok { - return nil, false, fmt.Errorf("%s is not an object, but %T", strings.Join(pth, "."), x) - } - for _, item := range m { - s, ok := item.Key.(string) - if !ok { - continue - } - if s == pth[0] { - ret, found, err := nested(item.Value, pth[1:]...) - if err != nil { - return ret, found, fmt.Errorf("%s.%s", pth[0], err) - } - return ret, found, nil - } - } - return nil, false, nil -} - -func set(x interface{}, v interface{}, pth ...string) (interface{}, error) { - if len(pth) == 0 { - return v, nil - } - - if x == nil { - result, err := set(nil, v, pth[1:]...) - if err != nil { - return nil, fmt.Errorf("%s.%s", pth[0], err) - } - return yaml.MapSlice{yaml.MapItem{Key: pth[0], Value: result}}, nil - } - - m, ok := x.(yaml.MapSlice) - if !ok { - return nil, fmt.Errorf("%s is not an object", strings.Join(pth, ".")) - } - - foundAt := -1 - for i, item := range m { - s, ok := item.Key.(string) - if !ok { - continue - } - if s == pth[0] { - foundAt = i - break - } - } - - if foundAt < 0 { - ret := make(yaml.MapSlice, len(m), len(m)+1) - copy(ret, m) - result, err := set(nil, v, pth[1:]...) - if err != nil { - return nil, fmt.Errorf("%s.%s", pth[0], err) - } - return append(ret, yaml.MapItem{Key: pth[0], Value: result}), nil - } - - result, err := set(m[foundAt].Value, v, pth[1:]...) - ret := make(yaml.MapSlice, len(m)) - copy(ret, m) - if err != nil { - return nil, fmt.Errorf("%s.%s", pth[0], err) - } - ret[foundAt].Value = result - return ret, nil -} - -// onlyHasNoneOr checks for existance of the given path, but nothing next to it is allowed -func onlyHasNoneOr(x interface{}, pth ...string) bool { - if len(pth) == 0 { - return true - } - m, ok := x.(yaml.MapSlice) - if !ok { - return false - } - switch len(m) { - case 0: - return true - case 1: - s, ok := m[0].Key.(string) - if !ok || s != pth[0] { - return false - } - return onlyHasNoneOr(m[0].Value, pth[1:]...) - default: - return false - } -} - -type KindGroupYaml struct { - KindGroup string - Yaml interface{} -} - -// crdsFromDirectory returns CRDs by file path -func crdsFromDirectory(dir string) (map[string]KindGroupYaml, error) { - ret := map[string]KindGroupYaml{} - infos, err := ioutil.ReadDir(dir) - if err != nil { - return nil, err - } - for _, info := range infos { - if info.IsDir() { - continue - } - if !strings.HasSuffix(info.Name(), ".yaml") { - continue - } - bs, err := ioutil.ReadFile(filepath.Join(dir, info.Name())) - if err != nil { - return nil, err - } - - obj, _, err := codecs.UniversalDeserializer().Decode(bs, nil, nil) - if err != nil { - continue - } - crd, ok := obj.(*v1beta1.CustomResourceDefinition) - if !ok { - continue - } - - var y yaml.MapSlice - if err := yaml.Unmarshal(bs, &y); err != nil { - fmt.Printf("Warning: failed to unmarshal %q, skipping\n", info.Name()) - continue - } - key := crd.Spec.Names.Kind + "." + crd.Spec.Group - ret[filepath.Join(dir, info.Name())] = KindGroupYaml{key, y} - } - if err != nil { - return nil, err - } - return ret, err -} diff --git a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/main.go b/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/main.go deleted file mode 100755 index 228a800cca..0000000000 --- a/vendor/github.com/openshift/library-go/cmd/crd-schema-gen/main.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "github.com/openshift/library-go/cmd/crd-schema-gen/generator" -) - -func main() { - if err := generator.Run(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} diff --git a/vendor/github.com/openshift/library-go/glide.lock b/vendor/github.com/openshift/library-go/glide.lock index 2c67dcfaf1..f448210d46 100644 --- a/vendor/github.com/openshift/library-go/glide.lock +++ b/vendor/github.com/openshift/library-go/glide.lock @@ -1,5 +1,5 @@ -hash: 14182a87b2489ea8cd2db705bf09aad592752d9c9f7cc6cc840a76bcb179a2e8 -updated: 2019-07-14T22:28:29.452706+02:00 +hash: 4812b0cc8114a9f73471b786f4f760b3c363b7fa56a0f8fd83b56d263bc2e616 +updated: 2019-08-15T14:58:38.31621537-04:00 imports: - name: bitbucket.org/ww/goautoneg version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675 @@ -17,7 +17,7 @@ imports: - name: github.com/certifi/gocertifi version: ee1a9a0726d2ae45f54118cac878c990d4016ded - name: github.com/containerd/continuity - version: aaeac12a7ffcd198ae25440a9dff125c2e2703a7 + version: f2a389ac0a02ce21c09edd7344677a601970f41c subpackages: - pathdriver - name: github.com/coreos/etcd @@ -159,7 +159,7 @@ imports: - name: github.com/docker/go-units version: 519db1ee28dcc9fd2474ae59fca29a810482bfb1 - name: github.com/docker/libnetwork - version: 14f9d751adc2d51b38d14b4e14419b76466d3b94 + version: 7f13a5c99f4bb76a4122035d495984b6a09739bb subpackages: - ipamutils - name: github.com/docker/libtrust @@ -175,7 +175,7 @@ imports: - name: github.com/getsentry/raven-go version: c977f96e109525a5d8fa10a19165341f601f38b0 - name: github.com/ghodss/yaml - version: c7ce16629ff4cd059ed96ed06419dd3856fd3577 + version: 25d852aebe32c875e9c044af3eef9c7dc6bc777f - name: github.com/go-openapi/jsonpointer version: ef5f0afec364d3b9396b7b77b43dbe26bf1f8004 - name: github.com/go-openapi/jsonreference @@ -184,8 +184,6 @@ imports: version: 5bae59e25b21498baea7f9d46e9c147ec106a42e - name: github.com/go-openapi/swag version: 5899d5c5e619fda5fa86e14795a835f473ca284c -- name: github.com/gobuffalo/envy - version: 043cb4b8af871b49563291e32c66bb84378a60ac - name: github.com/gogo/protobuf version: 342cbe0a04158f6dcb03ca0079991a51a4248c02 subpackages: @@ -200,12 +198,10 @@ imports: - name: github.com/golang/protobuf version: b4deda0973fb4c70b50d226b1af49f3da59f5265 subpackages: - - jsonpb - proto - ptypes - ptypes/any - ptypes/duration - - ptypes/struct - ptypes/timestamp - name: github.com/gonum/blas version: f22b278b28ac9805aadd613a754a60c35b24ae69 @@ -251,7 +247,7 @@ imports: - compiler - extensions - name: github.com/gorilla/mux - version: d83b6ffe499a29cc05fc977988d0392851779620 + version: e67b3c02c7195c052acff13261f0c9fd1ba53011 - name: github.com/grpc-ecosystem/go-grpc-prometheus version: 2500245aa6110c562d17020fb31a2c133d737799 - name: github.com/hashicorp/golang-lru @@ -262,8 +258,6 @@ imports: version: 9316a62528ac99aaecb4e47eadd6dc8aa6533d58 - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 -- name: github.com/joho/godotenv - version: 5c0e6c6ab1a0a9ef0a8822cba3a05d62f7dad941 - name: github.com/json-iterator/go version: ab8a2e0c74be9d3be70b3184d9acc634935ded82 - name: github.com/jteeuwen/go-bindata @@ -274,14 +268,12 @@ imports: - buffer - jlexer - jwriter -- name: github.com/markbates/inflect - version: d582c680dc4d29c2279628ae00e743005bfcd4fe - name: github.com/matttproud/golang_protobuf_extensions version: c12348ce28de40eed0136aa2b644d0ee0650e56c subpackages: - pbutil - name: github.com/Microsoft/go-winio - version: 881e3d46423d592d11da9873ff6581dc577a1d0f + version: 6c72808b55902eae4c5943626030429ff20f3b63 subpackages: - pkg/guid - name: github.com/modern-go/concurrent @@ -302,12 +294,12 @@ imports: - specs-go - specs-go/v1 - name: github.com/opencontainers/runc - version: 6cccc1760d57d9e1bc856b96eeb7ee02b7b8101d + version: 2e94378464ae22b92e1335c200edb37ebc94a1b7 subpackages: - libcontainer/system - libcontainer/user - name: github.com/openshift/api - version: f15120709e0ac8de84e11616d8f0cac54e8f52e3 + version: a94e914914f4228d0bcba6fc8a22614c5f5e2dad subpackages: - apps - apps/v1 @@ -354,7 +346,7 @@ imports: - webconsole - webconsole/v1 - name: github.com/openshift/client-go - version: c44a8b61b9f46cd9e802384dfeda0bc9942db68a + version: 5a5508328169b8a6992ea4ef711add89ddce3c6d subpackages: - apps/clientset/versioned/scheme - apps/clientset/versioned/typed/apps/v1 @@ -411,20 +403,10 @@ imports: version: 8a290539e2e8629dbc4e6bad948158f790ec31f4 - name: github.com/PuerkitoBio/urlesc version: 5bd2802263f21d8788851d5305584c82a5c75d7e -- name: github.com/rogpeppe/go-internal - version: 6f68bf1e81f8552c7dbd47f3bc4371c2db0941a6 - subpackages: - - modfile - - module - - semver - name: github.com/sigma/go-inotify version: c87b6cf5033d2c6486046f045eeebdc3d910fd38 - name: github.com/sirupsen/logrus version: 89742aefa4b206dcf400792f3bd35b542998eb3b -- name: github.com/spf13/afero - version: 588a75ec4f32903aa5e39a2619ba6a4631e28424 - subpackages: - - mem - name: github.com/spf13/cobra version: c439c4fa093711d42e1b01acb1235b52004753c1 - name: github.com/spf13/pflag @@ -434,12 +416,22 @@ imports: subpackages: - bcrypt - blowfish + - cryptobyte + - cryptobyte/asn1 + - ed25519 + - ed25519/internal/edwards25519 + - internal/subtle + - nacl/secretbox + - poly1305 + - salsa20/salsa - ssh/terminal - name: golang.org/x/net version: 65e2d4e15006aab9813ff8769e768bbf4bb667a0 subpackages: - context - context/ctxhttp + - html + - html/atom - http/httpguts - http2 - http2/hpack @@ -478,10 +470,9 @@ imports: version: 2382e3994d48b1d22acc2c86bcad0a2aff028e32 subpackages: - container/intsets - - go/ast/astutil - imports - name: google.golang.org/appengine - version: b2f4a3cf3c67576a2ee09e1fe62656a5086ce880 + version: 54a98f90d1c46b7731eb8fb305d2a321c30ef610 subpackages: - internal - internal/base @@ -532,7 +523,7 @@ imports: - name: gopkg.in/natefinch/lumberjack.v2 version: 20b71e5b60d756d3d2f80def009790325acc2b23 - name: gopkg.in/yaml.v2 - version: 51d6538a90f86fe93ac480b35f37b2be17fef232 + version: 5420a8b6744d3b0345ab293f6fcba19c978f1183 - name: k8s.io/api version: 40a48860b5abbba9aa891b02b32da429b08d96a0 subpackages: @@ -737,6 +728,8 @@ imports: - discovery - discovery/fake - dynamic + - dynamic/dynamicinformer + - dynamic/dynamiclister - dynamic/fake - informers - informers/admissionregistration @@ -942,14 +935,6 @@ imports: subpackages: - cli/flag - logs -- name: k8s.io/gengo - version: e17681d19d3ac4837a019ece36c2a0ec31ffe985 - subpackages: - - args - - generator - - namer - - parser - - types - name: k8s.io/klog version: 8e90cee79f823779174776412c13478955131846 - name: k8s.io/kube-aggregator @@ -973,18 +958,11 @@ imports: version: c2654d5206da6b7b6ace12841e8f359bb89b443c subpackages: - buffer + - diff + - field - integer + - pointer - trace -- name: sigs.k8s.io/controller-tools - version: 72ae52c08b9dd626cfb64ebef0fbf40ce667939b - repo: https://github.com/openshift/kubernetes-sigs-controller-tools - subpackages: - - pkg/crd/generator - - pkg/crd/util - - pkg/internal/codegen - - pkg/internal/codegen/parse - - pkg/internal/general - - pkg/util - name: sigs.k8s.io/structured-merge-diff version: e85c7b244fd2cc57bb829d73a061f93a441e63ce subpackages: diff --git a/vendor/github.com/openshift/library-go/glide.yaml b/vendor/github.com/openshift/library-go/glide.yaml index 920b7ca6e8..6d08aa413c 100644 --- a/vendor/github.com/openshift/library-go/glide.yaml +++ b/vendor/github.com/openshift/library-go/glide.yaml @@ -17,14 +17,6 @@ import: - package: github.com/openshift/client-go version: master -# crd-schema-gen - # TODO: we need to this to get nullable patch, but we will replace this with new repo soon. -- package: sigs.k8s.io/controller-tools - repo: https://github.com/openshift/kubernetes-sigs-controller-tools - version: origin-4.1-kubernetes-1.13.4 -- package: k8s.io/gengo - version: e17681d19d3ac4837a019ece36c2a0ec31ffe985 - # sig-master - needed for file observer - package: github.com/sigma/go-inotify version: c87b6cf5033d2c6486046f045eeebdc3d910fd38 diff --git a/vendor/github.com/openshift/library-go/pkg/oauth/oauthserviceaccountclient/oauthclientregistry_test.go b/vendor/github.com/openshift/library-go/pkg/oauth/oauthserviceaccountclient/oauthclientregistry_test.go index 4566271de4..8402b755e5 100644 --- a/vendor/github.com/openshift/library-go/pkg/oauth/oauthserviceaccountclient/oauthclientregistry_test.go +++ b/vendor/github.com/openshift/library-go/pkg/oauth/oauthserviceaccountclient/oauthclientregistry_test.go @@ -761,7 +761,7 @@ func TestParseModelsMap(t *testing.T) { OAuthRedirectModelAnnotationURIPrefix + "two": "justapath", OAuthRedirectModelAnnotationURIPrefix + "three": "http://redhat.com", OAuthRedirectModelAnnotationURIPrefix + "four": "http://hello:90/world", - OAuthRedirectModelAnnotationURIPrefix + "five": "scheme0://host0:port0/path0", + OAuthRedirectModelAnnotationURIPrefix + "five": "scheme0://host0:5000/path0", OAuthRedirectModelAnnotationReferencePrefix + "five": buildRedirectObjectReferenceString("kind0", "name0", "group0"), }, expected: map[string]model{ @@ -802,7 +802,7 @@ func TestParseModelsMap(t *testing.T) { }, "five": { scheme: "scheme0", - port: "port0", + port: "5000", path: "/path0", group: "group0", kind: "kind0", diff --git a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go index e15a691a49..e93572cdc1 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client.go @@ -1,10 +1,10 @@ package genericoperatorclient import ( + "reflect" + "strings" "time" - "github.com/imdario/mergo" - "k8s.io/apimachinery/pkg/runtime" operatorv1 "github.com/openshift/api/operator/v1" @@ -65,6 +65,9 @@ func (c dynamicOperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *op return spec, status, instance.GetResourceVersion(), nil } +// UpdateOperatorSpec overwrites the operator object spec with the values given +// in operatorv1.OperatorSpec while preserving pre-existing spec fields that have +// no correspondence in operatorv1.OperatorSpec. func (c dynamicOperatorClient) UpdateOperatorSpec(resourceVersion string, spec *operatorv1.OperatorSpec) (*operatorv1.OperatorSpec, string, error) { uncastOriginal, err := c.informer.Lister().Get(globalConfigName) if err != nil { @@ -90,6 +93,9 @@ func (c dynamicOperatorClient) UpdateOperatorSpec(resourceVersion string, spec * return retSpec, ret.GetResourceVersion(), nil } +// UpdateOperatorStatus overwrites the operator object status with the values given +// in operatorv1.OperatorStatus while preserving pre-existing status fields that have +// no correspondence in operatorv1.OperatorStatus. func (c dynamicOperatorClient) UpdateOperatorStatus(resourceVersion string, status *operatorv1.OperatorStatus) (*operatorv1.OperatorStatus, error) { uncastOriginal, err := c.informer.Lister().Get(globalConfigName) if err != nil { @@ -132,24 +138,28 @@ func getOperatorSpecFromUnstructured(obj map[string]interface{}) (*operatorv1.Op } func setOperatorSpecFromUnstructured(obj map[string]interface{}, spec *operatorv1.OperatorSpec) error { - // we cannot simply set the entire map because doing so would stomp unknown fields, like say a static pod operator spec when cast as an operator spec - newUnstructuredSpec, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) + // we cannot simply set the entire map because doing so would stomp unknown fields, + // like say a static pod operator spec when cast as an operator spec + newSpec, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) if err != nil { return err } - originalUnstructuredSpec, exists, err := unstructured.NestedMap(obj, "spec") - if !exists { - return unstructured.SetNestedMap(obj, newUnstructuredSpec, "spec") - } + origSpec, preExistingSpec, err := unstructured.NestedMap(obj, "spec") if err != nil { return err } - if err := mergo.Merge(&originalUnstructuredSpec, newUnstructuredSpec, mergo.WithOverride); err != nil { - return err - } - - return unstructured.SetNestedMap(obj, originalUnstructuredSpec, "spec") + if preExistingSpec { + flds := topLevelFields(*spec) + for k, v := range origSpec { + if !flds[k] { + if err := unstructured.SetNestedField(newSpec, v, k); err != nil { + return err + } + } + } + } + return unstructured.SetNestedMap(obj, newSpec, "spec") } func getOperatorStatusFromUnstructured(obj map[string]interface{}) (*operatorv1.OperatorStatus, error) { @@ -168,23 +178,48 @@ func getOperatorStatusFromUnstructured(obj map[string]interface{}) (*operatorv1. return ret, nil } -func setOperatorStatusFromUnstructured(obj map[string]interface{}, spec *operatorv1.OperatorStatus) error { - // we cannot simply set the entire map because doing so would stomp unknown fields, like say a static pod operator spec when cast as an operator spec - newUnstructuredStatus, err := runtime.DefaultUnstructuredConverter.ToUnstructured(spec) +func setOperatorStatusFromUnstructured(obj map[string]interface{}, status *operatorv1.OperatorStatus) error { + // we cannot simply set the entire map because doing so would stomp unknown fields, + // like say a static pod operator status when cast as an operator status + newStatus, err := runtime.DefaultUnstructuredConverter.ToUnstructured(status) if err != nil { return err } - originalUnstructuredStatus, exists, err := unstructured.NestedMap(obj, "status") - if !exists { - return unstructured.SetNestedMap(obj, newUnstructuredStatus, "status") - } + origStatus, preExistingStatus, err := unstructured.NestedMap(obj, "status") if err != nil { return err } - if err := mergo.Merge(&originalUnstructuredStatus, newUnstructuredStatus, mergo.WithOverride); err != nil { - return err - } + if preExistingStatus { + flds := topLevelFields(*status) + for k, v := range origStatus { + if !flds[k] { + if err := unstructured.SetNestedField(newStatus, v, k); err != nil { + return err + } + } + } + } + return unstructured.SetNestedMap(obj, newStatus, "status") +} - return unstructured.SetNestedMap(obj, originalUnstructuredStatus, "status") +func topLevelFields(obj interface{}) map[string]bool { + ret := map[string]bool{} + t := reflect.TypeOf(obj) + for i := 0; i < t.NumField(); i++ { + fld := t.Field(i) + fieldName := fld.Name + if jsonTag := fld.Tag.Get("json"); jsonTag == "-" { + continue + } else if jsonTag != "" { + // check for possible comma as in "...,omitempty" + var commaIdx int + if commaIdx = strings.Index(jsonTag, ","); commaIdx < 0 { + commaIdx = len(jsonTag) + } + fieldName = jsonTag[:commaIdx] + } + ret[fieldName] = true + } + return ret } diff --git a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client_test.go b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client_test.go index 15e39e8962..df25505734 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/genericoperatorclient/dynamic_operator_client_test.go @@ -4,6 +4,7 @@ import ( "reflect" "testing" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/diff" operatorv1 "github.com/openshift/api/operator/v1" @@ -29,10 +30,74 @@ func TestSetOperatorSpecFromUnstructured(t *testing.T) { }, expected: map[string]interface{}{ "spec": map[string]interface{}{ - "non-standard-field": "value", - "logLevel": "Trace", - "managementState": "", - "operatorLogLevel": "", + "non-standard-field": "value", + "logLevel": "Trace", + "managementState": "", + "operatorLogLevel": "", + "unsupportedConfigOverrides": nil, + "observedConfig": nil, + }, + }, + }, + { + name: "keep-everything-outside-of-spec", + in: map[string]interface{}{ + "kind": "Foo", + "apiVersion": "bar/v1", + "status": map[string]interface{}{"foo": "bar"}, + "spec": map[string]interface{}{}, + }, + spec: &operatorv1.OperatorSpec{}, + expected: map[string]interface{}{ + "kind": "Foo", + "apiVersion": "bar/v1", + "status": map[string]interface{}{"foo": "bar"}, + "spec": map[string]interface{}{ + "logLevel": "", + "managementState": "", + "operatorLogLevel": "", + "unsupportedConfigOverrides": nil, + "observedConfig": nil, + }, + }, + }, + { + name: "replace-rawextensions", + in: map[string]interface{}{ + "spec": map[string]interface{}{ + "unsupportedConfigOverrides": map[string]interface{}{"foo": "bar"}, + }, + }, + spec: &operatorv1.OperatorSpec{ + LogLevel: operatorv1.Trace, + }, + expected: map[string]interface{}{ + "spec": map[string]interface{}{ + "logLevel": "Trace", + "managementState": "", + "operatorLogLevel": "", + "unsupportedConfigOverrides": nil, + "observedConfig": nil, + }, + }, + }, + { + name: "remove-observed-fields", + in: map[string]interface{}{ + "spec": map[string]interface{}{ + "observedConfig": map[string]interface{}{"a": "1", "b": "2"}, + }, + }, + spec: &operatorv1.OperatorSpec{ + ObservedConfig: runtime.RawExtension{Raw: []byte(`{"a":1}`)}, + }, + expected: map[string]interface{}{ + "spec": map[string]interface{}{ + "logLevel": "", + "managementState": "", + "operatorLogLevel": "", + "unsupportedConfigOverrides": nil, + "observedConfig": map[string]interface{}{"a": int64(1)}, }, }, }, @@ -87,6 +152,24 @@ func TestSetOperatorStatusFromUnstructured(t *testing.T) { }, }, }, + { + name: "keep-everything-outside-of-status", + in: map[string]interface{}{ + "kind": "Foo", + "apiVersion": "bar/v1", + "spec": map[string]interface{}{"foo": "bar"}, + "status": map[string]interface{}{}, + }, + status: &operatorv1.OperatorStatus{}, + expected: map[string]interface{}{ + "kind": "Foo", + "apiVersion": "bar/v1", + "spec": map[string]interface{}{"foo": "bar"}, + "status": map[string]interface{}{ + "readyReplicas": int64(0), + }, + }, + }, { name: "replace-condition", in: map[string]interface{}{ diff --git a/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd.go b/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd.go index c0d64b7b2c..4c2597e465 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd.go @@ -6,6 +6,8 @@ import ( "io/ioutil" "os" "path/filepath" + "strconv" + "strings" "syscall" "time" @@ -26,8 +28,11 @@ import ( ) type FileWatcherOptions struct { - // ProcessName is the name of the process we will send SIGTERM + // ProcessName is the name of the process to look for in /proc if non-empty, + // indentifying the process to send SIGTERM to. ProcessName string + // PidFile contains the pid of the process to send SIGTERM to. Can be empty. + PidFile string // Files lists all files we want to monitor for changes Files []string @@ -43,6 +48,9 @@ type FileWatcherOptions struct { // Time to give the process to terminate gracefully TerminationGracePeriod time.Duration + // ReadyFile is touched when the watched files have been initially read + ReadyFile string + // for unit-test to mock getting the process PID (unit-test) findPidByNameFn func(name string) (int, bool, error) @@ -119,12 +127,14 @@ func NewFileWatcherWatchdog() *cobra.Command { } func (o *FileWatcherOptions) AddFlags(fs *pflag.FlagSet) { - fs.StringVar(&o.ProcessName, "process-name", "", "name of the process to send TERM signal to on file change (eg. 'hyperkube').") + fs.StringVar(&o.ProcessName, "process-name", "", "base name of the binary to send the TERM signal to on file change (eg. 'hyperkube').") + fs.StringVar(&o.PidFile, "pid-file", "", "file with the pid to send the TERM signal to on file change.") fs.StringSliceVar(&o.Files, "files", o.Files, "comma separated list of file names to monitor for changes") fs.StringVar(&o.KubeConfig, "kubeconfig", o.KubeConfig, "kubeconfig file or empty") fs.StringVar(&o.Namespace, "namespace", o.Namespace, "namespace to report the watchdog events") fs.DurationVar(&o.Interval, "interval", 5*time.Second, "interval specifying how aggressive the file checks should be") fs.DurationVar(&o.TerminationGracePeriod, "termination-grace-period", 30*time.Second, "interval specifying how long to wait until sending KILL signal to the process") + fs.StringVar(&o.ReadyFile, "ready-file", o.ReadyFile, "this file is touched when the watched files have been read initially (to avoid race between watchee and watcher)") } func (o *FileWatcherOptions) Complete() error { @@ -160,8 +170,8 @@ func (o *FileWatcherOptions) Complete() error { } func (o *FileWatcherOptions) Validate() error { - if len(o.ProcessName) == 0 { - return fmt.Errorf("process name must be specified") + if len(o.ProcessName) == 0 && len(o.PidFile) == 0 { + return fmt.Errorf("process name or pid file must be specified") } if len(o.Files) == 0 { return fmt.Errorf("at least one file to observe must be specified") @@ -179,10 +189,32 @@ func (o *FileWatcherOptions) runPidObserver(ctx context.Context, pidObservedCh c retries := 0 pollErr := wait.PollImmediateUntil(1*time.Second, func() (done bool, err error) { retries++ - // attempt to find the PID by process name via /proc - observedPID, found, err := o.findPidByNameFn(o.ProcessName) - if !found || err != nil { - klog.Warningf("Unable to determine PID for %q (retry: %d, err: %v)", o.ProcessName, retries, err) + observedPID := -1 + if len(o.ProcessName) > 0 { + // attempt to find the PID by process name via /proc + pid, found, err := o.findPidByNameFn(o.ProcessName) + if !found || err != nil { + klog.Warningf("Unable to determine PID for %q (retry: %d, err: %v)", o.ProcessName, retries, err) + } else { + observedPID = pid + } + } + if len(o.PidFile) > 0 { + // attempt to find the PID by pid file + bs, err := ioutil.ReadFile(o.PidFile) + if err != nil { + klog.Warningf("Unable to read pid file %s: %v", o.PidFile, err) + } else { + lines := strings.SplitN(string(bs), "\n", 2) + i, err := strconv.Atoi(lines[0]) + if err != nil { + klog.Warningf("Unable to parse pid file %s: %v", o.PidFile, err) + } else { + observedPID = i + } + } + } + if observedPID < 0 { return false, nil } @@ -293,7 +325,13 @@ func (o *FileWatcherOptions) runWatchdog(ctx context.Context) error { go o.runPidObserver(watchdogCtx, pidObservedCh) // Wait while we get the initial PID for the process - klog.Infof("Waiting for process %q PID ...", o.ProcessName) + if len(o.ProcessName) > 0 && len(o.PidFile) > 0 { + klog.Infof("Waiting for process with name %q or PID file %q...", o.ProcessName, o.PidFile) + } else if len(o.ProcessName) > 0 { + klog.Infof("Waiting for process with process name %q ...", o.ProcessName) + } else if len(o.PidFile) > 0 { + klog.Infof("Waiting for process PID file %q ...", o.PidFile) + } currentPID := <-pidObservedCh // Mutate path for specified files as '/proc/PID/root/' @@ -312,6 +350,14 @@ func (o *FileWatcherOptions) runWatchdog(ctx context.Context) error { o.recorder.Eventf("FileChangeWatchdogStarted", "Started watching files for process %s[%d]", o.ProcessName, currentPID) + if len(o.ReadyFile) > 0 { + f, err := os.Create(o.ReadyFile) + if err != nil { + return fmt.Errorf("cannot touch ready file %q: %v", o.ReadyFile, err) + } + f.Close() + } + observer, err := fileobserver.NewObserver(o.Interval) if err != nil { o.recorder.Warningf("ObserverFailed", "Failed to start to file observer: %v", err) diff --git a/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd_test.go b/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd_test.go index 8821e6457c..a3f302570e 100644 --- a/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd_test.go +++ b/vendor/github.com/openshift/library-go/pkg/operator/watchdog/cmd_test.go @@ -23,6 +23,7 @@ func TestPidObserver(t *testing.T) { } watcher := &FileWatcherOptions{ + ProcessName: "foo", findPidByNameFn: getProcessPIDByName, }