-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test ci * make sure if docker daemon does not start any containers, we fail * fix image * add minio enterprise * test perms * update lib funcs * named arsg * fix indents * imports * fix identation * check if db is needed * add todo * one omre * add dep * fix * add macros * auto perms * remove dummy file * fix values * updates * minio perms * abstract away * cleaner * safer,cleaner * new storage funcs * storage options * use built ins * rename * spelling * rename * add vol suport * test vol * manually add container name * volumes * cleaner vols * do some renames * renames * squash * add todo * move few things to the lib, currently broken * more dynamic container names * fix message * cleanup * update app * spelling * remove port * more fixes * fix pg test * hm * thats better * fmt * back to jinja * duh * wait for it * typo * typo * ui * fix checks * todo * items is a builtin * fixes * resources * resources * -.- * ... * use lib * add rough migration paths * Update docker-compose.yaml * Update docker-compose.yaml * move usages under value * update usages * cleanup * fix url * order * another url * fix * fix hc too * update app.yaml * update lib * update lib * update lib * update lib * update lib * update lib * update lib * update lib * lint * update lib * fix ixvol * update lib * update lib * update lib * remove logsearch/postgres * fmt * replace set _ * update lib * adapt to lib changes * update lib * update lib * update lib * update lib * update lib * update lib * sync library * updates * update lib * update compose * typo * update ci checks * now actually fix app * add migration * fix migration and update error message * order * remove test data * update readme * fix ui
- Loading branch information
Showing
36 changed files
with
2,276 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# MinIO | ||
|
||
[MinIO](https://min.io) is a High Performance Object Storage released under Apache License v2.0. | ||
It is API compatible with Amazon S3 cloud storage service. Use MinIO to build high performance infrastructure | ||
for machine learning, analytics and application data workloads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
app_version: '2023-12-07' | ||
capabilities: [] | ||
categories: | ||
- networking | ||
description: High Performance, Kubernetes Native Object Storage | ||
home: https://min.io | ||
host_mounts: [] | ||
icon: https://media.sys.truenas.net/apps/minio/icons/icon.png | ||
keywords: | ||
- object storage | ||
- minio | ||
- cloud | ||
- s3 | ||
lib_version: 1.0.0 | ||
lib_version_hash: 317726af1e56541666942aeebcc7543e6f0946f96c322d35b612c0f2f7189a88 | ||
maintainers: | ||
- email: [email protected] | ||
name: truenas | ||
url: https://www.truenas.com/ | ||
name: minio | ||
run_as_context: | ||
- description: MinIO runs as any non-root user. | ||
gid: 568 | ||
group_name: minio | ||
uid: 568 | ||
user_name: minio | ||
screenshots: | ||
- https://media.sys.truenas.net/apps/adguard-home/screenshots/screenshot1.png | ||
- https://media.sys.truenas.net/apps/adguard-home/screenshots/screenshot2.png | ||
sources: | ||
- https://github.com/minio/minio | ||
title: MinIO | ||
train: enterprise | ||
version: 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
categories: | ||
- networking | ||
icon_url: https://media.sys.truenas.net/apps/minio/icons/icon.png | ||
screenshots: | ||
- https://media.sys.truenas.net/apps/adguard-home/screenshots/screenshot1.png | ||
- https://media.sys.truenas.net/apps/adguard-home/screenshots/screenshot2.png | ||
tags: | ||
- object storage | ||
- minio | ||
- cloud | ||
- s3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
images: | ||
image: | ||
repository: minio/minio | ||
tag: RELEASE.2023-12-07T04-16-00Z | ||
|
||
consts: | ||
minio_container_name: minio | ||
perms_container_name: permissions |
58 changes: 58 additions & 0 deletions
58
ix-dev/enterprise/minio/migrations/migrate_from_kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/python3 | ||
|
||
import os | ||
import sys | ||
import yaml | ||
|
||
from migration_helpers.resources import migrate_resources | ||
from migration_helpers.storage import migrate_storage_item | ||
|
||
|
||
def migrate(values): | ||
config = values.get("helm_secret", {}).get("config", {}) | ||
if not config: | ||
raise ValueError("No config found in values") | ||
|
||
new_values = { | ||
"minio": { | ||
"credentials": { | ||
"access_key": config["minioCreds"]["rootUser"], | ||
"secret_key": config["minioCreds"]["rootPass"], | ||
}, | ||
"logging": { | ||
"quiet": config["minioLogging"]["quiet"], | ||
"anonymous": config["minioLogging"]["anonymous"], | ||
}, | ||
"multi_mode": { | ||
"enabled": config["enableMultiMode"], | ||
"entries": config.get("minioMultiMode", []), | ||
}, | ||
}, | ||
"run_as": { | ||
"user": config["minioRunAs"].get("user", 568), | ||
"group": config["minioRunAs"].get("group", 568), | ||
}, | ||
"network": { | ||
"api_port": config["minioNetwork"]["apiPort"], | ||
"console_port": config["minioNetwork"]["webPort"], | ||
"host_network": config["minioNetwork"]["hostNetwork"], | ||
"certificate_id": config["minioNetwork"].get("certificateID", None), | ||
"server_url": config["minioNetwork"]["serverUrl"], | ||
"console_url": config["minioNetwork"]["consoleUrl"], | ||
}, | ||
"storage": { | ||
"data_dirs": [migrate_storage_item(item) for item in config["minioStorage"]] | ||
}, | ||
"resources": migrate_resources(config["resources"]), | ||
} | ||
|
||
return new_values | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
exit(1) | ||
|
||
if os.path.exists(sys.argv[1]): | ||
with open(sys.argv[1], "r") as f: | ||
print(yaml.dump(migrate(yaml.safe_load(f.read())))) |
Empty file.
27 changes: 27 additions & 0 deletions
27
ix-dev/enterprise/minio/migrations/migration_helpers/cpu.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import math | ||
import re | ||
import os | ||
|
||
CPU_COUNT = os.cpu_count() | ||
|
||
NUMBER_REGEX = re.compile(r"^[1-9][0-9]$") | ||
FLOAT_REGEX = re.compile(r"^[0-9]+\.[0-9]+$") | ||
MILI_CPU_REGEX = re.compile(r"^[0-9]+m$") | ||
|
||
|
||
def transform_cpu(cpu) -> int: | ||
result = 2 | ||
if NUMBER_REGEX.match(cpu): | ||
result = int(cpu) | ||
elif FLOAT_REGEX.match(cpu): | ||
result = int(math.ceil(float(cpu))) | ||
elif MILI_CPU_REGEX.match(cpu): | ||
num = int(cpu[:-1]) | ||
num = num / 1000 | ||
result = int(math.ceil(num)) | ||
|
||
if CPU_COUNT is not None: | ||
# Do not exceed the actual CPU count | ||
result = min(result, CPU_COUNT) | ||
|
||
return result |
9 changes: 9 additions & 0 deletions
9
ix-dev/enterprise/minio/migrations/migration_helpers/dns_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def migrate_dns_config(dns_config): | ||
if not dns_config: | ||
return [] | ||
|
||
dns_opts = [] | ||
for opt in dns_config.get("options", []): | ||
dns_opts.append(f"{opt['name']}:{opt['value']}") | ||
|
||
return dns_opts |
15 changes: 15 additions & 0 deletions
15
ix-dev/enterprise/minio/migrations/migration_helpers/kubernetes_secrets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
def get_value_from_secret(secrets={}, secret_name="", key=""): | ||
if not secrets or not secret_name or not key: | ||
raise ValueError("Expected [secrets], [secret_name] and [key] to be set") | ||
for secret in secrets.items(): | ||
curr_secret_name = secret[0] | ||
curr_data = secret[1] | ||
|
||
if curr_secret_name.endswith(secret_name): | ||
if not curr_data.get(key, None): | ||
raise ValueError( | ||
f"Expected [{key}] to be set in secret [{curr_secret_name}]" | ||
) | ||
return curr_data[key] | ||
|
||
raise ValueError(f"Secret [{secret_name}] not found") |
49 changes: 49 additions & 0 deletions
49
ix-dev/enterprise/minio/migrations/migration_helpers/memory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import re | ||
import math | ||
import psutil | ||
|
||
TOTAL_MEM = psutil.virtual_memory().total | ||
|
||
SINGLE_SUFFIX_REGEX = re.compile(r"^[1-9][0-9]*([EPTGMK])$") | ||
DOUBLE_SUFFIX_REGEX = re.compile(r"^[1-9][0-9]*([EPTGMK])i$") | ||
BYTES_INTEGER_REGEX = re.compile(r"^[1-9][0-9]*$") | ||
EXPONENT_REGEX = re.compile(r"^[1-9][0-9]*e[0-9]+$") | ||
|
||
SUFFIX_MULTIPLIERS = { | ||
"K": 10**3, | ||
"M": 10**6, | ||
"G": 10**9, | ||
"T": 10**12, | ||
"P": 10**15, | ||
"E": 10**18, | ||
} | ||
|
||
DOUBLE_SUFFIX_MULTIPLIERS = { | ||
"Ki": 2**10, | ||
"Mi": 2**20, | ||
"Gi": 2**30, | ||
"Ti": 2**40, | ||
"Pi": 2**50, | ||
"Ei": 2**60, | ||
} | ||
|
||
|
||
def transform_memory(memory): | ||
result = 4096 # Default to 4GB | ||
|
||
if re.match(SINGLE_SUFFIX_REGEX, memory): | ||
suffix = memory[-1] | ||
result = int(memory[:-1]) * SUFFIX_MULTIPLIERS[suffix] | ||
elif re.match(DOUBLE_SUFFIX_REGEX, memory): | ||
suffix = memory[-2:] | ||
result = int(memory[:-2]) * DOUBLE_SUFFIX_MULTIPLIERS[suffix] | ||
elif re.match(BYTES_INTEGER_REGEX, memory): | ||
result = int(memory) | ||
elif re.match(EXPONENT_REGEX, memory): | ||
result = int(float(memory)) | ||
|
||
result = math.ceil(result) | ||
result = min(result, TOTAL_MEM) | ||
# Convert to Megabytes | ||
result = result / 1024 / 1024 | ||
return int(result) |
Oops, something went wrong.