Skip to content

Commit

Permalink
Merge pull request #222 from hardikdr/cmi-client
Browse files Browse the repository at this point in the history
Remove foot prints of provider-specific machineclasses
  • Loading branch information
hardikdr authored Feb 15, 2019
2 parents cfb2596 + 7c0126c commit 4da5d62
Show file tree
Hide file tree
Showing 1,103 changed files with 29,970 additions and 298,271 deletions.
479 changes: 79 additions & 400 deletions Gopkg.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ start:

.PHONY: revendor
revendor:
@dep ensure -update
@dep ensure -update -v

.PHONY: build
build:
Expand Down
16 changes: 2 additions & 14 deletions cmd/machine-controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ const (
controllerDiscoveryAgentName = "machine-controller-discovery"
)

var openStackGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "openstackmachineclasses"}
var awsGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "awsmachineclasses"}
var azureGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "azuremachineclasses"}
var gcpGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "gcpmachineclasses"}
var alicloudGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "alicloudmachineclasses"}
var packetGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "packetmachineclasses"}
var machineclassGVR = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "machineclasses"}

// Run runs the MCMServer. This should never exit.
Expand Down Expand Up @@ -223,7 +217,7 @@ func StartControllers(s *options.MCMServer,
glog.Fatal(err)
}

if availableResources[awsGVR] || availableResources[azureGVR] || availableResources[gcpGVR] || availableResources[openStackGVR] || availableResources[alicloudGVR] || availableResources[packetGVR] || availableResources[machineclassGVR] {
if availableResources[machineclassGVR] {
glog.V(5).Infof("Creating shared informers; resync interval: %v", s.MinResyncPeriod)

controlMachineInformerFactory := machineinformers.NewFilteredSharedInformerFactory(
Expand Down Expand Up @@ -256,12 +250,6 @@ func StartControllers(s *options.MCMServer,
targetCoreClient,
controlCoreInformerFactory.Core().V1().Secrets(),
targetCoreInformerFactory.Core().V1().Nodes(),
machineSharedInformers.OpenStackMachineClasses(),
machineSharedInformers.AWSMachineClasses(),
machineSharedInformers.AzureMachineClasses(),
machineSharedInformers.GCPMachineClasses(),
machineSharedInformers.AlicloudMachineClasses(),
machineSharedInformers.PacketMachineClasses(),
machineSharedInformers.MachineClasses(),
machineSharedInformers.Machines(),
machineSharedInformers.MachineSets(),
Expand All @@ -282,7 +270,7 @@ func StartControllers(s *options.MCMServer,
go machineController.Run(int(s.ConcurrentNodeSyncs), stop)

} else {
return fmt.Errorf("unable to start machine controller: API GroupVersion %q or %q or %q or %q or %q or %q is not available; found %#v", awsGVR, azureGVR, gcpGVR, openStackGVR, alicloudGVR, packetGVR, availableResources)
return fmt.Errorf("unable to start machine controller: API GroupVersion %q is not available; found %#v", machineclassGVR, availableResources)
}

select {}
Expand Down
102 changes: 0 additions & 102 deletions kubernetes/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,108 +17,6 @@ spec:

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: openstackmachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: OpenStackMachineClass
plural: openstackmachineclasses
singular: openstackmachineclass
shortNames:
- oscls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: awsmachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: AWSMachineClass
plural: awsmachineclasses
singular: awsmachineclass
shortNames:
- awscls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: azuremachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: AzureMachineClass
plural: azuremachineclasses
singular: azuremachineclass
shortNames:
- azurecls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: gcpmachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: GCPMachineClass
plural: gcpmachineclasses
singular: gcpmachineclass
shortNames:
- gcpcls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: alicloudmachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: AlicloudMachineClass
plural: alicloudmachineclasses
singular: alicloudmachineclass
shortNames:
- alicloudcls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: packetmachineclasses.machine.sapcloud.io
spec:
group: machine.sapcloud.io
version: v1alpha1
scope: Namespaced
names:
kind: PacketMachineClass
plural: packetmachineclasses
singular: packetmachineclass
shortNames:
- packetcls

---

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand Down
6 changes: 0 additions & 6 deletions kubernetes/deployment/control-cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ rules:
- apiGroups:
- machine.sapcloud.io
resources:
- awsmachineclasses
- azuremachineclasses
- gcpmachineclasses
- openstackmachineclasses
- alicloudmachineclasses
- packetmachineclasses
- machineclasses
- machinedeployments
- machines
Expand Down
11 changes: 6 additions & 5 deletions kubernetes/machine_classes/alicloud-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sample Alicloud machine class

apiVersion: machine.sapcloud.io/v1alpha1
kind: AlicloudMachineClass
kind: MachineClass
metadata:
name: test-alicloud # Name of Alicloud machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
imageID: coreos_1745_7_0_64_30G_alibase_20180705.vhd # Alicloud machine image name goes here, e.g. centos_7_04_64_20G_alibase_201701015
instanceType: ecs.n1.medium # Type of ecs machine ecs.t5-lc1m1.small ecs.t5-lc2m1.nano
region: cn-hangzhou # Region in which machine is to be deployed
Expand All @@ -26,6 +26,7 @@ spec:
tag1: tag1-value # A set of additional tags attached to a machine (optional)
tag2: tag2-value # A set of additional tags attached to a machine (optional)
keyPairName: test-keypair # keypair used to access Alicloud ECS machine
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
provider: aliclouddriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080
11 changes: 6 additions & 5 deletions kubernetes/machine_classes/aws-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sample AWS machine class

apiVersion: machine.sapcloud.io/v1alpha1
kind: AWSMachineClass
kind: MachineClass
metadata:
name: test-aws # Name of aws machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
ami: ami-123456 # Amazon machine image name goes here
region: eu-east-1 # Region in which machine is to be deployed
machineType: t2.large # Type of ec2 machine
Expand All @@ -21,10 +21,11 @@ spec:
kubernetes.io/role/YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by by this controller.
tag1: tag1-value # A set of additional tags attached to a machine (optional)
tag2: tag2-value # A set of additional tags attached to a machine (optional)
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
blockDevices:
- ebs:
volumeSize: 50 # Size of the root block device
volumeType: gp2 # Type of the root block device
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
provider: awsdriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080
11 changes: 6 additions & 5 deletions kubernetes/machine_classes/azure-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Sample Azure machine class

apiVersion: machine.sapcloud.io/v1alpha1
kind: AzureMachineClass
kind: MachineClass
metadata:
name: test-azure # Name of Azure machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
location: "sample-location" # Azure location in which machine is to be deployed (Eg- NorthAmerica)
resourceGroup: "sample-resource-group" # Name of the resource group to which the node should be bound
subnetInfo:
vnetName: "sample-vnet" # The V-Net to which the node should belong
subnetName: "sample-subnet-in-given-vnet" # The subnet to which the node should belong
secretRef: # Kubernetes secret containing values for provider secrets and user-data
name: "test-secret" # Name of the secret
namespace: "default" # Namespace of secret
tags:
kubernetes.io-cluster-YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
kubernetes.io-role-YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
Expand Down Expand Up @@ -42,3 +39,7 @@ spec:
keyData: "public-key-data" # Public key data
availabilitySet:
id: "/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.Compute/availabilitySets/availablity-set-name" # ID of availability set to attach the machine to
secretRef: # Kubernetes secret containing values for provider secrets and user-data
name: "test-secret" # Name of the secret
namespace: "default" # Namespace of secret
provider: azuredriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080
13 changes: 7 additions & 6 deletions kubernetes/machine_classes/gcp-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sample GCP machine class

apiVersion: machine.sapcloud.io/v1alpha1 # API version of object
kind: GCPMachineClass # Machine Class Kind
apiVersion: machine.sapcloud.io/v1alpha1
kind: MachineClass
metadata:
name: test-gcp # Name of GCP machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
canIpForward: true # Allows this instance to send and receive packets with non-matching destination or source IPs
deletionProtection: false # DeletionProtection: Whether the resource should be protected against deletion
description: An optional description for machines created by that class. # Description of this resource
Expand All @@ -30,9 +30,6 @@ spec:
automaticRestart: true # Automatic restart of instance
onHostMaintenance: MIGRATE # Host maintainance
preemptible: false # Instance is premeptiable
secretRef: # Kubernetes secret containing values for provider secrets and user-data
name: "test-secret" # Name of the secret
namespace: "default" # Namespace of secret
serviceAccounts:
- email: [email protected] # Service account email
scopes: # List of scopes
Expand All @@ -44,3 +41,7 @@ spec:
- key2 # A set of additional tags attached to a machine (optional)
region: europe-west1 # Region to attach the instance
zone: europe-west1-b # Zone to attach the instance
secretRef: # Kubernetes secret containing values for provider secrets and user-data
name: "test-secret" # Name of the secret
namespace: "default" # Namespace of secret
provider: gcpdriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080
12 changes: 7 additions & 5 deletions kubernetes/machine_classes/openstack-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sample OpenStack machine class

apiVersion: machine.sapcloud.io/v1alpha1
kind: OpenStackMachineClass
kind: MachineClass
metadata:
name: test-openstack # Name of OpenStack machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
flavorName: <flavor_name> # Name of the machine flavor
keyName: <keypair_name> # Name of the ssh key pair
imageName: <image_name> # Machine image name
Expand All @@ -22,6 +22,8 @@ spec:
kubernetes.io-role-YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
tag1: tag1-value # A set of additional tags attached to a machine (optional)
tag2: tag2-value # A set of additional tags attached to a machine (optional)
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
provider: osdriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080

11 changes: 6 additions & 5 deletions kubernetes/machine_classes/packet-machine-class.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sample Packet machine class

apiVersion: machine.sapcloud.io/v1alpha1
kind: PacketMachineClass
kind: MachineClass
metadata:
name: test-packet # Name of packet machine class goes here
namespace: default # Namespace in which the machine class is to be deployed
spec:
providerSpec:
projectID: f40c6787-5ac0-657e-9fe4-62d433c5df11 # UUID of a project with which you have rights
OS: alpine_3 # OS ID or slug goes here
facility:
Expand All @@ -18,6 +18,7 @@ spec:
kubernetes.io/role/YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by by this controller.
tag1: tag1-value # A set of additional tags attached to a machine (optional)
tag2: tag2-value # A set of additional tags attached to a machine (optional)
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
namespace: default # Namespace
name: test-secret # Name of the secret
provider: packetdriver//127.0.0.1:8080 # Provider information of gRPC driver. Default: grpc-default-driver//127.0.0.1:8080
4 changes: 2 additions & 2 deletions kubernetes/machine_objects/machine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ spec:
test-label: test-label # Label to match with selector (XXXXX)
spec:
class:
kind: AWSMachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
name: test-aws # Name of the machine class
kind: MachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
name: test-cloud # Name of the machine class
4 changes: 2 additions & 2 deletions kubernetes/machine_objects/machine-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ spec:
test-label: test-label # Label to match the selector (XXXXX)
spec:
class:
kind: AWSMachineClass
name: test-aws
kind: MachineClass
name: test-cloud
4 changes: 2 additions & 2 deletions kubernetes/machine_objects/machine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ metadata:
test-label: test-label # Label used by machine-set to match (optional)
spec:
class:
kind: AWSMachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
name: test-aws # Name of the machine class
kind: MachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
name: test-cloud # Name of the machine class
18 changes: 0 additions & 18 deletions pkg/apis/machine/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,6 @@ var (

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&OpenStackMachineClass{},
&OpenStackMachineClassList{},

&AWSMachineClass{},
&AWSMachineClassList{},

&AzureMachineClass{},
&AzureMachineClassList{},

&GCPMachineClass{},
&GCPMachineClassList{},

&AlicloudMachineClass{},
&AlicloudMachineClassList{},

&PacketMachineClass{},
&PacketMachineClassList{},

&MachineClass{},
&MachineClassList{},

Expand Down
Loading

0 comments on commit 4da5d62

Please sign in to comment.