-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aligning SampleProvider to Controller based MC
- Loading branch information
1 parent
501261a
commit 3704b55
Showing
24 changed files
with
488 additions
and
919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
*.DS_Store | ||
*amd64 | ||
*.html | ||
main | ||
|
||
# Output of the go coverage tool | ||
*coverprofile.out* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
FROM alpine:3.6 | ||
############# builder ############# | ||
FROM golang:1.13.5 AS builder | ||
|
||
RUN apk add --update bash curl | ||
WORKDIR /go/src/github.com/gardener/machine-controller-manager-provider-sampleprovider | ||
COPY . . | ||
|
||
COPY bin/rel/cmi-plugin /cmi-plugin | ||
RUN .ci/build | ||
|
||
############# base ############# | ||
FROM alpine:3.11.2 as base | ||
|
||
RUN apk add --update bash curl tzdata | ||
WORKDIR / | ||
ENTRYPOINT ["/cmi-plugin"] | ||
|
||
############# machine-controller ############# | ||
FROM base AS machine-controller | ||
|
||
COPY --from=builder /go/src/github.com/gardener/machine-controller-manager-provider-sampleprovider/bin/rel/machine-controller /machine-controller | ||
ENTRYPOINT ["/machine-controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
# machine-controller-manager-provider-sampleprovider | ||
Out of tree (gRPC based) implementation for `SampleProvider` as a new provider. | ||
Out of tree (controller based) implementation for `SampleProvider` as a new provider. | ||
|
||
## About | ||
- This is a sample repository that provides the blueprint required to implement a new (hyperscale) provider. We call the new provider as `SampleProvider` for our ease. | ||
- Each provider (plugin/actuator/driver) is a gRPC server and implements the services defined at [machine-spec](https://github.com/gardener/machine-spec). | ||
- Each provider implements the interface defined at [MCM OOT driver](https://github.com/gardener/machine-controller-manager/blob/master/pkg/util/provider/driver/driver.go). | ||
|
||
## Fundamental Design Principles: | ||
Following are the basic principles kept in mind while developing the external plugin. | ||
* Communication between external plugin and machine-controller is achieved using gRPC mechanism. | ||
* External plugin behaves as gRPC-server and machine-controller behaves as gRPC client. | ||
* Cloud-provider specific contract should be scoped under `ProviderSpec` field. `ProviderSpec` field is expected to be raw-bytes at machine-controller-side. External plugin should have pre-defined typed-apis to parse the `ProviderSpec` to make necessary CP specific calls. | ||
* External plugins do not need to communicate with kubernetes api-server. | ||
* Kubeconfig may not be available to external-plugins. | ||
* Communication between this Machine Controller (MC) and Machine Controller Manager (MCM) is achieved using the Kubernetes native declarative approach. | ||
* Machine Controller (MC) behaves as the controller used to interact with the cloud provider and manage the VMs corresponding to the machine objects. | ||
* Machine Controller Manager (MCM) deals with higher level objects such as machine-set and machine-deployment objects. | ||
|
||
## Support for a new provider | ||
- Steps to be followed while implementing a new provider are mentioned [here](https://github.com/gardener/machine-controller-manager/blob/cmi-client/docs/development/new_cp_support.md) | ||
- Steps to be followed while implementing a new provider are mentioned [here](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2014 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was copied and modified from the kubernetes/kubernetes project | ||
https://github.com/kubernetes/kubernetes/release-1.8/cmd/kube-controller-manager/controller_manager.go | ||
Modifications Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
cp "github.com/gardener/machine-controller-manager-provider-sampleprovider/pkg/provider" | ||
"github.com/gardener/machine-controller-manager-provider-sampleprovider/pkg/spi" | ||
_ "github.com/gardener/machine-controller-manager/pkg/util/client/metrics/prometheus" // for client metric registration | ||
"github.com/gardener/machine-controller-manager/pkg/util/provider/app" | ||
"github.com/gardener/machine-controller-manager/pkg/util/provider/app/options" | ||
_ "github.com/gardener/machine-controller-manager/pkg/util/reflector/prometheus" // for reflector metric registration | ||
_ "github.com/gardener/machine-controller-manager/pkg/util/workqueue/prometheus" // for workqueue metric registration | ||
"github.com/spf13/pflag" | ||
"k8s.io/component-base/cli/flag" | ||
"k8s.io/component-base/logs" | ||
) | ||
|
||
func main() { | ||
|
||
s := options.NewMCServer() | ||
s.AddFlags(pflag.CommandLine) | ||
|
||
flag.InitFlags() | ||
logs.InitLogs() | ||
defer logs.FlushLogs() | ||
|
||
provider := cp.NewProvider(&spi.PluginSPIImpl{}) | ||
|
||
if err := app.Run(s, provider); err != nil { | ||
fmt.Fprintf(os.Stderr, "%v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
} |
Oops, something went wrong.