https://github.com/yowenter/example-cloud-controller-manager
A simple kubernetes cloud controller manager for example.
https://github.com/yowenter/example-cloud-controller-manager
cloud-providers kubernetes
Last synced: 3 months ago
JSON representation
A simple kubernetes cloud controller manager for example.
- Host: GitHub
- URL: https://github.com/yowenter/example-cloud-controller-manager
- Owner: yowenter
- Created: 2019-02-14T09:43:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-14T09:48:15.000Z (over 7 years ago)
- Last Synced: 2025-04-10T19:34:57.283Z (over 1 year ago)
- Topics: cloud-providers, kubernetes
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kubernetes Cloud Controller Manager for Example
A simple kubernetes cloud controller manager for example.
## Developing Cloud Controller Manager Guide
### [1/3] implement interface below
```go
// Interface is an abstract, pluggable interface for cloud providers.
type Interface interface {
// Initialize provides the cloud with a kubernetes client builder and may spawn goroutines
// to perform housekeeping or run custom controllers specific to the cloud provider.
// Any tasks started here should be cleaned up when the stop channel closes.
Initialize(clientBuilder ControllerClientBuilder, stop <-chan struct{})
// LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
LoadBalancer() (LoadBalancer, bool)
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
Instances() (Instances, bool)
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
Zones() (Zones, bool)
// Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
Clusters() (Clusters, bool)
// Routes returns a routes interface along with whether the interface is supported.
Routes() (Routes, bool)
// ProviderName returns the cloud provider ID.
ProviderName() string
// HasClusterID returns true if a ClusterID is required and set
HasClusterID() bool
}
```
### [2/3] register provider
register provider in package.
```go
func init() {
cloudprovider.RegisterCloudProvider(providerName, func(io.Reader) (cloudprovider.Interface, error) {
return newCloudProvider()
})
}
```
### [3/3] deploy cloud controller manager
`kubectl apply -f releases/v0.1.0.yml`
## Cloud Controller Manager mechanism
cloud controller manager 是一个非常简单的中间件(或者说是客户端), 将云厂商提供的 API 映射到 K8S 的对象,有点像 ORM 了。
## Reference
- https://kubernetes.io/docs/tasks/administer-cluster/developing-cloud-controller-manager/
- https://github.com/digitalocean/digitalocean-cloud-controller-manager/