Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #30 from stoyanr/update-manifests
Browse files Browse the repository at this point in the history
Update README and example manifests
  • Loading branch information
mfranczy authored Oct 16, 2020
2 parents ef5d89c + 9bc0213 commit 74d7988
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 72 deletions.
28 changes: 13 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

BINARY_PATH := bin/
IMAGE_REPOSITORY := eu.gcr.io/gardener-project/gardener/machine-controller-manager-provider-kubevirt
IMAGE_TAG := $(shell cat VERSION)
PROVIDER_NAME := Kubevirt
PROJECT_NAME := gardener
CONTROL_NAMESPACE := default
CONTROL_KUBECONFIG := dev/target-kubeconfig.yaml
TARGET_KUBECONFIG := dev/target-kubeconfig.yaml
Expand All @@ -28,18 +25,18 @@ TARGET_KUBECONFIG := dev/target-kubeconfig.yaml
.PHONY: start
start:
@GO111MODULE=on go run \
cmd/machine-controller/main.go \
--control-kubeconfig=$(CONTROL_KUBECONFIG) \
--target-kubeconfig=$(TARGET_KUBECONFIG) \
--namespace=$(CONTROL_NAMESPACE) \
--machine-creation-timeout=20m \
--machine-drain-timeout=5m \
--machine-health-timeout=10m \
--machine-pv-detach-timeout=2m \
--machine-safety-apiserver-statuscheck-timeout=30s \
--machine-safety-apiserver-statuscheck-period=1m \
--machine-safety-orphan-vms-period=30m \
--v=3
cmd/machine-controller/main.go \
--control-kubeconfig=$(CONTROL_KUBECONFIG) \
--target-kubeconfig=$(TARGET_KUBECONFIG) \
--namespace=$(CONTROL_NAMESPACE) \
--machine-creation-timeout=20m \
--machine-drain-timeout=5m \
--machine-health-timeout=10m \
--machine-pv-detach-timeout=2m \
--machine-safety-apiserver-statuscheck-timeout=30s \
--machine-safety-apiserver-statuscheck-period=1m \
--machine-safety-orphan-vms-period=30m \
--v=3

#########################################
# Rules for re-vendoring
Expand Down Expand Up @@ -68,6 +65,7 @@ verify: check test
.PHONY: test
test:
@.ci/test

.PHONY: check
check:
@.ci/check
Expand Down
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# TODO(MQ): Add a proper README for the Kubevirt loud provider.
# machine-controller-manager-provider-kubevirt

This project contains the external [Machine Controller Manager](https://github.com/gardener/machine-controller-manager) plugin (driver) implementation for the [KubeVirt](https://kubevirt.io) provider. It is intended to be used in combination with the [Gardener Extension for KubeVirt provider](https://github.com/gardener/gardener-extension-provider-kubevirt).

## Prerequisites

* A provider cluster with [KubeVirt](https://kubevirt.io) and [CDI](https://github.com/kubevirt/containerized-data-importer) installed, and a user with read and write permissions on KubeVirt, CDI, and Kubernetes core resources in a certain namespace of this cluster.
* To take advantage of networking features, the provider cluster should also contain [Multus](https://intel.github.io/multus-cni/doc/quickstart.html).

## Supported KubeVirt versions

This plugin has been tested with KubeVirt v0.32.0 and CDI v1.23.5.

## How to start using or developing this extension locally

You can run the extension locally on your machine by executing `make start`.

Static code checks and tests can be executed by running `make verify`. We are using Go modules for Golang package dependency management and [Ginkgo](https://github.com/onsi/ginkgo)/[Gomega](https://github.com/onsi/gomega) for testing.

## Feedback and Support

Feedback and contributions are always welcome. Please report bugs or suggestions as [GitHub issues](https://github.com/gardener/gardener-extension-provider-kubevirt/issues) or join our [Slack channel #gardener](https://kubernetes.slack.com/messages/gardener) (please invite yourself to the Kubernetes workspace [here](http://slack.k8s.io)).

## Learn more!

Please find further resources about out project here:

* [Our landing page gardener.cloud](https://gardener.cloud/)
* ["Gardener, the Kubernetes Botanist" blog on kubernetes.io](https://kubernetes.io/blog/2018/05/17/gardener/)
* ["Gardener Project Update" blog on kubernetes.io](https://kubernetes.io/blog/2019/12/02/gardener-project-update/)
* [GEP-1 (Gardener Enhancement Proposal) on extensibility](https://github.com/gardener/gardener/blob/master/docs/proposals/01-extensibility.md)
* [GEP-4 (New `core.gardener.cloud/v1alpha1` API)](https://github.com/gardener/gardener/blob/master/docs/proposals/04-new-core-gardener-cloud-apis.md)
* [Extensibility API documentation](https://github.com/gardener/gardener/tree/master/docs/extensions)
* [Gardener Extensions Golang library](https://godoc.org/github.com/gardener/gardener/extensions/pkg)
* [Gardener API Reference](https://gardener.cloud/api-reference/)
2 changes: 0 additions & 2 deletions kubernetes/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}

---

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
82 changes: 45 additions & 37 deletions kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,71 +28,79 @@ spec:
labels:
app: machine-controller-manager
spec:
serviceAccountName: machine-controller-manager
containers:
- name: machine-controller-manager
image:eu.gcr.io/gardener-project/gardener/machine-controller-manager:v0.28.0-dev-793b105c41adfc434e07107decaf1ac67fc1fd3f
- name: machine-controller
image: eu.gcr.io/gardener-project/gardener/machine-controller-manager-provider-kubevirt:latest
imagePullPolicy: Always
command:
- ./machine-controller-manager
- --target-kubeconfig=$(TARGET_KUBECONFIG) # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- --control-kubeconfig=$(CONTROL_KUBECONFIG) # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- --namespace=$(CONTROL_NAMESPACE) # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
- --safety-up=2 # Optional Parameter - Default value 2 - 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 frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.
- --safety-down=1 # Optional Parameter - Default value 1 - 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.
- --machine-drain-timeout=5m # Optional Parameter - Timeout (in time) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.
- --machine-health-timeout=10m # Optional Parameter - Default value 10mins - Timeout (in time) used while joining (during creation) or re-joining (in case of temporary health issues) of machine before it is declared as failed.
- --machine-safety-orphan-vms-period=30 # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- --machine-safety-overshooting-period=1 # Optional Parameter - Default value 1min - Time period (in time) used to poll for overshooting of machine objects backing a machineSet by safety controller.
- --node-conditions=ReadonlyFilesystem,KernelDeadlock,DiskPressure # 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.
- --v=3
- ./machine-controller
- --control-kubeconfig=inClusterConfig # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- --target-kubeconfig=inClusterConfig # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- --namespace=default # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
- --port=10259
- --machine-drain-timeout=5m # Optional Parameter - Timeout (in time) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.
- --machine-health-timeout=10m # Optional Parameter - Default value 10mins - Timeout (in time) used while joining (during creation) or re-joining (in case of temporary health issues) of machine before it is declared as failed.
- --machine-safety-orphan-vms-period=30m # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- --node-conditions=ReadonlyFilesystem,KernelDeadlock,DiskPressure # 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.
- --v=3
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10258
port: 10259
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
- command:
- ./machine-controller
- --control-kubeconfig=$(TARGET_KUBECONFIG) # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- --target-kubeconfig=$(CONTROL_KUBECONFIG) # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- --namespace=$(CONTROL_NAMESPACE) # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
ports:
- containerPort: 10259
name: metrics
protocol: TCP
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 350m
memory: 256Mi
- name: machine-controller-manager
image: eu.gcr.io/gardener-project/gardener/machine-controller-manager:v0.33.0
imagePullPolicy: IfNotPresent
command:
- ./machine-controller-manager
- --target-kubeconfig=inClusterConfig # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- --control-kubeconfig=inClusterConfig # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- --namespace=default # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
- --port=10258
- --machine-creation-timeout=20m
- --machine-drain-timeout=5m # Optional Parameter - Timeout (in time) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.
- --machine-health-timeout=10m # Optional Parameter - Default value 10mins - Timeout (in time) used while joining (during creation) or re-joining (in case of temporary health issues) of machine before it is declared as failed.
- --machine-safety-orphan-vms-period=30m # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- --machine-safety-orphan-vms-period=30 # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- --machine-safety-overshooting-period=1 # Optional Parameter - Default value 1min - Time period (in time) used to poll for overshooting of machine objects backing a machineSet by safety controller.
- --node-conditions=ReadonlyFilesystem,KernelDeadlock,DiskPressure # 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.
- --safety-up=2 # Optional Parameter - Default value 2 - 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 frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.
- --safety-down=1 # Optional Parameter - Default value 1 - 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.
- --v=3
image: eu.gcr.io/gardener-project/gardener/machine-controller-manager-provider-kubevirt
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10259
port: 10258
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: machine-controller
ports:
- containerPort: 10259
name: metrics
- name: metrics
containerPort: 10258
protocol: TCP
resources:
limits:
cpu: "3"
memory: 3000Mi
requests:
cpu: 50m
memory: 64Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
securityContext: {}
serviceAccount: machine-controller-manager
serviceAccountName: machine-controller-manager
dnsPolicy: ClusterFirst
restartPolicy: Always
limits:
cpu: 350m
memory: 256Mi
64 changes: 54 additions & 10 deletions kubernetes/machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,59 @@
apiVersion: machine.sapcloud.io/v1alpha1
kind: MachineClass
metadata:
name: test-mc
namespace: default # Namespace where the controller would watch
providerSpec:
storageClassName: test-storage-class
pvcSize: "10Gi"
sourceURL: source-image-url
cpus: "1"
memory: "4096M"
name: test-machine-class
namespace: default
secretRef: # If required
providerSpec:
region: local
zone: local-1
resources:
requests:
cpu: 1
memory: 4096Mi
limits:
cpu: 2
memory: 8Gi
rootVolume:
pvc:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: standard
source:
http:
url: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
additionalVolumes:
- dataVolume:
pvc:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
source:
blank: {}
sshKeys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDdOIhYmzCK5DSVLu3b"
networks:
- name: default/net-conf
cpu:
cores: 1
sockets: 2
threads: 1
memory:
hugepages:
pageSize: "2Mi"
dnsPolicy: ClusterFirst
dnsConfig:
nameservers:
- 8.8.8.8
tags:
mcm.gardener.cloud/cluster: shoot--dev--kubevirt,
mcm.gardener.cloud/role: node,
mcm.gardener.cloud/machineclass: test-machine-class,
secretRef:
name: test-secret
namespace: default # Namespace where the controller would watch
namespace: default
2 changes: 1 addition & 1 deletion kubernetes/machine-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ spec:
spec:
class:
kind: MachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
name: test-mc # Name of the machine class
name: test-machine-class # Name of the machine class
namespace: default
2 changes: 1 addition & 1 deletion kubernetes/machine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ metadata:
spec:
class:
kind: MachineClass
name: test-mc
name: test-machine-class
namespace: default
8 changes: 4 additions & 4 deletions kubernetes/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.

apiVersion: v1
data:
kubeconfig: # base64 encoded kubeconfig for kubevirt
userData: # base64 encoded userdata
kind: Secret
metadata:
name: test-secret
namespace: default
type: Opaque
type: Opaque
data:
kubeconfig: # base64 encoded kubeconfig for kubevirt
userData: # base64 encoded userdata
2 changes: 1 addition & 1 deletion pkg/kubevirt/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const (
region = "local"
zone = "local-1"
storageClassName = "standard"
imageSourceURL = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img"
imageSourceURL = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
networkName = "default/net-conf"
sshPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDdOIhYmzCK5DSVLu3b"
machineProviderID = ProviderName + "://" + machineName
Expand Down

0 comments on commit 74d7988

Please sign in to comment.