Skip to content

Commit 7d4767d

Browse files
committed
fix: add licensing back to makefiles and a quickstart
1 parent d25c1e7 commit 7d4767d

File tree

10 files changed

+95
-55
lines changed

10 files changed

+95
-55
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,15 @@ For testing, we use [pytest](https://docs.pytest.org/en/stable/).
7474
We use [gofmt](https://pkg.go.dev/cmd/gofmt) for Golang code style.
7575
For testing, we use [Ginkgo](https://github.com/onsi/ginkgo) and [Gomega](https://github.com/onsi/gomega).
7676

77+
## License Header
78+
79+
We use our scripts/format_license.py to add the license header to the code.
80+
81+
```
82+
./scripts/format_license.py
83+
```
84+
85+
It will add the license header based on the LICENSE file to the code and remove/replace the existing license header. Note: both agent and operator automatically run this script when you run `make fmt`.
86+
87+
88+

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
11
# skyhook
22

3-
Skyhook was developed for modifying the underlying host OS in Kubernetes clusters. Think of it as a package manager like apt/yum for linux but for whole cluster management. The package manager (Skyhook Operator) manages the lifecycle (install/configure/uninstall/upgrade) of the packages (Skyhook Custom Resource, often SCR for short). It is Kubernetes aware, making cluster modifications easy. This enables Skyhook to schedule updates around important workloads and do rolling updates. It can be used in any cluster environment: self-managed clusters, on-prem clusters, cloud clusters, etc.
3+
Skyhook was developed for modifying the underlying host OS in Kubernetes clusters. Think of it as a package manager like apt/yum for linux but for whole cluster management. The package manager (Skyhook Operator) manages the lifecycle (install/configure/uninstall/upgrade) of the packages (Skyhook Custom Resource, often SCR for short). It is Kubernetes aware, making cluster modifications easy. This enables Skyhook to schedule updates around important workloads and do rolling updates. It can be used in any cluster environment: self-managed clusters, on-prem clusters, cloud clusters, etc.
44

5+
## Quick Start
6+
7+
### Install the operator
8+
1. Install cert-manager `kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.2/cert-manager.yaml`
9+
1. Create a secret for the operator to pull images `kubectl create secret generic node-init-secret --from-file=.dockerconfigjson=${HOME}/.config/containers/auth.json --type=kubernetes.io/dockerconfigjson -n skyhook`
10+
1. Install the operator `helm install skyhook ./chart --namespace skyhook`
11+
12+
### Install a package
13+
Example package using shellscript, put this in a file called `demo.yaml` and apply it with `kubectl apply -f demo.yaml`
14+
```
15+
apiVersion: skyhook.nvidia.com/v1alpha1
16+
kind: Skyhook
17+
metadata:
18+
labels:
19+
app.kubernetes.io/part-of: skyhook-operator
20+
app.kubernetes.io/created-by: skyhook-operator
21+
name: demo
22+
spec:
23+
nodeSelectors:
24+
matchLabels:
25+
skyhook.nvidia.com/test-node: demo
26+
packages:
27+
tuning:
28+
version: 1.1.0
29+
image: ghcr.io/nvidia/skyhook-packages/shellscript
30+
configMap:
31+
apply.sh: |-
32+
#!/bin/bash
33+
echo "hello world" > /skyhook-hello-world
34+
sleep 5
35+
apply_check.sh: |-
36+
#!/bin/bash
37+
cat /skyhook-hello-world
38+
sleep 5
39+
config.sh: |-
40+
#!/bin/bash
41+
echo "a config is run" >> /skyhook-hello-world
42+
sleep 5
43+
config_check.sh: |-
44+
#!/bin/bash
45+
grep "config" /skyhook-hello-world
46+
sleep 5
47+
```
48+
49+
### Watch Skyhook apply the package
50+
```
51+
kubectl get pods -w -n skyhook
52+
```
53+
There will a pod for each lifecycle stage (apply, config) in this case.
54+
55+
### Check the package
56+
```
57+
kubectl describe skyhooks.skyhook.nvidia.com/demo
58+
```
59+
The Status will show the overall package status as well as the status of each node
60+
61+
### Check the annotations on the node using the label
62+
```
63+
kubectl get nodes -o jsonpath='{range .items[?(@.metadata.labels.skyhook\.nvidia\.com/test-node=="demo")]}{.metadata.annotations.skyhook\.nvidia\.com/nodeState_demo}{"\n"}{end}'
64+
```
65+
566
## Benefits
667
- The requested changes (the Packages) are native Kubernetes resources they can be combined and applied with common tools like ArgoCD, Helm, Flux etc. This means that all the tooling to manage applications can package customizations right alongside them to get applied, removed and upgraded as the applications themselves are.
768
- Autoscaling, with skyhook if you want to enable autoscaling on your cluster but need to modify all Nodes added to a cluster, you need something that is kubernetes aware. Skyhook as feature to make sure you nodes are ready before then enter the cluster.

agent/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
VENV := ./venv/bin/
16-
REGISTRY ?= nvcr.io
17-
AGENT_IMAGE ?= nvidian/swgpu-baseos/skyhook-agent
16+
REGISTRY ?= ghcr.io
17+
AGENT_IMAGE ?= nvidia/skyhook/agent
1818
DOCKER_CMD ?= docker
1919

2020
.PHONY: all
@@ -37,6 +37,13 @@ test: venv ## Test using hatch, prints coverage and outputs a report to coverage
3737
$(VENV)coverage report --show-missing --data-file=skyhook-agent/.coverage
3838
$(VENV)coverage xml --data-file=skyhook-agent/.coverage
3939

40+
.PHONY: license-fmt
41+
license-fmt: ## Run add license header to code.
42+
python3 scripts/format_license.py --root-dir . --license-file ../LICENSE
43+
44+
.PHONY: fmt
45+
fmt: license-fmt ## Run go fmt against code.
46+
@echo "formattted"
4047

4148
##@ Build
4249
.PHONY: build

agent/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ A basic example of using a container overlay
1313
1. Do code changes
1414
1. Write unit tests for code changes
1515
1. Run `make test` to run the tests
16+
1. Run `make fmt` to format the code
1617
1. Push code to and make an MR
1718

1819
### Container Image Build

agent/skyhook-agent/src/skyhook_agent/config.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,6 @@
1919
#
2020

2121

22-
23-
#
24-
# LICENSE START
25-
#
26-
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
27-
#
28-
# Licensed under the Apache License, Version 2.0 (the "License");
29-
# you may not use this file except in compliance with the License.
30-
# You may obtain a copy of the License at
31-
#
32-
# http://www.apache.org/licenses/LICENSE-2.0
33-
#
34-
# Unless required by applicable law or agreed to in writing, software
35-
# distributed under the License is distributed on an "AS IS" BASIS,
36-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37-
# See the License for the specific language governing permissions and
38-
# limitations under the License.
39-
#
40-
# LICENSE END
41-
#
42-
43-
#
44-
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
45-
#
46-
# Licensed under the Apache License, Version 2.0 (the "License");
47-
# you may not use this file except in compliance with the License.
48-
# You may obtain a copy of the License at
49-
#
50-
# http://www.apache.org/licenses/LICENSE-2.0
51-
#
52-
# Unless required by applicable law or agreed to in writing, software
53-
# distributed under the License is distributed on an "AS IS" BASIS,
54-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
55-
# See the License for the specific language governing permissions and
56-
# limitations under the License.
57-
#
58-
59-
6022
from enum import Enum
6123
import json
6224
import os, sys

chart/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ rbac:
104104
createSkyhookEditorRole: false
105105
## imagePullSecret: is the secret used to pull the operator controller image, agent image, and package images.
106106
imagePullSecret: node-init-secret
107+
## useHostNetwork: Whether the Operator pods should use hostNetwork: true or false
107108
useHostNetwork: false
108109
## estimatedPackageCount: estimated number of packages to be installed on the cluster
109110
## this is used to calculate the resources for the operator controller

kyverno/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
config.sh: |-
5757
#!/bin/bash
5858
echo "hello"
59-
image: shellscript
59+
image: ghcr.io/nvidia/skyhook-packages/shellscript
6060
version: 1.3.2
6161

6262
# This will be blocked by the policy

kyverno/disable_packages.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
# LICENSE END
1919
#
2020

21-
22-
23-
24-
25-
26-
2721
# This is an example to show how to restrict the images that can be used in a Skyhook package.
2822
# It is not a complete policy and it is expected end users will alter rules to fit their security needs.
2923
apiVersion: kyverno.io/v1
@@ -56,7 +50,7 @@ spec:
5650
deny:
5751
conditions:
5852
any:
59-
- key: "{{ regex_match('nvcr.io/nvidian/swgpu-baseos/shellscript', '{{request.object.spec.packages.*.image}}' ) }}"
53+
- key: "{{ regex_match('ghcr.io/nvidia/skyhook-packages/shellscript', '{{request.object.spec.packages.*.image}}' ) }}"
6054
operator: Equals
6155
value: true
6256
- key: "{{ regex_match('docker.io/.*', '{{request.object.spec.packages.*.image}}' ) }}"

operator/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,15 @@ license-report: go-licenses ## Run run license report
120120
license-check: go-licenses ## Run go-licenses check against code.
121121
$(LOCALBIN)/go-licenses check ./... --allowed_licenses=MIT,BSD-2-Clause,BSD-3-Clause,Apache-2.0,ISC,Zlib
122122

123+
.PHONY: license-fmt
124+
license-fmt: ## Run add license header to code.
125+
python3 scripts/format_license.py --root-dir . --license-file ../LICENSE
126+
123127
.PHONY: fmt
124-
fmt: ## Run go fmt against code.
128+
fmt: license-fmt ## Run go fmt against code.
125129
go fmt $(GOFLAGS) ./...
126130

131+
127132
.PHONY: vet
128133
vet: ## Run go vet against code.
129134
go vet $(GOFLAGS) ./...

operator/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,10 @@ Build Dependencies
173173
174174
# Deployment
175175
176-
The helm repos are here:
177-
- [Prod - https://helm.ngc.nvidia.com/nv-ngc-devops/skyhook-operator](https://helm.ngc.nvidia.com/nv-ngc-devops/skyhook-operator)
178-
- [Dev - https://helm.ngc.nvidia.com/nvidian/swgpu-baseos/skyhook-operator](https://helm.ngc.nvidia.com/nvidian/swgpu-baseos/skyhook-operator)
176+
The helm repos are currently being migrated. Please use the chart directly in this repo.
179177
180178
Operator containers:
181-
- [Prod - nvcr.io/nv-ngc-devops/skyhook-operator](https://nvcr.io/nv-ngc-devops/skyhook-operator)
182-
- [Dev - nvcr.io/nvidian/swgpu-baseos/skyhook-operator](https://nvcr.io/nvidian/swgpu-baseos/skyhook-operator)
179+
- ghcr.io/nvidia/skyhook/operator
183180
184181
## Deploy from main
185182

0 commit comments

Comments
 (0)