Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation with Helm and doc rework #293

Merged
merged 16 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
8 changes: 1 addition & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run plugin
run: |
git clone https://github.com/interTwin-eu/interlink-slurm-plugin.git \
&& cd interlink-slurm-plugin/docker \
&& docker compose up -d
- name: Get Repo Owner
id: get_repo_owner
run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
Expand All @@ -25,7 +20,6 @@ jobs:
with:
workdir: ci
verb: call
args: -s --name slurm-test build-images new-interlink --plugin-endpoint tcp://localhost:4000 test stdout
args: -s --name slurm-test build-images new-interlink test stdout
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
version: "0.13.0"
#dagger-flags: -d
18 changes: 15 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ builds:
- arm64
- amd64
main: ./cmd/virtual-kubelet
- id: "interlink"
- id: "interlink-api"
binary: interlink
hooks:
pre: bash -c "KUBELET_VERSION={{.Version}} ./cmd/virtual-kubelet/set-version.sh"
Expand All @@ -32,8 +32,8 @@ builds:
- amd64
- ppc64le
main: ./cmd/interlink
- id: "interlink-install"
binary: interlink-install
- id: "installer"
binary: interlink-installer
env:
- CGO_ENABLED=0
goos:
Expand All @@ -44,6 +44,18 @@ builds:
- amd64
- ppc64le
main: ./cmd/installer
- id: "ssh-tunnel"
binary: ssh-tunnel
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- arm64
- amd64
- ppc64le
main: ./cmd/ssh-tunnel
archives:
- name_template: >-
{{ .Binary }}_
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: interlink vk installer
all: interlink vk installer ssh-tunnel

interlink:
CGO_ENABLED=0 OOS=linux go build -o bin/interlink cmd/interlink/main.go
Expand All @@ -9,16 +9,16 @@ vk:
installer:
CGO_ENABLED=0 OOS=linux go build -o bin/installer cmd/installer/main.go

ssh-tunnel:
CGO_ENABLED=0 OOS=linux go build -o bin/ssh-tunnel cmd/ssh-tunnel/main.go

clean:
rm -rf ./bin

dagger_registry_delete:
docker rm -fv registry || true

test:
dagger_registry_delete
docker run -d --rm --name registry -p 5432:5000 registry
cd ci
dagger go run go main.go k8s.go
cd -
dagger call -m ./ci \
--name my-tests \
build-images \
new-interlink \
test stdout

7 changes: 4 additions & 3 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func New(name string,
// +default="ghcr.io/intertwin-eu/interlink/interlink:0.3.1-rc1"
InterlinkRef string,
// +optional
// +default="ghcr.io/intertwin-eu/interlink-docker-plugin/docker-plugin:0.0.24-no-gpu"
// +default="ghcr.io/intertwin-eu/interlink-sidecar-slurm/interlink-sidecar-slurm:0.3.2"
pluginRef string,
) *Interlink {

Expand Down Expand Up @@ -111,9 +111,10 @@ func (m *Interlink) NewInterlink(
if pluginEndpoint == nil {
plugin := dag.Container().From(m.PluginRef).
WithFile("/etc/interlink/InterLinkConfig.yaml", pluginConfig).
WithEnvVariable("INTERLINKCONFIGPATH", "/etc/interlink/InterLinkConfig.yaml").
WithEnvVariable("SLURMCONFIGPATH", "/etc/interlink/InterLinkConfig.yaml").
WithEnvVariable("SHARED_FS", "true").
WithExposedPort(4000).
WithExec([]string{"bash", "-c", "dockerd --mtu 1450 & /sidecar/docker-sidecar"}, dagger.ContainerWithExecOpts{UseEntrypoint: false, InsecureRootCapabilities: true})
WithExec([]string{}, dagger.ContainerWithExecOpts{UseEntrypoint: true, InsecureRootCapabilities: true})

pluginEndpoint, err = plugin.AsService().Start(ctx)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions ci/manifests/plugin-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ VerboseLogging: true
ErrorsOnlyLogging: false
ExportPodData: true
# NEEDED PATH FOR GITHUB ACTIONS
DataRootFolder: "/home/runner/work/interLink/interLink/.interlink/"
#DataRootFolder: "/home/runner/work/interLink/interLink/.interlink/"
# on your host use something like:
#DataRootFolder: "/home/ubuntu/.interlink/"
DataRootFolder: "/home/ubuntu/.interlink/"
SbatchPath: "/usr/bin/sbatch"
ScancelPath: "/usr/bin/scancel"
SqueuePath: "/usr/bin/squeue"
Expand Down
26 changes: 4 additions & 22 deletions cmd/installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,39 +211,21 @@ func root(cmd *cobra.Command, args []string) error {
panic(fmt.Errorf("wrong grant type specified in the configuration. Only client_credentials and authorization_code are supported"))
}

namespaceYAML, err := evalManifest("templates/namespace.yaml", configCLI)
if err != nil {
panic(err)
}

deploymentYAML, err := evalManifest("templates/deployment.yaml", configCLI)
if err != nil {
panic(err)
}

configYAML, err := evalManifest("templates/configs.yaml", configCLI)
if err != nil {
panic(err)
}

serviceaccountYAML, err := evalManifest("templates/service-account.yaml", configCLI)
valuesYAML, err := evalManifest("templates/values.yaml", configCLI)
if err != nil {
panic(err)
}

manifests := []string{
namespaceYAML,
serviceaccountYAML,
configYAML,
deploymentYAML,
valuesYAML,
}

err = os.MkdirAll(outFolder, fs.ModePerm)
if err != nil {
panic(err)
}
// Create a file and use bufio.NewWriter.
f, err := os.Create(outFolder + "/interlink.yaml")
f, err := os.Create(outFolder + "/values.yaml")
if err != nil {
panic(err)
}
Expand All @@ -258,7 +240,7 @@ func root(cmd *cobra.Command, args []string) error {

w.Flush()

fmt.Println("\n\n=== Deployment file written at: " + outFolder + "/interlink.yaml ===\n\n To deploy the virtual kubelet run:\n kubectl apply -f " + outFolder + "/interlink.yaml")
fmt.Println("\n\n=== Deployment file written at: " + outFolder + "/values.yaml ===\n\n To deploy the virtual kubelet run:\n helm --debug upgrade --install --create-namespace -n " + configCLI.Namespace + " " + configCLI.VKName + " oci://ghcr.io/intertwin-eu/interlink-helm-chart/interlink --values " + outFolder + "/values.yaml")

// TODO: ilctl.sh templating
tmpl, err := template.ParseFS(templates, "templates/interlink-install.sh")
Expand Down
17 changes: 0 additions & 17 deletions cmd/installer/templates/configs.yaml

This file was deleted.

89 changes: 0 additions & 89 deletions cmd/installer/templates/deployment.yaml

This file was deleted.

27 changes: 16 additions & 11 deletions cmd/installer/templates/interlink-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ install () {
mkdir -p $HOME/.interlink/logs || exit 1
mkdir -p $HOME/.interlink/bin || exit 1
mkdir -p $HOME/.interlink/config || exit 1
# set $HOME/.interlink/config/InterLinkConfig.yaml


# TODO download also service files for systemd

cat <<EOF >>$HOME/.interlink/config/InterLinkConfig.yaml
InterlinkAddress: "http://localhost"
InterlinkPort: "30080"
SidecarURL: "http://localhost"
SidecarPort: "4000"
InterlinkAddress: "unix://${HOME}/.interlink/interlink.sock"
InterlinkPort: "0"
SidecarURL: "unix://${HOME}/.interlink/plugin.sock"
SidecarPort: "0"
VerboseLogging: true
ErrorsOnlyLogging: false
ExportPodData: true
DataRootFolder: "~/.interlink"
EOF

echo "=== Configured to reach sidecar service on http://localhost:4000 . You can edit this behavior changing $HOME/.interlink/config/InterLinkConfig.yaml file. ==="
echo "=== Configured to reach sidecar service on unix://${HOME}/.interlink/plugin.sock. You can edit this behavior changing $HOME/.interlink/config/InterLinkConfig.yaml file. ==="

## Download binaries to $HOME/.local/interlink/
echo "curl --fail -L -o ${HOME}/.interlink/bin/interlink https://github.com/interTwin-eu/interLink/releases/download/{{.InterLinkVersion}}/interlink_$(uname -s)_$(uname -m)"
Expand Down Expand Up @@ -89,7 +91,7 @@ start() {
$HOME/.interlink/bin/oauth2-proxy \
--client-id "{{.OAUTH.ClientID}}" \
--client-secret "\"{{.OAUTH.ClientSecret}}\"" \
--http-address 0.0.0.0:{{.InterLinkPort}} \
--http-address unix://${HOME}/.interlink/interlink.sock \
--oidc-issuer-url "{{.OAUTH.Issuer}}" \
--pass-authorization-header true \
--provider oidc \
Expand All @@ -112,10 +114,11 @@ start() {
echo $! > $HOME/.interlink/oauth2-proxy.pid
;;
github)
touch $HOME/.interlink/interlink.sock
$HOME/.interlink/bin/oauth2-proxy \
--client-id {{.OAUTH.ClientID}} \
--client-secret {{.OAUTH.ClientSecret}} \
--http-address 0.0.0.0:{{.InterLinkPort}} \
--http-address unix://$HOME/.interlink/interlink.sock \
--pass-authorization-header true \
--provider github \
--redirect-url http://localhost:8081 \
Expand All @@ -137,9 +140,11 @@ start() {
esac

## start interLink
export INTERLINKCONFIGPATH=$HOME/.interlink/config/InterLinkConfig.yaml
$HOME/.interlink/bin/interlink &> $HOME/.interlink/logs/interlink.log &
echo $! > $HOME/.interlink/interlink.pid
export INTERLINKCONFIGPATH=${HOME}/.interlink/config/InterLinkConfig.yaml
$HOME/.interlink/bin/interlink &> ${HOME}/.interlink/logs/interlink.log &
echo $! > ${HOME}/.interlink/interlink.pid

## TODO: if RUN_SLURM=1 then manage also slurm

}

Expand Down
4 changes: 0 additions & 4 deletions cmd/installer/templates/namespace.yaml

This file was deleted.

Loading
Loading