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

Dead Code Removal https://github.com/gardener/machine-controller-man… #769

Merged
merged 19 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bbcffe1
Regeneration of pkg/client - clientset/informers/listenrs
elankath Jan 19, 2023
9733969
Added tags and docs/docs to gitignore
elankath Jan 19, 2023
9215434
Removal of dead/deprecated options for MCM binary
elankath Jan 19, 2023
d66d62f
Removal of deprecated api and its validation code
elankath Jan 19, 2023
80639c6
Removal of provider specific CRD's, machine classes and openapi gener…
elankath Jan 19, 2023
2820b53
Removal of old machine controller code under `pkg/controller`
elankath Jan 19, 2023
cd197ce
Removal of driver migrate method, migration code. Marked safey option…
elankath Jan 19, 2023
1bd9364
Remove old machine-controller-manager-cli binary which is no longer u…
elankath Jan 19, 2023
fb681f2
Some more deprecated options and informers removed
elankath Jan 19, 2023
9fd889b
Unused constants and functions
elankath Jan 19, 2023
e6a1bd8
old drivers removed.
elankath Jan 19, 2023
47d9bc8
Removed dead in-tree reference from readme's
elankath Jan 27, 2023
21d76a3
Removed in-tree refs, old secrets, old yaml and updated docs
elankath Jan 27, 2023
fb13332
removed pv,pvc and secret lister/informers from MCM controller
elankath Jan 27, 2023
ff4c295
refactored controllers to use common worker in `util/worker/worker.go…
elankath Jan 27, 2023
40e4ed7
removed old flags from deployment.yaml
elankath Jan 27, 2023
5259c39
fixed import order and queue name in doc
elankath Jan 27, 2023
e6143bb
fixed import order in machinecontroller.go
elankath Jan 27, 2023
7f35702
added docu comment for worker.DefaultMaxRetries
elankath Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ kubectl

# Output of the go coverage tool, specifically when used with LiteIDE
*coverprofile.out*

# Autogen tags
tags
docs/docs
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ start:
--namespace=${CONTROL_NAMESPACE} \
--safety-up=2 \
--safety-down=1 \
--machine-creation-timeout=20m \
--machine-drain-timeout=5m \
--machine-pv-detach-timeout=2m \
--machine-health-timeout=10m \
--machine-safety-apiserver-statuscheck-timeout=30s \
--machine-safety-apiserver-statuscheck-period=1m \
--machine-safety-orphan-vms-period=30m \
--machine-safety-overshooting-period=$(MACHINE_SAFETY_OVERSHOOTING_PERIOD) \
--leader-elect=$(LEADER_ELECT) \
--v=3
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[![CI Build status](https://concourse.ci.gardener.cloud/api/v1/teams/gardener/pipelines/machine-controller-manager-master/jobs/master-head-update-job/badge)](https://concourse.ci.gardener.cloud/teams/gardener/pipelines/machine-controller-manager-master/jobs/master-head-update-job)
[![Go Report Card](https://goreportcard.com/badge/github.com/gardener/machine-controller-manager)](https://goreportcard.com/report/github.com/gardener/machine-controller-manager)

:warning: We are in the progress of migrating and deprecating all the in-tree providers to OOT. Please avoid making any new feature enhancements to the intree providers. Kindly make it on the [OOT providers available here](https://github.com/gardener/?q=machine-controller-manager-provider&type=&language=). More details on adding [new OOT providers can be found here](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md).
**Note**
One can add support for a new cloud provider by following [Adding support for new provider](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md).

# Overview

Expand Down Expand Up @@ -87,7 +88,7 @@ See [here](docs/documents/apis.md) for CRD API Documentation
<tbody>
<tr>
<td>MachineDeployment controller</td>
<td>Machine Deployment controller reconciles the <code>MachineDeployment</code> objects and manages the lifecycle of <code>MachineSet</code> objects. <code>MachineDeployment</code> consumes provider specific <code>MachineClass` in its <code>spec.template.spec</code> which is the template of the VM spec that would be spawned on the cloud by MCM.</td>
<td>Machine Deployment controller reconciles the <code>MachineDeployment</code> objects and manages the lifecycle of <code>MachineSet</code> objects. <code>MachineDeployment</code> consumes provider specific <code>MachineClass</code> in its <code>spec.template.spec</code> which is the template of the VM spec that would be spawned on the cloud by MCM.</td>
</tr>
<tr>
<td>MachineSet controller</td>
Expand Down
129 changes: 0 additions & 129 deletions cmd/machine-controller-manager-cli/main.go

This file was deleted.

20 changes: 4 additions & 16 deletions cmd/machine-controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,29 +254,17 @@ func StartControllers(s *options.MCMServer,
machineSharedInformers := controlMachineInformerFactory.Machine().V1alpha1()

klog.V(5).Infof("Creating controllers...")
mcmcontroller, err := mcmcontroller.NewController(
mcmController, err := mcmcontroller.NewController(
s.Namespace,
controlMachineClient,
controlCoreClient,
targetCoreClient,
targetCoreInformerFactory.Core().V1().PersistentVolumeClaims(),
targetCoreInformerFactory.Core().V1().PersistentVolumes(),
controlCoreInformerFactory.Core().V1().Secrets(),
targetCoreInformerFactory.Core().V1().Nodes(),
machineSharedInformers.OpenStackMachineClasses(),
machineSharedInformers.AWSMachineClasses(),
machineSharedInformers.AzureMachineClasses(),
machineSharedInformers.GCPMachineClasses(),
machineSharedInformers.AlicloudMachineClasses(),
machineSharedInformers.PacketMachineClasses(),
machineSharedInformers.Machines(),
machineSharedInformers.MachineSets(),
machineSharedInformers.MachineDeployments(),
recorder,
s.SafetyOptions,
s.NodeConditions,
s.BootstrapTokenAuthExtraGroups,
s.DeleteMigratedMachineClass,
s.AutoscalerScaleDownAnnotationDuringRollout,
)
if err != nil {
Expand All @@ -289,7 +277,7 @@ func StartControllers(s *options.MCMServer,
targetCoreInformerFactory.Start(stop)

klog.V(5).Info("Running controller")
go mcmcontroller.Run(int(s.ConcurrentNodeSyncs), stop)
go mcmController.Run(int(s.ConcurrentNodeSyncs), stop)

} else {
return fmt.Errorf("unable to start machine controller: API GroupVersion %q or %q or %q is not available; \nFound: %#v", machineGVR, machineSetGVR, machineDeploymentGVR, availableResources)
Expand Down Expand Up @@ -342,12 +330,12 @@ func getAvailableResources(clientBuilder corecontroller.ClientBuilder) (map[sche

allResources := map[schema.GroupVersionResource]bool{}
for _, apiResourceList := range resourceMap {
version, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)
v, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)
if err != nil {
return nil, err
}
for _, apiResource := range apiResourceList.APIResources {
allResources[version.WithResource(apiResource.Name)] = true
allResources[v.WithResource(apiResource.Name)] = true
}
}

Expand Down
28 changes: 3 additions & 25 deletions cmd/machine-controller-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (

"github.com/gardener/machine-controller-manager/pkg/util/client/leaderelectionconfig"

"github.com/gardener/machine-controller-manager/pkg/controller"
// add the machine feature gates
_ "github.com/gardener/machine-controller-manager/pkg/features"
)
Expand All @@ -56,25 +55,16 @@ func NewMCMServer() *MCMServer {
Address: "0.0.0.0",
ConcurrentNodeSyncs: 10,
ContentType: "application/vnd.kubernetes.protobuf",
NodeConditions: "KernelDeadlock,ReadonlyFilesystem,DiskPressure,NetworkUnavailable",
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
KubeAPIQPS: 20.0,
KubeAPIBurst: 30,
LeaderElection: leaderelectionconfig.DefaultLeaderElectionConfiguration(),
ControllerStartInterval: metav1.Duration{Duration: 0 * time.Second},
AutoscalerScaleDownAnnotationDuringRollout: true,
SafetyOptions: machineconfig.SafetyOptions{
SafetyUp: 2,
SafetyDown: 1,
MachineCreationTimeout: metav1.Duration{Duration: 20 * time.Minute},
MachineHealthTimeout: metav1.Duration{Duration: 10 * time.Minute},
MachineDrainTimeout: metav1.Duration{Duration: controller.DefaultMachineDrainTimeout},
MaxEvictRetries: controller.DefaultMaxEvictRetries,
PvDetachTimeout: metav1.Duration{Duration: 2 * time.Minute},
MachineSafetyOrphanVMsPeriod: metav1.Duration{Duration: 30 * time.Minute},
MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
MachineSafetyAPIServerStatusCheckPeriod: metav1.Duration{Duration: 1 * time.Minute},
MachineSafetyAPIServerStatusCheckTimeout: metav1.Duration{Duration: 30 * time.Second},
SafetyUp: 2,
SafetyDown: 1,
MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
},
},
}
Expand Down Expand Up @@ -102,19 +92,7 @@ func (s *MCMServer) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&s.SafetyOptions.SafetyUp, "safety-up", s.SafetyOptions.SafetyUp, "The number of excess machine objects permitted for any machineSet/machineDeployment beyond its expected number of replicas based on desired and max-surge, we call this the upper-limit. When this upper-limit is reached, the objects are temporarily frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.")
fs.Int32Var(&s.SafetyOptions.SafetyDown, "safety-down", s.SafetyOptions.SafetyDown, "Upper-limit minus safety-down value gives the lower-limit. This is the limits below which any temporarily frozen machineSet/machineDeployment object is unfrozen. lower-limit = desired + maxSurge (if applicable) + safetyUp - safetyDown.")

fs.DurationVar(&s.SafetyOptions.MachineCreationTimeout.Duration, "machine-creation-timeout", s.SafetyOptions.MachineCreationTimeout.Duration, "Timeout (in duration) used while joining (during creation) of machine before it is declared as failed.")
fs.DurationVar(&s.SafetyOptions.MachineHealthTimeout.Duration, "machine-health-timeout", s.SafetyOptions.MachineHealthTimeout.Duration, "Timeout (in duration) used while re-joining (in case of temporary health issues) of machine before it is declared as failed.")
fs.DurationVar(&s.SafetyOptions.MachineDrainTimeout.Duration, "machine-drain-timeout", controller.DefaultMachineDrainTimeout, "Timeout (in duration) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.")
fs.Int32Var(&s.SafetyOptions.MaxEvictRetries, "machine-max-evict-retries", controller.DefaultMaxEvictRetries, "Maximum number of times evicts would be attempted on a pod before it is forcibly deleted during draining of a machine.")
fs.DurationVar(&s.SafetyOptions.PvDetachTimeout.Duration, "machine-pv-detach-timeout", s.SafetyOptions.PvDetachTimeout.Duration, "Timeout (in duration) used while waiting for detach of PV while evicting/deleting pods")
fs.DurationVar(&s.SafetyOptions.MachineSafetyAPIServerStatusCheckTimeout.Duration, "machine-safety-apiserver-statuscheck-timeout", s.SafetyOptions.MachineSafetyAPIServerStatusCheckTimeout.Duration, "Timeout (in duration) for which the APIServer can be down before declare the machine controller frozen by safety controller")

fs.DurationVar(&s.SafetyOptions.MachineSafetyOrphanVMsPeriod.Duration, "machine-safety-orphan-vms-period", s.SafetyOptions.MachineSafetyOrphanVMsPeriod.Duration, "Time period (in duration) used to poll for orphan VMs by safety controller.")
fs.DurationVar(&s.SafetyOptions.MachineSafetyOvershootingPeriod.Duration, "machine-safety-overshooting-period", s.SafetyOptions.MachineSafetyOvershootingPeriod.Duration, "Time period (in duration) used to poll for overshooting of machine objects backing a machineSet by safety controller.")
fs.DurationVar(&s.SafetyOptions.MachineSafetyAPIServerStatusCheckPeriod.Duration, "machine-safety-apiserver-statuscheck-period", s.SafetyOptions.MachineSafetyAPIServerStatusCheckPeriod.Duration, "Time period (in duration) used to poll for APIServer's health by safety controller")
fs.StringVar(&s.NodeConditions, "node-conditions", s.NodeConditions, "List of comma-separated/case-sensitive node-conditions which when set to True will change machine to a failed state after MachineHealthTimeout duration. It may further be replaced with a new machine if the machine is backed by a machine-set object.")
fs.StringVar(&s.BootstrapTokenAuthExtraGroups, "bootstrap-token-auth-extra-groups", s.BootstrapTokenAuthExtraGroups, "Comma-separated list of groups to set bootstrap token's \"auth-extra-groups\" field to")
fs.BoolVar(&s.DeleteMigratedMachineClass, "delete-migrated-machine-class", false, "Deletes any (provider specific) machine class that has the machine.sapcloud.io/migrated annotation")

fs.BoolVar(&s.AutoscalerScaleDownAnnotationDuringRollout, "autoscaler-scaldown-annotation-during-rollout", true, "Add cluster autoscaler scale-down disabled annotation during roll-out.")

Expand Down
4 changes: 2 additions & 2 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ MCM mainly contains the following sub-controllers:

MCM can be installed in a cluster with following steps:

* Apply all the CRDs from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/in-tree)
* Apply all the deployment, role-related objects from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/in-tree).
* Apply all the CRDs from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/crds)
* Apply all the deployment, role-related objects from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/out-of-tree).

* Control cluster is the one where the `machine-*` objects are stored. Target cluster is where all the node objects are registered.

Expand Down
19 changes: 0 additions & 19 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,3 @@

#### Development
* [Adding support for a new cloud provider](development/cp_support_new.md)

## Using In-Tree provider support (:warning: DEPRECATED!)

##### Development

* [Adding support for a new cloud provider](development/cp_support_old.md)
* [Setting up a local development environment](development/local_setup.md)
* [Testing and Dependency Management](development/testing_and_dependencies.md)

#### Usage

* [Setting up your usage environment](usage/prerequisite.md)
* [Creating/Deleting machines (VM)](usage/machine.md)
* [Maintaining machine replicas using machines-sets](usage/machine_set.md)
* [Updating machines using machines-deployments](usage/machine_deployment.md)

#### Deployment

* [Deploying the MCM into a Kubernetes cluster using IN-TREE providers](deployment/kubernetes.md)
12 changes: 6 additions & 6 deletions docs/deployment/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ As already mentioned, the Machine Controller Manager is designed to run as contr
- Connect to the remote kubernetes cluster where you plan to deploy the Machine Controller Manager using the kubectl. Set the environment variable KUBECONFIG to the path of the yaml file containing the cluster info.
- Now, create the required CRDs on the remote cluster using the following command,
```bash
$ kubectl apply -f kubernetes/crds.yaml
$ kubectl apply -f kubernetes/crds
```

## Build the Docker image
Expand All @@ -37,19 +37,19 @@ $ make docker-image
$ make push
```

- Now you can deploy this docker image to your cluster. A sample development [file is given at](/kubernetes/deployment/in-tree/deployment.yaml). By default, the deployment manages the cluster it is running in. Optionally, the kubeconfig could also be passed as a flag as described in `/kubernetes/deployment/in-tree/deployment.yaml`. This is done when you want your controller running outside the cluster to be managed from.
- Now you can deploy this docker image to your cluster. A [sample development file](/kubernetes/deployment/out-of-tree/deployment.yaml) is provided. By default, the deployment manages the cluster it is running in. Optionally, the kubeconfig could also be passed as a flag as described in `/kubernetes/deployment/out-of-tree/deployment.yaml`. This is done when you want your controller running outside the cluster to be managed from.
```bash
$ kubectl apply -f kubernetes/deployment/in-tree/deployment.yaml
$ kubectl apply -f kubernetes/deployment/out-of-tree/deployment.yaml
```
- Also deploy the required clusterRole and clusterRoleBindings
```bash
$ kubectl apply -f kubernetes/deployment/in-tree/clusterrole.yaml
$ kubectl apply -f kubernetes/deployment/in-tree/clusterrolebinding.yaml
$ kubectl apply -f kubernetes/deployment/out-of-tree/clusterrole.yaml
$ kubectl apply -f kubernetes/deployment/out-of-tree/clusterrolebinding.yaml
```

## Configuring optional parameters while deploying

Machine-controller-manager supports several configurable parameters while deploying. Refer to [the following lines](/kubernetes/deployment/in-tree/deployment.yaml#L21-L30), to know how each parameter can be configured, and what it's purpose is for.
Machine-controller-manager supports several configurable parameters while deploying. Refer to [the following lines](/kubernetes/deployment/out-of-tree/deployment.yaml#L21-L30), to know how each parameter can be configured, and what it's purpose is for.

## Usage

Expand Down
Loading