Skip to content

[Feature] [Platform] Packer #1915

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- (Feature) (Platform) MetaV1 Integration Service
- (Feature) (Platform) Chart Overrides
- (Feature) (Platform) Packer

## [1.2.49](https://github.com/arangodb/kube-arangodb/tree/1.2.49) (2025-06-17)
- (Maintenance) Optimize go.mod
Expand Down
19 changes: 10 additions & 9 deletions docs/cli/arangodb_operator_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Available Commands:
Flags:
-h, --help help for registry
--platform.endpoint string Platform Repository URL (default "https://arangodb-platform-prd-chart-registry.s3.amazonaws.com")
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)

Global Flags:
-n, --namespace string Kubernetes Namespace (default "default")
Expand Down Expand Up @@ -190,11 +189,13 @@ Usage:

Available Commands:
dump Dumps the current setup of the platform
export Export the package in the ZIP Format
import Imports the package from the ZIP format
install Installs the specified setup of the platform
merge Merges definitions into single file

Flags:
-h, --help help for package
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
-h, --help help for package

Global Flags:
-n, --namespace string Kubernetes Namespace (default "default")
Expand All @@ -213,11 +214,11 @@ Usage:
arangodb_operator_platform package dump [flags]

Flags:
-h, --help help for dump
-h, --help help for dump
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)

Global Flags:
-n, --namespace string Kubernetes Namespace (default "default")
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
-n, --namespace string Kubernetes Namespace (default "default")
```
[END_INJECT]: # (arangodb_operator_platform_package_dump_cmd)

Expand All @@ -228,15 +229,15 @@ Global Flags:
Installs the specified setup of the platform

Usage:
arangodb_operator_platform package install [flags] package
arangodb_operator_platform package install [flags] ... packages

Flags:
-h, --help help for install
--platform.endpoint string Platform Repository URL (default "https://arangodb-platform-prd-chart-registry.s3.amazonaws.com")
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)

Global Flags:
-n, --namespace string Kubernetes Namespace (default "default")
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
-n, --namespace string Kubernetes Namespace (default "default")
```
[END_INJECT]: # (arangodb_operator_platform_package_install_cmd)

9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ require (
github.com/prometheus/prom2json v1.3.3
github.com/robfig/cron v1.2.0
github.com/rs/zerolog v1.33.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
golang.org/x/sync v0.12.0
golang.org/x/sys v0.31.0
Expand Down Expand Up @@ -83,6 +83,7 @@ require (
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1
github.com/jedib0t/go-pretty/v6 v6.6.5
github.com/regclient/regclient v0.8.3
golang.org/x/oauth2 v0.28.0
google.golang.org/genproto/googleapis/api v0.0.0-20250204164813-702378808489
helm.sh/helm/v3 v3.17.3
Expand Down Expand Up @@ -124,6 +125,7 @@ require (
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
Expand Down Expand Up @@ -167,7 +169,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kkdai/maglev v0.2.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
Expand Down Expand Up @@ -208,6 +210,7 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand Down
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
Expand Down Expand Up @@ -1026,6 +1027,8 @@ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHz
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4=
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4=
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
Expand Down Expand Up @@ -1399,6 +1402,8 @@ github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw
github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
Expand Down Expand Up @@ -1600,6 +1605,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
github.com/prometheus/prom2json v1.3.3 h1:IYfSMiZ7sSOfliBoo89PcufjWO4eAR0gznGcETyaUgo=
github.com/prometheus/prom2json v1.3.3/go.mod h1:Pv4yIPktEkK7btWsrUTWDDDrnpUrAELaOCj+oFwlgmc=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/regclient/regclient v0.8.3 h1:AFAPu/vmOYGyY22AIgzdBUKbzH+83lEpRioRYJ/reCs=
github.com/regclient/regclient v0.8.3/go.mod h1:gjQh5uBVZoo/CngchghtQh9Hx81HOMKRRDd5WPcPkbk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
Expand Down Expand Up @@ -1652,9 +1659,13 @@ github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cA
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
Expand All @@ -1674,6 +1685,8 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI=
github.com/vektah/gqlparser/v2 v2.4.5/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/shared/v1/any.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func FromAny[T any](in Any) (T, error) {
}

func (d Any) MarshalJSON() ([]byte, error) {
if len(d) == 0 {
return []byte("null"), nil
}
ret := make([]byte, len(d))
copy(ret, d)
return ret, nil
Expand Down
10 changes: 10 additions & 0 deletions pkg/logging/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,13 @@ func JSON(key string, item any) Wrap {
return in.Str(key, string(data))
}
}

func WithElapsed(key string) Wrap {
return WithElapsedCustom(key, time.Now())
}

func WithElapsedCustom(key string, t time.Time) Wrap {
return func(in *zerolog.Event) *zerolog.Event {
return in.Str(key, time.Since(t).String())
}
}
17 changes: 17 additions & 0 deletions pkg/platform/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package platform
import (
"os"

sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/cli"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
Expand All @@ -42,6 +43,13 @@ var (
Description: "Kubernetes Platform Name (name of the ArangoDeployment)",
Default: "",
Persistent: true,
Check: func(in string) error {
if err := sharedApi.IsValidName(in); err != nil {
return errors.Errorf("Invalid deployment name: %s", err.Error())
}

return nil
},
}

flagOutput = cli.Flag[string]{
Expand Down Expand Up @@ -104,4 +112,13 @@ var (
return nil
},
}

flagRegistryUseCredentials = cli.Flag[bool]{
Name: "registry.docker.credentials",
Description: "Use Docker Credentials",
Default: false,
Check: func(in bool) error {
return nil
},
}
)
33 changes: 33 additions & 0 deletions pkg/platform/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package platform
import (
"github.com/spf13/cobra"

"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/helm"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
Expand All @@ -45,3 +46,35 @@ func getHelmClient(cmd *cobra.Command) (helm.Client, error) {
Driver: nil,
})
}

func getHelmPackages(files ...string) (helm.Package, error) {
if len(files) == 0 {
return helm.Package{}, nil
}

pkgs := make([]helm.Package, len(files))

for id := range pkgs {
p, err := util.JsonOrYamlUnmarshalFile[helm.Package](files[id])
if err != nil {
return helm.Package{}, err
}
pkgs[id] = p
}

if len(pkgs) == 1 {
return pkgs[0], nil
}

v, err := helm.NewMergeValues(helm.MergeMaps, pkgs...)
if err != nil {
return helm.Package{}, err
}

p, err := util.JSONRemarshal[helm.Values, helm.Package](v)
if err != nil {
return helm.Package{}, err
}

return p, nil
}
Loading