Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ArangoGutierrez committed Jan 8, 2024
0 parents commit b8dc27e
Show file tree
Hide file tree
Showing 2,386 changed files with 1,156,577 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kubeconfig
bin
.DS_Store
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright (c) 2023, NVIDIA CORPORATION. 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.
.PHONY: build fmt verify image push

GO_CMD ?= go
GO_FMT ?= gofmt
GO_SRC := $(shell find . -type f -name '*.go' -not -path "./vendor/*")

BINARY_NAME ?= holodeck

VERSION := 0.0.1

IMAGE_REGISTRY ?= ghcr.io/arangogutierrez
IMAGE_TAG_NAME ?= $(VERSION)
IMAGE_NAME := holodeck
IMAGE_REPO := $(IMAGE_REGISTRY)/$(IMAGE_NAME)
IMAGE_TAG := $(IMAGE_REPO):$(IMAGE_TAG_NAME)

PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

build:
$(GO_CMD) build -o bin/$(BINARY_NAME) cmd/main.go

fmt:
@$(GO_FMT) -w -l $$(find . -name '*.go')

verify:
@out=`$(GO_FMT) -w -l -d $$(find . -name '*.go')`; \
if [ -n "$$out" ]; then \
echo "$$out"; \
exit 1; \
fi

image:
docker build -t $(IMAGE_TAG) .

push: image
docker push $(IMAGE_TAG)


.PHONY: generate
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.12.1

# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
28 changes: 28 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: nvidia.com
layout:
- go.kubebuilder.io/v4
multigroup: true
projectName: holodeck
repo: github.com/NVIDIA/holodeck
resources:
- api:
crdVersion: v1
namespaced: true
domain: nvidia.com
group: holodeck
kind: AWS
path: github.com/NVIDIA/holodeck/api/holodeck/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: nvidia.com
group: holodeck
kind: Provisioner
path: github.com/NVIDIA/holodeck/api/holodeck/v1alpha1
version: v1alpha1
version: "3"
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Holodeck

> * Tech preview, under heavy development *
A tool for creating and managing GPU ready Cloud test environments.

## Installation

```bash
make build
mv ./bin/holodeck /usr/local/bin/holodeck
```

### Prerequisites

If utilizing the AWS provider, a valid AWS credentials must be available in the environment.

```yaml
apiVersion: holodeck.nvidia.com/v1alpha1
kind: Environment
metadata:
name: holodeck
description: "Devel infra environment"
spec:
provider: aws
```
If utilizing the SSH provider, a valid SSH key must and reachable host must be available in the environment file.
```yaml
apiVersion: holodeck.nvidia.com/v1alpha1
kind: Environment
metadata:
name: holodeck
description: "Devel infra environment"
spec:
provider: aws
auth:
keyName: eduardoa
privateKey: "/Users/eduardoa/.ssh/eduardoa.pem"
instance:
hostUrl: "some-reachable-host-ip"
```
## Usage
```bash
holodeck --help
```

### The Environment CRD

```yaml
apiVersion: holodeck.nvidia.com/v1alpha1
kind: Environment
metadata:
name: holodeck
description: "Devel infra environment"
spec:
provider: aws # or ssh for now
auth:
keyName: eduardoa
privateKey: "/Users/eduardoa/.ssh/eduardoa.pem"
instance: # if provider is ssh you need to define here the hostUrl
type: g4dn.xlarge
region: eu-north-1
ingressIpRanges:
- 213.179.129.0/26
image:
architecture: amd64
imageId: ami-0fe8bec493a81c7da
containerRuntime:
install: true
name: containerd
version: 1.6.24
kubernetes:
install: true
enable: true
version: v1.28.5
```
### Create an environment
```bash
holodeck create -f ./examples/v1alpha1_environment.yaml
```

### Delete an environment

```bash
holodeck delete -f ./examples/v1alpha1_environment.yaml
```
36 changes: 36 additions & 0 deletions api/holodeck/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION. 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.
*/

// Package v1alpha1 contains API Schema definitions for the holodeck v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=holodeck.nvidia.com
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "holodeck.nvidia.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
Loading

0 comments on commit b8dc27e

Please sign in to comment.