Skip to content

Commit 88655da

Browse files
Christoph Glaubitzpierreprinetti
authored andcommitted
Renamed providerConfig to providerSpec (openshift#112)
* Updated cluster-api for renaming ProviderConfig ... to ProviderSpec openshift#109 * Changed providerConfig to providerSpec also added two little railguards in the actuator, to not panic if there is no `providerSpec.Value`. In theory with this, it is possible to update the controller and edit existing manifests from `providerConfig` to `providerSpec`. * Fixed Gopkg.lock This resulted in removing a couple of corba license files
1 parent 12b8dcf commit 88655da

File tree

132 files changed

+3467
-2901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3467
-2901
lines changed

Gopkg.lock

Lines changed: 179 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/clusterctl/examples/openstack/centos/cluster.yaml.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ spec:
99
pods:
1010
cidrBlocks: ["192.168.0.0/16"]
1111
serviceDomain: "cluster.local"
12-
providerConfig:
12+
providerSpec:
1313
value:
1414
apiVersion: "openstackproviderconfig/v1alpha1"
15-
kind: "OpenstackProviderConfig"
15+
kind: "OpenstackProviderSpec"
1616

cmd/clusterctl/examples/openstack/centos/machines.yaml.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ items:
66
labels:
77
set: master
88
spec:
9-
providerConfig:
9+
providerSpec:
1010
value:
1111
apiVersion: "openstackproviderconfig/v1alpha1"
12-
kind: "OpenstackProviderConfig"
12+
kind: "OpenstackProviderSpec"
1313
flavor: m1.medium
1414
image: CentOS-7-x86_64-GenericCloud
1515
sshUserName: centos
@@ -29,10 +29,10 @@ items:
2929
labels:
3030
set: node
3131
spec:
32-
providerConfig:
32+
providerSpec:
3333
value:
3434
apiVersion: "openstackproviderconfig/v1alpha1"
35-
kind: "OpenstackProviderConfig"
35+
kind: "OpenstackProviderSpec"
3636
flavor: m1.medium
3737
image: CentOS-7-x86_64-GenericCloud
3838
sshUserName: centos

cmd/clusterctl/examples/openstack/ubuntu/cluster.yaml.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ spec:
99
pods:
1010
cidrBlocks: ["192.168.0.0/16"]
1111
serviceDomain: "cluster.local"
12-
providerConfig:
12+
providerSpec:
1313
value:
1414
apiVersion: "openstackproviderconfig/v1alpha1"
15-
kind: "OpenstackProviderConfig"
15+
kind: "OpenstackProviderSpec"
1616

cmd/clusterctl/examples/openstack/ubuntu/machines.yaml.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ items:
66
labels:
77
set: master
88
spec:
9-
providerConfig:
9+
providerSpec:
1010
value:
1111
apiVersion: "openstackproviderconfig/v1alpha1"
12-
kind: "OpenstackProviderConfig"
12+
kind: "OpenstackProviderSpec"
1313
flavor: m1.medium
1414
image: Ubuntu-Server-16.04-x64
1515
sshUserName: ubuntu
@@ -29,10 +29,10 @@ items:
2929
labels:
3030
set: node
3131
spec:
32-
providerConfig:
32+
providerSpec:
3333
value:
3434
apiVersion: "openstackproviderconfig/v1alpha1"
35-
kind: "OpenstackProviderConfig"
35+
kind: "OpenstackProviderSpec"
3636
flavor: m1.medium
3737
image: Ubuntu-Server-16.04-x64
3838
sshUserName: ubuntu

config/crd/openstackproviderconfig_v1alpha1.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ metadata:
44
creationTimestamp: null
55
labels:
66
controller-tools.k8s.io: "1.0"
7-
name: openstackproviderconfigs.openstackproviderconfig.k8s.io
7+
name: openstackproviderspecs.openstackproviderconfig.k8s.io
88
spec:
99
group: openstackproviderconfig.k8s.io
1010
names:
11-
kind: OpenstackProviderConfig
12-
plural: openstackproviderconfigs
11+
kind: OpenstackProviderSpec
12+
plural: openstackproviderspecs
1313
scope: Namespaced
1414
validation:
1515
openAPIV3Schema:

pkg/apis/openstackproviderconfig/v1alpha1/register.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
"errors"
21+
2022
"k8s.io/apimachinery/pkg/runtime"
2123
"k8s.io/apimachinery/pkg/runtime/schema"
2224
"k8s.io/apimachinery/pkg/util/json"
@@ -36,12 +38,16 @@ var (
3638
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
3739
)
3840

39-
func ClusterConfigFromProviderConfig(providerConfig clusterv1.ProviderConfig) (*OpenstackProviderConfig, error) {
40-
var config *OpenstackProviderConfig
41-
if err := yaml.Unmarshal(providerConfig.Value.Raw, &config); err != nil {
41+
func ClusterSpecFromProviderSpec(providerSpec clusterv1.ProviderSpec) (*OpenstackProviderSpec, error) {
42+
if providerSpec.Value == nil {
43+
return nil, errors.New("no such providerSpec found in manifest")
44+
}
45+
46+
var config OpenstackProviderSpec
47+
if err := yaml.Unmarshal(providerSpec.Value.Raw, &config); err != nil {
4248
return nil, err
4349
}
44-
return config, nil
50+
return &config, nil
4551
}
4652

4753
func ClusterStatusFromProviderStatus(extension *runtime.RawExtension) (*OpenstackClusterProviderStatus, error) {
@@ -57,11 +63,15 @@ func ClusterStatusFromProviderStatus(extension *runtime.RawExtension) (*Openstac
5763
return status, nil
5864
}
5965

60-
// This is the same as ClusterConfigFromProviderConfig but we
61-
// expect there to be a specific Config type for Machines soon
62-
func MachineConfigFromProviderConfig(providerConfig clusterv1.ProviderConfig) (*OpenstackProviderConfig, error) {
63-
var config OpenstackProviderConfig
64-
if err := yaml.Unmarshal(providerConfig.Value.Raw, &config); err != nil {
66+
// This is the same as ClusterSpecFromProviderSpec but we
67+
// expect there to be a specific Spec type for Machines soon
68+
func MachineSpecFromProviderSpec(providerSpec clusterv1.ProviderSpec) (*OpenstackProviderSpec, error) {
69+
if providerSpec.Value == nil {
70+
return nil, errors.New("no such providerSpec found in manifest")
71+
}
72+
73+
var config OpenstackProviderSpec
74+
if err := yaml.Unmarshal(providerSpec.Value.Raw, &config); err != nil {
6575
return nil, err
6676
}
6777
return &config, nil

pkg/apis/openstackproviderconfig/v1alpha1/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
24-
type OpenstackProviderConfig struct {
24+
type OpenstackProviderSpec struct {
2525
metav1.TypeMeta `json:",inline"`
2626
// The flavor reference for the flavor for your server instance.
2727
Flavor string `json:"flavor"`
@@ -97,5 +97,5 @@ type OpenstackClusterProviderStatus struct {
9797
}
9898

9999
func init() {
100-
SchemeBuilder.Register(&OpenstackProviderConfig{})
100+
SchemeBuilder.Register(&OpenstackProviderSpec{})
101101
}

pkg/apis/openstackproviderconfig/v1alpha1/zz_generated.deepcopy.go

Lines changed: 41 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cloud/openstack/clients/machineservice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func getNetworkIDsByFilter(is *InstanceService, opts *networks.ListOpts) ([]stri
179179
return []string{}, nil
180180
}
181181

182-
func (is *InstanceService) InstanceCreate(name string, config *openstackconfigv1.OpenstackProviderConfig, cmd string, keyName string) (instance *Instance, err error) {
182+
func (is *InstanceService) InstanceCreate(name string, config *openstackconfigv1.OpenstackProviderSpec, cmd string, keyName string) (instance *Instance, err error) {
183183
var createOpts servers.CreateOpts
184184
if config == nil {
185185
return nil, fmt.Errorf("create Options need be specified to create instace")

0 commit comments

Comments
 (0)