-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Tal Cohen <[email protected]>
- Loading branch information
Showing
12 changed files
with
338 additions
and
387 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
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,19 +1,46 @@ | ||
image ?= "artifactory-kfs.habana-labs.com/k8s-docker-dev/device_plugin/habana-device-plugin" | ||
version ?= "test" | ||
base_image ?= "artifactory-kfs.habana-labs.com/docker-local/1.13.0/ubuntu20.04/habanalabs/base-installer:1.13.0-10" | ||
|
||
|
||
## build: build docker image in ci-cd process | ||
.PHONY: build | ||
build: | ||
docker build \ | ||
-t $(image):$(version) \ | ||
--build-arg BASE_IMAGE=$(base_image) \ | ||
--build-arg BUILD_REF=$(version) \ | ||
# Copyright (c) 2020-2022, HabanaLabs Ltd. All rights reserved. | ||
# | ||
# 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. | ||
|
||
DOCKER ?= docker | ||
|
||
include $(CURDIR)/versions.mk | ||
|
||
|
||
ifeq ($(IMAGE_NAME),) | ||
IMAGE_NAME := $(REGISTRY)/$(APP_NAME) | ||
endif | ||
|
||
IMAGE_TAG ?= $(VERSION)-$(MINOR_VERSION) | ||
IMAGE = $(IMAGE_NAME):$(IMAGE_TAG) | ||
|
||
|
||
.PHONY: build push | ||
|
||
## build: build docker image | ||
build: | ||
$(DOCKER) build \ | ||
-t $(IMAGE) \ | ||
--build-arg BUILD_REF=$(IMAGE_TAG) \ | ||
--build-arg REGISTRY=$(REGISTRY) \ | ||
--build-arg VERSION="$(VERSION)" \ | ||
--build-arg MINOR_VERSION="$(MINOR_VERSION)" \ | ||
--build-arg DIST="$(DIST)" \ | ||
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \ | ||
--build-arg GIT_COMMIT="$(GIT_COMMIT)" \ | ||
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | ||
. | ||
|
||
## push-image: push the image to the registry | ||
.PHONY: push-image | ||
push-image: | ||
docker image push $(image):$(version) | ||
## push: push the image to the registry | ||
push: | ||
$(DOCKER) image push $(IMAGE) |
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,141 +1,55 @@ | ||
# HABANA device plugin for Kubernetes | ||
# Habana Device Plugin for Kubernetes | ||
|
||
## Table of Contents | ||
The Habana device plugin for Kubernetes, operating as a DaemonSet, enables the automatic registration of | ||
Habana devices within your Kubernetes cluster, while also monitoring the health status of these devices. | ||
This integration ensures seamless management and monitoring of Habana devices within the Kubernetes ecosystem, | ||
enhancing operational efficiency and reliability. | ||
|
||
This repository contains Habana official implementation of the [Kubernetes device plugin](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/). | ||
|
||
- [HABANA device plugin for Kubernetes](#habana-device-plugin-for-kubernetes) | ||
## Table of Contents | ||
- [Habana Device Plugin for Kubernetes](#habana-device-plugin-for-kubernetes) | ||
- [Table of Contents](#table-of-contents) | ||
- [Introduction](#introduction) | ||
- [Prerequisites](#prerequisites) | ||
- [The below sections detail existing plugins](#the-below-sections-detail-existing-plugins) | ||
- [Goya device plugin](#goya-device-plugin) | ||
- [Running Jobs](#running-jobs) | ||
- [Gaudi device plugin](#gaudi-device-plugin) | ||
- [With Docker](#with-docker) | ||
- [Build](#build) | ||
- [Build in CD](#build-in-cd) | ||
- [Deploy as Daemon Set:](#deploy-as-daemon-set) | ||
- [Changelog](#changelog) | ||
- [Version 0.9.1](#version-091) | ||
- [Version 0.8.1-beta1](#version-081-beta1) | ||
- [Issues](#issues) | ||
|
||
|
||
## Introduction | ||
|
||
The HABANA device plugin for Kubernetes is a Daemonset that allows you to automatically: | ||
- Enables the registration of HABANA devices in your Kubernetes cluster. | ||
- Keep track of the health of your Device | ||
|
||
## Prerequisites | ||
The list of prerequisites for running the HABANA device plugin is described below: | ||
- HABANA drivers | ||
- Kubernetes version >= 1.10 | ||
|
||
### The below sections detail existing plugins | ||
- [Gaudi Device Registration](#gaudi-device-registration) | ||
- [Building and Running Locally Using Docker](#building-and-running-locally-using-docker) | ||
|
||
#### Goya device plugin | ||
|
||
Once you have enabled this option on *all* the nodes you wish to use, | ||
you can then enable support in your cluster by deploying the following Daemonset: | ||
## Prerequisites | ||
|
||
```shell | ||
$ kubectl create -f habanalabs-device-plugin.yaml | ||
``` | ||
The below lists the prerequisites needed for running Habana device plugin: | ||
- Habana Drivers | ||
- Kubernetes version >= 1.19 | ||
- [Habana-container-runtime](https://github.com/HabanaAI/habana-container-runtime) | ||
|
||
##### Running Jobs | ||
|
||
Can now be consumed via container level resource requirements using the resource name habana.com/goya: | ||
```yaml | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: habanalabs-goya-demo0 | ||
spec: | ||
nodeSelector: | ||
accelerator: habanalabs | ||
containers: | ||
- name: habana-ai-base-container | ||
image: habanai/goya-demo:0.9.1-43-debian9.8 | ||
workingDir: /home/user1 | ||
securityContext: | ||
capabilities: | ||
add: ["SYS_RAWIO"] | ||
command: ["sleep"] | ||
args: ["10000"] | ||
resources: | ||
limits: | ||
habana.ai/goya: 1 | ||
imagePullSecrets: | ||
- name: regcred | ||
``` | ||
|
||
#### Gaudi device plugin | ||
## Gaudi Device Registration | ||
|
||
Once you have enabled this option on *all* the nodes you wish to use, | ||
you can then enable support in your cluster by deploying the following Daemonset: | ||
Once the prerequisites mentioned earlier have been established in the nodes, | ||
you can then activate support in your cluster by deploying the Daemonset: | ||
|
||
```shell | ||
$ kubectl create -f habanalabs-device-plugin-gaudi.yaml | ||
``` | ||
|
||
### With Docker | ||
|
||
#### Build | ||
Option 1, pull the prebuilt image from [Docker Hub](https://hub.docker.com/r/habanai/k8s-device-plugin): | ||
```shell | ||
$ docker pull habanai/k8s-device-plugin:0.9.1 | ||
``` | ||
## Building and Running Locally Using Docker | ||
|
||
Option 2, build without cloning the repository: | ||
```shell | ||
$ docker build --network=host --no-cache -t habanai/k8s-device-plugin:0.9.1 habanalabs-k8s-device-plugin | ||
``` | ||
To build and run using a docker, employ the following options according to your specific scenario: | ||
|
||
Option 3, if you want to modify the code: | ||
- To pull the prebuilt image, run: | ||
```shell | ||
https://github.com/HabDevops/habanalabs-k8s-device-plugin | ||
$ git clone https://github.com/HabDevops/habanalabs-k8s-device-plugin.git && cd habanalabs-k8s-device-plugin | ||
$ git checkout v0.9.1 | ||
$ docker build -t habanai/k8s-device-plugin:0.9.1 . | ||
$ docker pull vault.habana.ai/docker-k8s-device-plugin/docker-k8s-device-plugin:1.14.0 | ||
``` | ||
|
||
### Build in CD | ||
Requirements: | ||
- go-hlml repo must be first downloaded from gerrit into the habanalabs-device-plugin repo. | ||
It is copied by the Dockerfile into the image during the build process. | ||
_(this is due a lack of go modules support in Gerrit v2)_ | ||
|
||
|
||
To build the image in the CD process use the `make build` build. | ||
It accepts the following parameters: | ||
- `base_image` -Image to use as the builder for the application | ||
- `image` - Final full image name to deploy | ||
- `version` - Image's tag | ||
|
||
Full example showing usage of current jenkins variables(or parameters): | ||
``` | ||
make build base_image=$baseDockerImage image=$pluginDockerImage version=$"{release_version}-${release_build_id}" | ||
- To build without cloning the repository, run: | ||
```shell | ||
$ docker build --network=host --no-cache -t habanai/k8s-device-plugin:1.14.0 habanalabs-k8s-device-plugin | ||
``` | ||
|
||
#### Deploy as Daemon Set: | ||
- To modify the code, run: | ||
```shell | ||
$ kubectl create -f habanalabs-device-plugin.yaml | ||
$ git clone https://github.com/HabanaAI/habanalabs-k8s-device-plugin.git && cd habanalabs-k8s-device-plugin | ||
$ docker build -t habanai/k8s-device-plugin:devel . | ||
``` | ||
|
||
## Changelog | ||
|
||
### Version 0.9.1 | ||
- New HLML SW 0.9.1-43 debian9.8 | ||
|
||
### Version 0.8.1-beta1 | ||
- Support k8s plugin for Gaudi | ||
- New HLML SW 0.8.1-55 debian9.8 | ||
- Add new resource namespace e.g: goya/gaudi | ||
- Refactor device plugin to eventually handle multiple resource types | ||
- Move plugin error retry to event loop so we can exit with a signal | ||
|
||
# Issues | ||
* You can report a bug by [filing a new issue](https://github.com/HabDevops/habanalabs-k8s-device-plugin/issues/new) | ||
* You can contribute by opening a [pull request](https://help.github.com/articles/using-pull-requests/) | ||
|
||
|
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
Oops, something went wrong.