Skip to content

Commit

Permalink
Merge pull request #4 from NVIDIA/readme
Browse files Browse the repository at this point in the history
Nit tips
  • Loading branch information
ArangoGutierrez authored Jan 24, 2024
2 parents 6ee52fc + 1f2643a commit 4853acf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 25 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ metadata:
name: holodeck
description: "Devel infra environment"
spec:
provider: aws # or ssh for now
provider: aws # or ssh currently supported
auth:
keyName: user
privateKey: "/Users/user/.ssh/user.pem"
Expand All @@ -75,28 +75,31 @@ spec:
version: 1.6.24
kubernetes:
install: true
installer: kubeadm # supported installers: kubeadm, kind
installer: kubeadm # supported installers: kubeadm, kind, microk8s
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
...
```

### Dry Run

```bash
$ holodeck dryrun -f ./examples/v1alpha1_environment.yaml
Checking if instance type g4dn.xlarge is supported in region xx-xxxx-1
Checking if image ami-xxxxxxxxx is supported in region xx-xxxx-1
Resolving dependencies...
Dryrun succeeded
Dryrun environment holodeck 🔍
✔ Checking if instance type g4dn.xlarge is supported in region eu-north-1
✔ Checking if image ami-0fe8bec493a81c7da is supported in region eu-north-1
✔ Resolving dependencies 📦
Dryrun succeeded 🎉
```
6 changes: 1 addition & 5 deletions cmd/dryrun/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ func (m command) build() *cli.Command {
return fmt.Errorf("failed to read config file %s: %v", opts.envFile, err)
}

if opts.cfg.Spec.ContainerRuntime.Name == "" && opts.cfg.Spec.Kubernetes.Install {
m.log.Warning("No container runtime specified, will default defaulting to containerd")
}

return nil
},
Action: func(c *cli.Context) error {
Expand Down Expand Up @@ -109,7 +105,7 @@ func (m command) run(c *cli.Context, opts *options) error {
return err
}

m.log.Check("Dryrun succeeded\n")
m.log.Info("Dryrun succeeded \U0001F389")

return nil
}
Expand Down
6 changes: 2 additions & 4 deletions examples/v1alpha1_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ spec:
image:
architecture: amd64
imageId: ami-0fe8bec493a81c7da
containerRuntime:
install: true
kubernetes:
install: true
installer: kind
version: 1.29
installer: kubeadm
version: v1.28.5
20 changes: 10 additions & 10 deletions pkg/provisioner/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ func Dryrun(log *logger.FunLogger, env v1alpha1.Environment) error {
// Resolve dependencies from top to bottom
log.Wg.Add(1)

go log.Loading("Resolving dependencies \U0001F4E6 ...")
go log.Loading("Resolving dependencies \U0001F4E6")
// Kubernetes -> Container Toolkit -> Container Runtime -> NVDriver
if env.Spec.Kubernetes.Install {
if !env.Spec.ContainerRuntime.Install {
log.Fail <- struct{}{}
return fmt.Errorf("cannot install Kubernetes without a container runtime")
}
// check if env.Spec.Kubernetes.KubernetesVersion is in the format of vX.Y.Z
if env.Spec.Kubernetes.KubernetesInstaller == "kubeadm" && !strings.HasPrefix(env.Spec.Kubernetes.KubernetesVersion, "v") {
log.Fail <- struct{}{}
return fmt.Errorf("kubernetes version %s is not in the format of vX.Y.Z", env.Spec.Kubernetes.KubernetesVersion)
}
}

if env.Spec.ContainerRuntime.Install && (env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeContainerd &&
env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeCrio &&
env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeDocker) {
log.Fail <- struct{}{}
return fmt.Errorf("container runtime %s not supported", env.Spec.ContainerRuntime.Name)
if env.Spec.ContainerRuntime.Install {
if env.Spec.ContainerRuntime.Name == "" {
log.Warning("No container runtime specified, will default to containerd")
} else if env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeContainerd &&
env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeCrio &&
env.Spec.ContainerRuntime.Name != v1alpha1.ContainerRuntimeDocker {
log.Fail <- struct{}{}
return fmt.Errorf("container runtime %s not supported", env.Spec.ContainerRuntime.Name)
}
}

log.Done <- struct{}{}
Expand Down

0 comments on commit 4853acf

Please sign in to comment.