Skip to content

Commit 5c50552

Browse files
committed
PENG-2364 initialize the vantage agent charm project
1 parent 0a14895 commit 5c50552

17 files changed

+658
-0
lines changed

.github/workflows/test.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test
2+
3+
on: pull_request
4+
5+
jobs:
6+
lint-charms:
7+
name: "Lint the charms"
8+
runs-on: "ubuntu-latest"
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- uses: actions/setup-python@v5
13+
with:
14+
architecture: 'x64'
15+
16+
- name: "Install tox, run 'make lint'"
17+
run: |
18+
pip install tox==4.18.0
19+
tox -e lint

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*/.mypy_cache/
2+
build/
3+
*.charm
4+
license-manager-agent.yaml
5+
version
6+
.venv
7+
.tox
8+
.ruff_cache

.jujuignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.pytest_cache
2+
/build
3+
/.tox
4+
__pycache__
5+
6+
/vantage-agent
7+
/.vscode

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.3

CHANGELOG.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
==========
2+
Change Log
3+
==========
4+
5+
This file keeps track of all notable changes to the Vantage Agents Charm.
6+
7+
Unreleased
8+
----------
9+
10+
1.0.0 - 2023-03-07
11+
------------------
12+
* Create the project

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 OmniVector Corp
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.PHONY: help
2+
help:
3+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
4+
5+
.PHONY: lint
6+
lint: ## Run linter
7+
tox -e lint
8+
9+
version: ## Create/update version file
10+
@git describe --tags --dirty --always > version
11+
12+
.PHONY: clean
13+
clean: ## Remove build dirs, temp files, and charms
14+
rm -rf .venv/
15+
rm -rf build
16+
rm -rf version
17+
find . -name "*.charm" -delete
18+
19+
.PHONY: charm
20+
charm: version ## Pack the charm
21+
@charmcraft pack
22+
@mv license-manager-agent_*.charm license-manager-agent.charm

actions.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
upgrade-vtg:
2+
description: >
3+
Upgrade vantage agent.
4+
params:
5+
version:
6+
type: string
7+
description: Version of vantage agent to upgrade to.
8+
required:
9+
- version

charmcraft.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type: charm
2+
bases:
3+
- build-on:
4+
- name: ubuntu
5+
channel: "22.04"
6+
run-on:
7+
- name: ubuntu
8+
channel: "20.04"
9+
architectures: [amd64]
10+
- name: ubuntu
11+
channel: "22.04"
12+
architectures: [amd64]
13+
parts:
14+
charm:
15+
charm-python-packages: [setuptools]

config.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
options:
2+
# Resource URL
3+
base-api-url:
4+
type: string
5+
default: ""
6+
description: |
7+
The License Manager API URL
8+
9+
# Slurm related setings
10+
scontrol-path:
11+
type: string
12+
default: "/usr/bin/scontrol"
13+
description: |
14+
Absolute path to the scontrol command
15+
16+
# Auth related settings
17+
oidc-domain:
18+
type: string
19+
default: ""
20+
description: |
21+
Domain for the OIDC provider API where auth tokens will be fetched
22+
oidc-client-id:
23+
type: string
24+
default: ""
25+
description: |
26+
The ID for the OIDC provider app client to which tokens will be issued
27+
oidc-client-secret:
28+
type: string
29+
default: ""
30+
description: |
31+
The secret key for the OIDC provider app client to which tokens will be issued
32+
33+
task-jobs-interval-seconds:
34+
type: int
35+
default: 30
36+
description: |
37+
The interval in seconds at which the agent will run internal jobs
38+
task-self-update-interval-seconds:
39+
type: int
40+
default: 30
41+
description: |
42+
The interval in seconds at which the agent will check for version updates
43+
44+
# Other settings
45+
cache-dir:
46+
type: string
47+
default: "/var/cache/vantage-agent"
48+
description: |
49+
Absolute path to the cache directory

dispatch

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# This hook installs the dependencies needed to run the charm,
3+
# creates the dispatch executable, regenerates the symlinks for start and
4+
# upgrade-charm, and kicks off the operator framework.
5+
6+
set -e
7+
8+
# Source the os-release information into the env
9+
. /etc/os-release
10+
11+
PYTHON_BIN=/opt/python/python3.12/bin/python3.12
12+
13+
if ! [[ -f '.installed' ]]
14+
then
15+
if [[ ! -e $PYTHON_BIN ]]
16+
then
17+
if [[ $ID == 'rocky' ]]
18+
then
19+
# Install dependencies to build custom python
20+
yum -y install epel-release
21+
yum -y install wget gcc make tar bzip2-devel zlib-devel xz-devel openssl-devel libffi-devel sqlite-devel ncurses-devel xz-devel gdbm tk-devel readline-devel sqlite-devel libnsl2-devel
22+
23+
# Install yaml deps
24+
yum -y install libyaml-devel
25+
fi
26+
27+
if [[ $ID == 'ubuntu' ]]
28+
then
29+
# Install dependencies to build custom python
30+
apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
31+
fi
32+
33+
export PYTHON_VERSION=3.12.1
34+
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -P /tmp
35+
tar xvf /tmp/Python-${PYTHON_VERSION}.tar.xz -C /tmp
36+
cd /tmp/Python-${PYTHON_VERSION}
37+
./configure --prefix=/opt/python/python3.12 --enable-optimizations
38+
make -C /tmp/Python-${PYTHON_VERSION} -j $(nproc) altinstall
39+
cd $OLDPWD
40+
rm -rf /tmp/Python*
41+
fi
42+
touch .installed
43+
fi
44+
45+
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv $PYTHON_BIN ./src/charm.py

metadata.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: vantage-agent
2+
display-name: Vantage Agent
3+
summary: Vantage Agent package lifecycle encapsulated in a charm
4+
maintainers:
5+
- Omnivector Corp <[email protected]>
6+
description: |
7+
This charm provides the Vantage Agent component of vantage.
8+
It is a wrapper around the vantage-agent package, which is the core agent component of Vantage alongside the Jobbergate Agent.
9+
tags:
10+
- vantage
11+
- hpc
12+
13+
subordinate: true
14+
15+
series:
16+
- centos7
17+
- centos8
18+
- focal
19+
- jammy
20+
21+
requires:
22+
juju-info:
23+
interface: juju-info
24+
scope: container
25+
prolog-epilog:
26+
interface: prolog-epilog
27+
fluentbit:
28+
interface: fluentbit

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ops==1.3.0
2+
hatch>=1.11.0

0 commit comments

Comments
 (0)