Skip to content

Commit

Permalink
build: add aisinit container with default config
Browse files Browse the repository at this point in the history
Signed-off-by: Prashanth Dintyala <[email protected]>
  • Loading branch information
saiprashanth173 committed Nov 19, 2024
1 parent 898d2ba commit 85fba48
Show file tree
Hide file tree
Showing 7 changed files with 519 additions and 61 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on:
type: boolean
default: false

build_aisinit_image:
description: 'Build aisinit image (aistorage/ais-init)'
required: true
type: boolean
default: false

build_cluster_minimal_image:
description: 'Build cluster-minimal image (aistorage/cluster-minimal)'
required: true
Expand All @@ -41,6 +47,7 @@ on:
env:
UTIL_IMAGE: 'aistorage/ais-util'
AISNODE_IMAGE: 'aistorage/aisnode'
AISINIT_IMAGE: 'aistorage/ais-init'
CLUSTER_MINIMAL_IMAGE: 'aistorage/cluster-minimal'
CI_IMAGE: 'aistorage/ci'
AISNODE_MINIKUBE_IMAGE: 'aistorage/aisnode-minikube'
Expand Down Expand Up @@ -73,6 +80,13 @@ jobs:
IMAGE_REPO="${{ env.AISNODE_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `ais-init` image
if: ${{ inputs.build_aisinit_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/aisinit_container
IMAGE_REPO="${{ env.AISINIT_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `aisnode` image with tracing support
if: ${{ inputs.build_aisnode_image }}
run: |
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ cli-autocompletions: ## Add CLI autocompletions
authn: build-authn ## Build AuthN
aisloader: build-aisloader ## Build aisloader
xmeta: build-xmeta ## Build xmeta
aisinit: build-aisinit ## Build aisinit

build-%:
@echo -n "Building $*... "
Expand Down
130 changes: 69 additions & 61 deletions api/env/ais.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,75 +13,83 @@ package env
// See also:
// - docs/environment-vars.md

var (
AIS = struct {
// endpoint: client | primary startup
Endpoint string
PrimaryEP string
var AIS = struct {
// endpoint: client | primary startup
Endpoint string
PrimaryEP string

// networking: two CIDR masks
LocalRedirectCIDR string
PubIPv4CIDR string
// networking: two CIDR masks
LocalRedirectCIDR string
PubIPv4CIDR string

//
// HTTPS
// for details and background, see: https://github.com/NVIDIA/aistore/blob/main/docs/environment-vars.md#https
//
UseHTTPS string
// TLS: client side
Certificate string
CertKey string
ClientCA string
SkipVerifyCrt string
// TLS: server (aistore, AuthN) side (NOTE comment below)
//
// HTTPS
// for details and background, see: https://github.com/NVIDIA/aistore/blob/main/docs/environment-vars.md#https
//
UseHTTPS string
// TLS: client side
Certificate string
CertKey string
ClientCA string
SkipVerifyCrt string
// TLS: server (aistore, AuthN) side (NOTE comment below)

// tests, CI
NumTarget string
NumProxy string
// tests, CI
NumTarget string
NumProxy string

// K8s
K8sPod string
K8sNode string
K8sNamespace string
}{
// the way to designate primary when cluster's starting up
Endpoint: "AIS_ENDPOINT",
PrimaryEP: "AIS_PRIMARY_EP",
// K8s
K8sPod string
K8sNode string
K8sNamespace string
K8sServiceName string
K8sPublicHostname string
K8sClusterDomain string
K8sHostNetwork string
K8sEnableExternalAccess string
}{
// the way to designate primary when cluster's starting up
Endpoint: "AIS_ENDPOINT",
PrimaryEP: "AIS_PRIMARY_EP",

// two CIDRs, respectively:
// 1. differentiate local (same CIDR) clients for faster HTTP redirect
// 2. at node startup: when present with multiple choices, select one matching local unicast IP
// to use it as node's public interface
LocalRedirectCIDR: "AIS_CLUSTER_CIDR",
PubIPv4CIDR: "AIS_PUBLIC_IP_CIDR",
// two CIDRs, respectively:
// 1. differentiate local (same CIDR) clients for faster HTTP redirect
// 2. at node startup: when present with multiple choices, select one matching local unicast IP
// to use it as node's public interface
LocalRedirectCIDR: "AIS_CLUSTER_CIDR",
PubIPv4CIDR: "AIS_PUBLIC_IP_CIDR",

// false: HTTP transport, with all the TLS config (below) ignored
// true: HTTPS/TLS
// for details and background, see: https://github.com/NVIDIA/aistore/blob/main/docs/environment-vars.md#https
UseHTTPS: "AIS_USE_HTTPS", // cluster config: "net.http.use_https"
// false: HTTP transport, with all the TLS config (below) ignored
// true: HTTPS/TLS
// for details and background, see: https://github.com/NVIDIA/aistore/blob/main/docs/environment-vars.md#https
UseHTTPS: "AIS_USE_HTTPS", // cluster config: "net.http.use_https"

// TLS: client side
Certificate: "AIS_CRT",
CertKey: "AIS_CRT_KEY",
ClientCA: "AIS_CLIENT_CA",
// TLS: client side
Certificate: "AIS_CRT",
CertKey: "AIS_CRT_KEY",
ClientCA: "AIS_CLIENT_CA",

// TLS: server (aistore, AuthN) side
// "AIS_SERVER_CRT" - TLS certificate (pathname)
// "AIS_SERVER_KEY" - private key (ditto)
// TLS: server (aistore, AuthN) side
// "AIS_SERVER_CRT" - TLS certificate (pathname)
// "AIS_SERVER_KEY" - private key (ditto)

// TLS: common
SkipVerifyCrt: "AIS_SKIP_VERIFY_CRT", // cluster config: "net.http.skip_verify"
// TLS: common
SkipVerifyCrt: "AIS_SKIP_VERIFY_CRT", // cluster config: "net.http.skip_verify"

// variables used in tests and CI
NumTarget: "NUM_TARGET",
NumProxy: "NUM_PROXY",
// variables used in tests and CI
NumTarget: "NUM_TARGET",
NumProxy: "NUM_PROXY",

// via ais-k8s repo
// see also:
// * https://github.com/NVIDIA/ais-k8s/blob/main/operator/pkg/resources/cmn/env.go
// * docs/environment-vars.md
K8sPod: "MY_POD",
K8sNode: "MY_NODE",
K8sNamespace: "K8S_NS",
}
)
// via ais-k8s repo
// see also:
// * https://github.com/NVIDIA/ais-k8s/blob/main/operator/pkg/resources/cmn/env.go
// * docs/environment-vars.md
K8sPod: "MY_POD",
K8sNode: "MY_NODE",
K8sNamespace: "K8S_NS",
K8sServiceName: "AIS_K8S_CLUSTER_DOMAIN",
K8sPublicHostname: "AIS_PUBLIC_HOSTNAME",
K8sClusterDomain: "AIS_K8S_CLUSTER_DOMAIN",
K8sHostNetwork: "HOST_NETWORK",
K8sEnableExternalAccess: "ENABLE_EXTERNAL_ACCESS",
}
194 changes: 194 additions & 0 deletions cmd/aisinit/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// Package main contains logic for the aisinit container
/*
* Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
*/
package main

import (
"time"

aisapc "github.com/NVIDIA/aistore/api/apc"
aiscmn "github.com/NVIDIA/aistore/cmn"
"github.com/NVIDIA/aistore/cmn/cos"
)

var (
defaultAuth = aiscmn.AuthConf{
Enabled: false,
}

defaultCksum = aiscmn.CksumConf{
Type: cos.ChecksumXXHash,
ValidateColdGet: false,
}

defaultClientConf = aiscmn.ClientConf{
Timeout: cos.Duration(10 * time.Second),
TimeoutLong: cos.Duration(5 * time.Minute),
ListObjTimeout: cos.Duration(5 * time.Minute),
}

defaultTransport = aiscmn.TransportConf{
MaxHeaderSize: 4096,
Burst: 512,
IdleTeardown: cos.Duration(4 * time.Second),
QuiesceTime: cos.Duration(10 * time.Second),
LZ4BlockMaxSize: cos.SizeIEC(256 * cos.KiB),
}

defaultTCB = aiscmn.TCBConf{
Compression: aisapc.CompressNever,
SbundleMult: 2,
}

defaultDisk = aiscmn.DiskConf{
DiskUtilLowWM: 20,
DiskUtilHighWM: 80,
DiskUtilMaxWM: 95,
IostatTimeLong: cos.Duration(2 * time.Second),
IostatTimeShort: cos.Duration(100 * time.Millisecond),
}

defaultNet = aiscmn.NetConf{
L4: aiscmn.L4Conf{
Proto: "tcp",
},
HTTP: aiscmn.HTTPConf{
UseHTTPS: false,
Chunked: true,
},
}

defaultFSHC = aiscmn.FSHCConf{
TestFileCount: 4,
HardErrs: 2,
IOErrs: 10,
IOErrTime: cos.Duration(10 * time.Second),
Enabled: true,
}

defaultDsort = aiscmn.DsortConf{
Compression: aisapc.CompressNever,
DuplicatedRecords: aiscmn.IgnoreReaction,
MissingShards: aiscmn.IgnoreReaction,
EKMMalformedLine: aisapc.Abort,
EKMMissingKey: aisapc.Abort,
DefaultMaxMemUsage: "80%",
DsorterMemThreshold: "100GB",
CallTimeout: cos.Duration(10 * time.Minute),
SbundleMult: 2,
}

defaultDownloader = aiscmn.DownloaderConf{
Timeout: cos.Duration(time.Hour),
}

defaultEC = aiscmn.ECConf{
Enabled: false,
ObjSizeLimit: 262144,
DataSlices: 2,
ParitySlices: 2,
SbundleMult: 2,
Compression: aisapc.CompressNever,
}

defaultKeepalive = aiscmn.KeepaliveConf{
Proxy: aiscmn.KeepaliveTrackerConf{
Interval: cos.Duration(10 * time.Second),
Name: "heartbeat",
Factor: 3,
},
Target: aiscmn.KeepaliveTrackerConf{
Interval: cos.Duration(10 * time.Second),
Name: "heartbeat",
Factor: 3,
},
RetryFactor: 4,
}

defaultLog = aiscmn.LogConf{
Level: "3",
MaxSize: cos.SizeIEC(4 * cos.MiB),
MaxTotal: cos.SizeIEC(128 * cos.MiB),
FlushTime: cos.Duration(time.Minute),
StatsTime: cos.Duration(3 * time.Minute),
}

defaultSpace = aiscmn.SpaceConf{
CleanupWM: 65,
LowWM: 75,
HighWM: 90,
OOS: 95,
}

defaultMemsys = aiscmn.MemsysConf{
MinFree: cos.SizeIEC(2 * cos.GiB),
DefaultBufSize: cos.SizeIEC(32 * cos.KiB),
SizeToGC: cos.SizeIEC(2 * cos.GiB),
HousekeepTime: cos.Duration(90 * time.Second),
}

defaultLRU = aiscmn.LRUConf{
Enabled: false,
DontEvictTime: cos.Duration(120 * time.Minute),
CapacityUpdTime: cos.Duration(10 * time.Minute),
}

defaultMirror = aiscmn.MirrorConf{
Enabled: false,
Copies: 2,
Burst: 512,
}

defaultPeriodic = aiscmn.PeriodConf{
StatsTime: cos.Duration(10 * time.Second),
NotifTime: cos.Duration(30 * time.Second),
RetrySyncTime: cos.Duration(2 * time.Second),
}

defaultRebalance = aiscmn.RebalanceConf{
Enabled: true,
Compression: aisapc.CompressNever,
DestRetryTime: cos.Duration(2 * time.Minute),
SbundleMult: 2,
}

defaultTimeout = aiscmn.TimeoutConf{
CplaneOperation: cos.Duration(2 * time.Second),
MaxKeepalive: cos.Duration(4 * time.Second),
MaxHostBusy: cos.Duration(20 * time.Second),
Startup: cos.Duration(time.Minute),
SendFile: cos.Duration(5 * time.Minute),
}

defaultVersioning = aiscmn.VersionConf{
Enabled: true,
ValidateWarmGet: false,
}
)

func newDefaultConfig() *aiscmn.ClusterConfig {
return &aiscmn.ClusterConfig{
Auth: defaultAuth,
Cksum: defaultCksum,
Client: defaultClientConf,
Transport: defaultTransport,
TCB: defaultTCB,
Disk: defaultDisk,
Net: defaultNet,
FSHC: defaultFSHC,
Dsort: defaultDsort,
Downloader: defaultDownloader,
EC: defaultEC,
Keepalive: defaultKeepalive,
Log: defaultLog,
Space: defaultSpace,
Memsys: defaultMemsys,
LRU: defaultLRU,
Mirror: defaultMirror,
Periodic: defaultPeriodic,
Rebalance: defaultRebalance,
Timeout: defaultTimeout,
Versioning: defaultVersioning,
}
}
Loading

0 comments on commit 85fba48

Please sign in to comment.