Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest cluster API #58

Merged
merged 4 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 20 additions & 2 deletions Gopkg.lock

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

4 changes: 2 additions & 2 deletions cmd/clusterctl/examples/google/cluster.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ spec:
pods:
cidrBlocks: ["192.168.0.0/16"]
serviceDomain: "cluster.local"
providerConfig:
providerSpec:
value:
apiVersion: "gceproviderconfig/v1alpha1"
kind: "GCEClusterProviderConfig"
kind: "GCEClusterProviderSpec"
project: "$GCLOUD_PROJECT"
8 changes: 4 additions & 4 deletions cmd/clusterctl/examples/google/machines.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ items:
labels:
set: master
spec:
providerConfig:
providerSpec:
value:
apiVersion: "gceproviderconfig/v1alpha1"
kind: "GCEMachineProviderConfig"
kind: "GCEMachineProviderSpec"
roles:
- Master
zone: "$ZONE"
Expand All @@ -29,10 +29,10 @@ items:
labels:
set: node
spec:
providerConfig:
providerSpec:
value:
apiVersion: "gceproviderconfig/v1alpha1"
kind: "GCEMachineProviderConfig"
kind: "GCEMachineProviderSpec"
roles:
- Node
zone: "$ZONE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: gceclusterproviderconfigs.gceproviderconfig.k8s.io
name: gceclusterproviderspecs.gceproviderconfig.k8s.io
spec:
group: gceproviderconfig.k8s.io
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should try to have something to do with cluster api in there, and try to be less specific about config.

e.g. cluster-api is cluster.k8s.io - should we be gce.cluster.k8s.io ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to discuss that (the name was just taken verbotem from what we used pre-CRDs, but not that it's more visible to users, it's worth revisiting). Can you open a separate issue though, since bikeshedding on the resource name here isn't going to be very useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #75

names:
kind: GCEClusterProviderConfig
plural: gceclusterproviderconfigs
kind: GCEClusterProviderSpec
plural: gceclusterproviderspecs
scope: Namespaced
validation:
openAPIV3Schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: gcemachineproviderconfigs.gceproviderconfig.k8s.io
name: gcemachineproviderspecs.gceproviderconfig.k8s.io
spec:
group: gceproviderconfig.k8s.io
names:
kind: GCEMachineProviderConfig
plural: gcemachineproviderconfigs
kind: GCEMachineProviderSpec
plural: gcemachineproviderspecs
scope: Namespaced
validation:
openAPIV3Schema:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: gceproviderconfig.k8s.io/v1alpha1
kind: GCEClusterProviderConfig
kind: GCEClusterProviderSpec
metadata:
labels:
controller-tools.k8s.io: "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: gceproviderconfig.k8s.io/v1alpha1
kind: GCEMachineProviderConfig
kind: GCEMachineProviderSpec
metadata:
labels:
controller-tools.k8s.io: "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// GCEClusterProviderConfig is the Schema for the gceclusterproviderconfigs API
// GCEClusterProviderSpec is the Schema for the gceclusterproviderconfigs API
// +k8s:openapi-gen=true
type GCEClusterProviderConfig struct {
type GCEClusterProviderSpec struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Expand All @@ -34,13 +34,13 @@ type GCEClusterProviderConfig struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// GCEClusterProviderConfigList contains a list of GCEClusterProviderConfig
type GCEClusterProviderConfigList struct {
// GCEClusterProviderSpecList contains a list of GCEClusterProviderSpec
type GCEClusterProviderSpecList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GCEClusterProviderConfig `json:"items"`
Items []GCEClusterProviderSpec `json:"items"`
}

func init() {
SchemeBuilder.Register(&GCEClusterProviderConfig{}, &GCEClusterProviderConfigList{})
SchemeBuilder.Register(&GCEClusterProviderSpec{}, &GCEClusterProviderSpecList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"k8s.io/apimachinery/pkg/types"
)

func TestStorageGCEClusterProviderConfig(t *testing.T) {
func TestStorageGCEClusterProviderSpec(t *testing.T) {
key := types.NamespacedName{Name: "foo", Namespace: "default"}
created := &GCEClusterProviderConfig{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}}
created := &GCEClusterProviderSpec{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}}

// Test Create
fetched := &GCEClusterProviderConfig{}
fetched := &GCEClusterProviderSpec{}
if err := c.Create(context.TODO(), created); err != nil {
t.Fatal(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// GCEMachineProviderConfig is the Schema for the gcemachineproviderconfigs API
// GCEMachineProviderSpec is the Schema for the gcemachineproviderconfigs API
// +k8s:openapi-gen=true
type GCEMachineProviderConfig struct {
type GCEMachineProviderSpec struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Expand Down Expand Up @@ -76,13 +76,13 @@ type DiskInitializeParams struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// GCEMachineProviderConfigList contains a list of GCEMachineProviderConfig
type GCEMachineProviderConfigList struct {
// GCEMachineProviderSpecList contains a list of GCEMachineProviderSpec
type GCEMachineProviderSpecList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GCEMachineProviderConfig `json:"items"`
Items []GCEMachineProviderSpec `json:"items"`
}

func init() {
SchemeBuilder.Register(&GCEMachineProviderConfig{}, &GCEMachineProviderConfigList{})
SchemeBuilder.Register(&GCEMachineProviderSpec{}, &GCEMachineProviderSpecList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"k8s.io/apimachinery/pkg/types"
)

func TestStorageGCEMachineProviderConfig(t *testing.T) {
func TestStorageGCEMachineProviderSpec(t *testing.T) {
key := types.NamespacedName{Name: "foo", Namespace: "default"}
created := &GCEMachineProviderConfig{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}}
created := &GCEMachineProviderSpec{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}}

// Test Create
fetched := &GCEMachineProviderConfig{}
fetched := &GCEMachineProviderSpec{}
if err := c.Create(context.TODO(), created); err != nil {
t.Fatal(err)
}
Expand Down
44 changes: 22 additions & 22 deletions pkg/apis/gceproviderconfig/v1alpha1/zz_generated.deepcopy.go

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

8 changes: 4 additions & 4 deletions pkg/cloud/google/clusteractuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func (gce *GCEClusterClient) createFirewallRuleIfNotExists(cluster *clusterv1.Cl
// The firewall rule was already created.
return nil
}
clusterConfig, err := clusterProviderFromProviderConfig(cluster.Spec.ProviderConfig)
clusterConfig, err := clusterProviderFromProviderSpec(cluster.Spec.ProviderSpec)
if err != nil {
return fmt.Errorf("error parsing cluster provider config: %v", err)
return fmt.Errorf("error parsing cluster provider spec: %v", err)
}
firewallRules, err := gce.computeService.FirewallsGet(clusterConfig.Project)
if err != nil {
Expand Down Expand Up @@ -165,9 +165,9 @@ func (gce *GCEClusterClient) containsFirewallRule(firewallRules *compute.Firewal
}

func (gce *GCEClusterClient) deleteFirewallRule(cluster *clusterv1.Cluster, ruleName string) error {
clusterConfig, err := clusterProviderFromProviderConfig(cluster.Spec.ProviderConfig)
clusterConfig, err := clusterProviderFromProviderSpec(cluster.Spec.ProviderSpec)
if err != nil {
return fmt.Errorf("error parsing cluster provider config: %v", err)
return fmt.Errorf("error parsing cluster provider spec: %v", err)
}
op, err := gce.computeService.FirewallsDelete(clusterConfig.Project, ruleName)
if err != nil {
Expand Down