Skip to content

Commit

Permalink
UPSTREAM: <carry>: openshift: Drop ProviderSpec.ValueFrom field
Browse files Browse the repository at this point in the history
  • Loading branch information
enxebre authored and openshift-merge-robot committed Apr 29, 2019
1 parent 45d130d commit d8958b5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 142 deletions.
14 changes: 0 additions & 14 deletions config/crds/machine_v1beta1_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ spec:
their own versioned API types that should be serialized/deserialized
from this field, akin to component config.
type: object
valueFrom:
description: Source for the provider configuration. Cannot be used
if value is not empty.
properties:
machineClass:
description: The machine class from which the provider config
should be sourced.
properties:
provider:
description: Provider is the name of the cloud-provider
which MachineClass is intended for.
type: string
type: object
type: object
type: object
required:
- clusterNetwork
Expand Down
14 changes: 0 additions & 14 deletions config/crds/machine_v1beta1_machine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@ spec:
their own versioned API types that should be serialized/deserialized
from this field, akin to component config.
type: object
valueFrom:
description: Source for the provider configuration. Cannot be used
if value is not empty.
properties:
machineClass:
description: The machine class from which the provider config
should be sourced.
properties:
provider:
description: Provider is the name of the cloud-provider
which MachineClass is intended for.
type: string
type: object
type: object
type: object
taints:
description: Taints is the full, authoritative list of taints to apply
Expand Down
14 changes: 0 additions & 14 deletions config/crds/machine_v1beta1_machinedeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,6 @@ spec:
should be serialized/deserialized from this field, akin
to component config.
type: object
valueFrom:
description: Source for the provider configuration. Cannot
be used if value is not empty.
properties:
machineClass:
description: The machine class from which the provider
config should be sourced.
properties:
provider:
description: Provider is the name of the cloud-provider
which MachineClass is intended for.
type: string
type: object
type: object
type: object
taints:
description: Taints is the full, authoritative list of taints
Expand Down
14 changes: 0 additions & 14 deletions config/crds/machine_v1beta1_machineset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,6 @@ spec:
should be serialized/deserialized from this field, akin
to component config.
type: object
valueFrom:
description: Source for the provider configuration. Cannot
be used if value is not empty.
properties:
machineClass:
description: The machine class from which the provider
config should be sourced.
properties:
provider:
description: Provider is the name of the cloud-provider
which MachineClass is intended for.
type: string
type: object
type: object
type: object
taints:
description: Taints is the full, authoritative list of taints
Expand Down
26 changes: 1 addition & 25 deletions pkg/apis/machine/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ limitations under the License.
package v1beta1

import (
corev1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
)

// ProviderSpec defines the configuration to use during node creation.
Expand All @@ -32,27 +31,4 @@ type ProviderSpec struct {
// field, akin to component config.
// +optional
Value *runtime.RawExtension `json:"value,omitempty"`

// Source for the provider configuration. Cannot be used if value is
// not empty.
// +optional
ValueFrom *ProviderSpecSource `json:"valueFrom,omitempty"`
}

// ProviderSpecSource represents a source for the provider-specific
// resource configuration.
type ProviderSpecSource struct {
// The machine class from which the provider config should be sourced.
// +optional
MachineClass *MachineClassRef `json:"machineClass,omitempty"`
}

// MachineClassRef is a reference to the MachineClass object. Controllers should find the right MachineClass using this reference.
type MachineClassRef struct {
// +optional
*corev1.ObjectReference `json:",inline"`

// Provider is the name of the cloud-provider which MachineClass is intended for.
// +optional
Provider string `json:"provider,omitempty"`
}
4 changes: 2 additions & 2 deletions pkg/apis/machine/v1beta1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ func (m *Machine) Validate() field.ErrorList {
}

// validate provider config is set
if m.Spec.ProviderSpec.Value == nil && m.Spec.ProviderSpec.ValueFrom == nil {
errors = append(errors, field.Invalid(fldPath.Child("spec").Child("providerspec"), m.Spec.ProviderSpec, "at least one of value or valueFrom fields must be set"))
if m.Spec.ProviderSpec.Value == nil {
errors = append(errors, field.Invalid(fldPath.Child("spec").Child("providerspec"), m.Spec.ProviderSpec, "value field must be set"))
}

return errors
Expand Down
47 changes: 0 additions & 47 deletions pkg/apis/machine/v1beta1/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions pkg/controller/machine/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ go_test(
"//pkg/controller/error:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
Expand Down
20 changes: 8 additions & 12 deletions pkg/controller/machine/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"reflect"
"testing"

"k8s.io/apimachinery/pkg/runtime"

"github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
"github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -49,10 +51,8 @@ func TestReconcileRequest(t *testing.T) {
},
Spec: v1beta1.MachineSpec{
ProviderSpec: v1beta1.ProviderSpec{
ValueFrom: &v1beta1.ProviderSpecSource{
MachineClass: &v1beta1.MachineClassRef{
Provider: "no-provider",
},
Value: &runtime.RawExtension{
Raw: []byte("{}"),
},
},
},
Expand All @@ -72,10 +72,8 @@ func TestReconcileRequest(t *testing.T) {
},
Spec: v1beta1.MachineSpec{
ProviderSpec: v1beta1.ProviderSpec{
ValueFrom: &v1beta1.ProviderSpecSource{
MachineClass: &v1beta1.MachineClassRef{
Provider: "no-provider",
},
Value: &runtime.RawExtension{
Raw: []byte("{}"),
},
},
},
Expand All @@ -97,10 +95,8 @@ func TestReconcileRequest(t *testing.T) {
},
Spec: v1beta1.MachineSpec{
ProviderSpec: v1beta1.ProviderSpec{
ValueFrom: &v1beta1.ProviderSpecSource{
MachineClass: &v1beta1.MachineClassRef{
Provider: "no-provider",
},
Value: &runtime.RawExtension{
Raw: []byte("{}"),
},
},
},
Expand Down

0 comments on commit d8958b5

Please sign in to comment.