-
Notifications
You must be signed in to change notification settings - Fork 1
Description
What about supporting other Pulumi ecosystems ?
This issue is a discussion around having support for other Pulumi ecosystems for Chall-Manager, especially Python and JS/TS.
The supported ecosystems are defined as follows.
chall-manager/global/pulumi.go
Line 4 in e9bfd7c
PulumiRuntimes = []string{"go"} |
One reason for supporting only Go, for now, is to focus on building the tech stack properly before expanding to many ecosystems bringing their own issues to the party 🎊
Docker images
Another reason is the size of the resulting Docker image:
pulumi/pulumi-go
: 173.17 MBpulumi/pulumi
: 2.54 GB
It is better than I though, but remains very heavy (especially a problem for scaling and uptimes).
Maybe an approach toward minimizing with slim
or building with apko
to make distroless images could help.
In general, minimizing the images would be a good thing, even with only Go supported.
Pulumi Go binary caching
On the feasibility side, there is currently a big adherence to Go, especially to pre-build the Pulumi programs.
chall-manager/pkg/iac/stack.go
Lines 52 to 71 in e9bfd7c
if yml.Runtime.Name() == "go" { | |
if _, ok := yml.Runtime.Options()["binary"]; !ok { | |
if err := compile(dir); err != nil { | |
return auto.Stack{}, err | |
} | |
yml.Runtime.SetOption("binary", "./main") | |
b, err = yaml.Marshal(yml) | |
if err != nil { | |
return auto.Stack{}, &errs.ErrInternal{Sub: err} | |
} | |
if err := os.WriteFile(filepath.Join(dir, fname), b, 0o600); err != nil { | |
return auto.Stack{}, &errs.ErrInternal{Sub: err} | |
} | |
} | |
} | |
// Make it executable (OCI does not natively copy permissions) | |
if err := os.Chmod(filepath.Join(dir, "main"), 0o766); err != nil { | |
return auto.Stack{}, err | |
} |
With a switch statement for the runtime, it could be easily tackled.
SDK Entrypoint
Then the entrypoint...
https://github.com/ctfer-io/chall-manager/blob/e9bfd7cc62bb71d7f7f04bd91b6dab18c3c7412e/sdk/entrypoint.go
It is made to ease Go-based scenarios. In order to support other ecosystems it should be also available, but kept coherent. I don't want to maintain all of them in parallel, so it requires to be transpiled. I don't know a lot about transpilation from Go to Python, Go to JS and Go to TS. I experienced things before, but was not much satisfied.
Maybe someone will propose an alternative, I'm up to hearing it :)
EDIT: an alternative could be to not provide the SDK entrypoint to other ecosystems. But let's be realistic, it is not a proper solution. Nevertheless, maybe Pulumi packages might be a place to make SDK stuff available for other ecosystems.
I don't think of other limitations yet, but might be wrong.
Out of these, Chall-Manager's abstraction revolving around Pulumi programs makes it technically possible.
(Poke @adam-lebon)