├── internal ├── protos │ ├── testdata │ │ ├── secondresource.txt │ │ └── fileresource.txt │ ├── clone.go │ └── consolidate.go ├── testdata │ ├── service │ │ ├── post │ │ │ └── schema.txt │ │ ├── list │ │ │ └── schema.sql │ │ ├── roachlist │ │ │ └── schema.sql │ │ ├── grpclistener │ │ │ └── service.cue │ │ ├── proto │ │ │ ├── simple.proto │ │ │ └── list.proto │ │ ├── simple │ │ │ ├── service.cue │ │ │ └── impl.go │ │ ├── rawlistener │ │ │ └── service.cue │ │ ├── localstacks3 │ │ │ └── service.cue │ │ ├── count │ │ │ └── service.cue │ │ └── fetch │ │ │ └── service.cue │ ├── integrations │ │ ├── withsidecar │ │ │ ├── .dockerignore │ │ │ ├── README.md │ │ │ ├── Dockerfile │ │ │ ├── mysidecar │ │ │ │ ├── Dockerfile │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ └── myinit │ │ │ │ └── main.go │ │ ├── dockerfile │ │ │ ├── complex │ │ │ │ ├── src │ │ │ │ │ └── link_name │ │ │ │ ├── .dockerignore │ │ │ │ ├── package.json │ │ │ │ ├── Dockerfile │ │ │ │ └── test │ │ │ │ │ └── test.sh │ │ │ └── simple │ │ │ │ ├── .dockerignore │ │ │ │ ├── README.md │ │ │ │ ├── foo.pb │ │ │ │ ├── Dockerfile │ │ │ │ └── package.json │ │ ├── resources │ │ │ ├── buildkitprovider │ │ │ │ └── binary.cue │ │ │ ├── testgenprovider │ │ │ │ ├── testgen │ │ │ │ │ ├── binary.cue │ │ │ │ │ └── main.go │ │ │ │ └── proto1.proto │ │ │ ├── classes │ │ │ │ ├── resourceclasses.cue │ │ │ │ └── protos │ │ │ │ │ └── proto2.proto │ │ │ ├── instances │ │ │ │ └── resourceinstances.cue │ │ │ └── providers │ │ │ │ └── resourceproviders.cue │ │ ├── image │ │ │ └── server.cue │ │ └── golang │ │ │ └── server.cue │ ├── server │ │ ├── withhelm │ │ │ ├── server.cue │ │ │ └── main.go │ │ ├── withmanifests │ │ │ ├── server.cue │ │ │ └── main.go │ │ ├── justports │ │ │ ├── server.cue │ │ │ └── main.go │ │ ├── postgres │ │ │ ├── server.cue │ │ │ └── main.fn.go │ │ ├── cockroach │ │ │ ├── server.cue │ │ │ └── main.fn.go │ │ ├── localstacks3 │ │ │ ├── server.cue │ │ │ └── main.fn.go │ │ ├── withminiobucket │ │ │ └── main.go │ │ ├── modeling │ │ │ ├── server.cue │ │ │ └── main.fn.go │ │ ├── multiport │ │ │ ├── server.cue │ │ │ └── main.go │ │ ├── gogrpc │ │ │ └── main.fn.go │ │ └── withconfiguration │ │ │ ├── main.fn.go │ │ │ └── server.cue │ ├── binaries │ │ ├── filesfrom │ │ │ └── binary.cue │ │ └── maketar │ │ │ └── binary.cue │ ├── manifests │ │ └── foobar.yaml │ ├── tests │ │ ├── cockroach │ │ │ └── test.cue │ │ ├── postgres │ │ │ └── test.cue │ │ ├── localstacks3 │ │ │ └── test.cue │ │ ├── prometheus │ │ │ └── canscrape │ │ │ │ └── test.cue │ │ └── modeling │ │ │ └── scopes │ │ │ └── test.cue │ ├── README.md │ ├── counter │ │ ├── data │ │ │ ├── exports.fn.cue │ │ │ ├── provider.proto │ │ │ ├── deps.fn.go │ │ │ ├── extension.cue │ │ │ └── wire.go │ │ ├── provider.proto │ │ ├── exports.fn.cue │ │ └── extension.cue │ └── datastore │ │ ├── extension.cue │ │ ├── provider.proto │ │ ├── exports.fn.cue │ │ └── db.go ├── runtime │ ├── kubernetes │ │ ├── defaults │ │ │ ├── pod.podsecuritycontext.yaml │ │ │ └── container.securitycontext.yaml │ │ ├── environment.go │ │ ├── kubeobserver │ │ │ └── funcs.go │ │ ├── client │ │ │ └── hostconfig.go │ │ ├── kubeops │ │ │ └── kubeops.go │ │ └── helm │ │ │ └── ops.proto │ └── docker │ │ └── config.proto ├── planning │ ├── deploy │ │ ├── storage │ │ │ └── .snapshots │ │ │ │ └── storage-assertNetworkPlan-empty.json │ │ ├── view │ │ │ └── .snapshots │ │ │ │ ├── view-assertNetworkPlan-empty-deployment.txt │ │ │ │ ├── view-assertNetworkPlan-empty-development.txt │ │ │ │ ├── view-assertNetworkPlan-with-not-managed-domains.txt │ │ │ │ ├── view-assertNetworkPlan-basic-no-support.txt │ │ │ │ ├── view-assertNetworkPlan-basic-with-support.txt │ │ │ │ └── view-assertNetworkPlan-basic-with-support-no-checkmark.txt │ │ └── resourceops.go │ └── tool │ │ └── handler.go ├── frontend │ ├── cuefrontendopaque │ │ └── README.md │ └── cuefrontend │ │ ├── entity │ │ └── README.md │ │ └── integration │ │ ├── api │ │ └── integration.go │ │ └── golang │ │ └── golang.go ├── versions │ └── versions.json ├── sdk │ ├── buf │ │ ├── image │ │ │ ├── prebuilt │ │ │ │ └── binary.cue │ │ │ ├── prebuiltnodejs │ │ │ │ └── binary.cue │ │ │ └── versions.json │ │ ├── buf.go │ │ └── image.go │ └── host │ │ └── platform.go ├── build │ ├── binary │ │ ├── imageutil │ │ │ └── binary.cue │ │ └── prebuilt.proto │ ├── assets │ │ └── buildassets.go │ └── buildkit │ │ ├── fix.go │ │ ├── estargz.go │ │ ├── secrets.go │ │ └── version.go ├── testing │ └── testboot │ │ ├── constants.go │ │ └── testprotocol.proto ├── fnerrors │ └── location.go ├── cli │ ├── fncobra │ │ └── name │ │ │ └── name.go │ └── cmd │ │ ├── gcp │ │ └── cmd.go │ │ ├── scratch │ │ └── cmd.go │ │ ├── image │ │ └── image.go │ │ ├── cluster │ │ ├── private │ │ │ └── root.go │ │ └── baseimage │ │ │ └── cmd.go │ │ ├── admin │ │ └── admin.go │ │ ├── aws │ │ └── cmd.go │ │ ├── source │ │ ├── cmd.go │ │ └── newid_test.go │ │ ├── tools │ │ └── cmd.go │ │ └── eks │ │ └── cmd.go ├── codegen │ ├── protos │ │ ├── compat.go │ │ ├── filedescset.go │ │ ├── filedescset.proto │ │ └── fnany │ │ │ └── unmarshal.go │ └── genpackage │ │ └── op.proto ├── tools │ └── cidependencies │ │ └── ci.go ├── workspace │ └── constants.go ├── github │ └── env │ │ └── env.go ├── artifacts │ ├── reference.go │ └── oci │ │ ├── reference.go │ │ └── types.proto ├── providers │ ├── gcp │ │ └── project.go │ ├── k3d │ │ └── configuration.proto │ ├── aws │ │ └── eks │ │ │ └── op.proto │ └── nscloud │ │ ├── provider.proto │ │ └── api │ │ └── buildplatform.go ├── environment │ └── ci.go ├── buildkite │ └── env.go ├── process │ ├── exec_windows.go │ └── exec_unix.go ├── integrations │ ├── opaque │ │ └── dev.go │ └── golang │ │ └── gobuild.go ├── networking │ └── ingress │ │ └── nginx │ │ ├── types.proto │ │ └── op.proto ├── disk │ ├── disk_darwin.go │ ├── disk_windows.go │ └── disk_linux.go ├── compression │ └── zstd.go ├── hotreload │ └── constants │ │ └── constants.go ├── git │ └── branch.go ├── sync │ └── writer.go ├── production │ └── runas.go ├── localexec │ └── interactive.go ├── console │ ├── unwrap.go │ └── tui │ │ └── styles.go ├── filewatcher │ └── filewatcher_test.go ├── parsing │ └── json.go ├── circleci │ └── env.go ├── text │ └── timefmt │ │ └── timefmt.go └── wscontents │ └── types.proto ├── staticcheck.conf ├── std ├── startup │ └── testdriver │ │ ├── test.sh │ │ └── binary.cue ├── monitoring │ ├── grafana │ │ ├── tool │ │ │ ├── binary.cue │ │ │ └── embed.go │ │ └── server │ │ │ └── server.cue │ ├── prometheus │ │ ├── tool │ │ │ ├── binary.cue │ │ │ └── embed.go │ │ ├── extension.cue │ │ └── server │ │ │ └── server.cue │ ├── otelcollector │ │ └── trampoline │ │ │ └── binary.cue │ └── tracing │ │ ├── global │ │ └── types.proto │ │ └── types.proto ├── development │ ├── controller │ │ └── binary.cue │ └── filesync │ │ ├── controller │ │ └── binary.cue │ │ └── config.proto ├── runtime │ ├── constants │ │ ├── runtimeconfig.go │ │ └── volumes.go │ └── kubernetes │ │ ├── types.proto │ │ ├── exports.fn.cue │ │ └── extension.cue ├── go │ ├── grpc │ │ ├── metrics │ │ │ ├── extension.cue │ │ │ └── wiremetrics.go │ │ └── interceptors │ │ │ ├── extension.cue │ │ │ ├── exports.fn.cue │ │ │ ├── provider.proto │ │ │ └── deps.fn.go │ ├── http │ │ ├── extension.cue │ │ ├── middleware │ │ │ ├── extension.cue │ │ │ ├── provider.proto │ │ │ ├── exports.fn.cue │ │ │ └── deps.fn.go │ │ └── csrf │ │ │ ├── deps.fn.go │ │ │ └── extension.cue │ └── core │ │ ├── server.go │ │ ├── pprof.go │ │ └── init_test.go ├── fn │ └── types.cue ├── tasks │ ├── logging.go │ ├── context.go │ ├── idtypes │ │ ├── id.go │ │ ├── serialize.go │ │ └── known.go │ └── flags.go ├── core │ ├── info │ │ ├── exports.fn.cue │ │ ├── deps.fn.go │ │ ├── wire.go │ │ └── extension.cue │ └── typealiases.go ├── execution │ ├── inputs.go │ ├── defs │ │ └── makedef.go │ └── values.go ├── module │ └── packageloader.go ├── protocol │ └── logging.proto ├── pkggraph │ ├── injections.go │ ├── binary.go │ └── context.go ├── grpc │ ├── deps.fn.go │ ├── provider.proto │ ├── methodname.go │ ├── protos │ │ └── provider.proto │ ├── deadlines │ │ ├── exports.fn.cue │ │ ├── provider.proto │ │ └── extension.cue │ ├── logging │ │ └── extension.cue │ ├── requestid │ │ └── requestid_test.go │ ├── connmap_test.go │ └── extension.cue ├── cfg │ └── knobs │ │ └── config │ │ └── config.proto └── types │ ├── resource.proto │ └── certificates.proto ├── framework ├── planning │ └── render │ │ └── .snapshots │ │ └── render-assertSummary-empty.json ├── pages │ ├── input.css │ ├── logo.png │ ├── README.md │ └── tailwind.config.js ├── README.md ├── console │ └── termios │ │ ├── termios.go │ │ ├── syscalls_linux.go │ │ └── syscalls.go ├── ulimit │ └── ulimit_windows.go ├── kubernetes │ ├── kubedef │ │ ├── details.proto │ │ └── storage.proto │ ├── kubeobj │ │ └── podreference.proto │ ├── kubetool │ │ └── hostenv.proto │ ├── kubeclient │ │ └── staticconfig.proto │ └── kubenaming │ │ └── naming.go ├── deploy │ └── types.proto ├── testing │ └── http.go ├── jsonreparser │ └── reparser.go └── sync │ └── ctxmutex │ └── ctxmutex.go ├── cmd ├── ns │ ├── binary.cue │ ├── gon.hcl │ └── main.go ├── nsc │ ├── binary.cue │ └── gendoc │ │ └── gen.go └── docker-credential-nsc │ └── binary.cue ├── library ├── aws │ ├── s3 │ │ └── README.md │ └── rds │ │ └── README.md ├── oss │ ├── minio │ │ ├── prepare │ │ │ └── binary.cue │ │ └── types.proto │ ├── redis │ │ ├── prepare │ │ │ ├── cluster │ │ │ │ └── binary.cue │ │ │ ├── database │ │ │ │ └── binary.cue │ │ │ └── clusterinstance │ │ │ │ └── binary.cue │ │ ├── server │ │ │ └── server.cue │ │ └── resources.cue │ ├── postgres │ │ ├── prepare │ │ │ ├── cluster │ │ │ │ └── binary.cue │ │ │ ├── database │ │ │ │ └── binary.cue │ │ │ └── clusterinstance │ │ │ │ └── binary.cue │ │ ├── server │ │ │ └── server.cue │ │ └── resources.cue │ ├── cockroach │ │ ├── prepare │ │ │ ├── cluster │ │ │ │ └── binary.cue │ │ │ ├── database │ │ │ │ └── binary.cue │ │ │ └── clusterinstance │ │ │ │ └── binary.cue │ │ ├── server │ │ │ └── server.cue │ │ └── resources.cue │ ├── localstack │ │ ├── prepare │ │ │ ├── bucket │ │ │ │ └── binary.cue │ │ │ ├── cluster │ │ │ │ └── binary.cue │ │ │ └── serverinstance │ │ │ │ └── binary.cue │ │ ├── server │ │ │ └── server.cue │ │ ├── resourceclasses.cue │ │ ├── resources.cue │ │ └── types.proto │ └── externaldns │ │ └── resources.cue ├── kubernetes │ ├── helm │ │ ├── prepare │ │ │ └── binary.cue │ │ ├── resources.cue │ │ └── types.proto │ ├── ingress │ │ ├── prepare │ │ │ └── binary.cue │ │ └── providers.cue │ ├── manifest │ │ ├── prepare │ │ │ └── binary.cue │ │ └── resources.cue │ └── rbac │ │ ├── prepare │ │ └── clusterrole │ │ │ └── binary.cue │ │ ├── resourceclasses.cue │ │ └── providers │ │ └── resourceproviders.cue ├── nix │ └── baseimage │ │ └── binary.cue ├── storage │ └── s3 │ │ └── resourceclasses.cue ├── golang │ └── baseimage │ │ └── binary.cue ├── runtime │ ├── README.md │ ├── secrets.proto │ └── ingress.proto └── database │ ├── redis │ ├── resourceclasses.cue │ └── types.proto │ ├── postgres │ └── resourceclasses.cue │ └── cockroach │ └── resourceclasses.cue ├── universe ├── aws │ ├── irsa │ │ ├── prepare │ │ │ └── binary.cue │ │ └── extension.cue │ ├── ecr │ │ ├── configure │ │ │ └── binary.cue │ │ ├── exports.fn.cue │ │ ├── provider.proto │ │ └── client.go │ ├── client │ │ ├── types.proto │ │ ├── exports.fn.cue │ │ └── extension.cue │ ├── s3 │ │ └── provider.proto │ └── configuration │ │ └── eks │ │ └── config.proto ├── storage │ ├── s3 │ │ ├── internal │ │ │ ├── prepare │ │ │ │ └── binary.cue │ │ │ └── managebuckets │ │ │ │ └── binary.cue │ │ └── exports.fn.cue │ └── minio │ │ ├── creds │ │ ├── exports.fn.cue │ │ ├── deps.fn.go │ │ └── provider.proto │ │ └── configure │ │ └── extension.cue ├── networking │ ├── tailscale │ │ ├── secrets.cue │ │ ├── image │ │ │ ├── binary.cue │ │ │ ├── Dockerfile │ │ │ └── entrypoint.sh │ │ └── extension.cue │ └── k8s-event-exporter │ │ ├── configure │ │ ├── binary.cue │ │ └── config.yaml.tmpl │ │ └── server.cue ├── development │ └── localstack │ │ ├── s3 │ │ ├── internal │ │ │ ├── configure │ │ │ │ └── binary.cue │ │ │ └── managebuckets │ │ │ │ └── init │ │ │ │ └── binary.cue │ │ ├── provider.proto │ │ └── exports.fn.cue │ │ ├── configure │ │ └── extension.cue │ │ └── server.cue ├── monitoring │ ├── lightstep │ │ ├── secrets.cue │ │ └── extension.cue │ ├── honeycomb │ │ ├── secrets.cue │ │ └── extension.cue │ └── sentry │ │ └── extension.cue ├── kubernetes │ └── kube-state-metrics │ │ ├── configure │ │ └── binary.cue │ │ └── server.cue ├── vault │ ├── testdata │ │ └── credentials.json │ └── vault_test.go ├── README.md ├── go │ └── panicparse │ │ ├── extension.cue │ │ └── prepare.go ├── gcp │ ├── types.proto │ └── gke │ │ └── types.proto ├── db │ └── redis │ │ ├── provider.proto │ │ └── exports.fn.cue ├── onepassword │ └── types.proto └── nscloud │ └── configuration │ └── config.proto ├── orchestration ├── server │ ├── tool │ │ └── binary.cue │ ├── server.cue │ ├── main.fn.go │ └── constants │ │ └── constants.go └── service │ └── service.cue ├── .github ├── ISSUE_TEMPLATE │ ├── bug.md │ └── config.yml └── workflows │ └── release.yaml ├── shell.nix ├── examples └── README.md ├── .vscode └── extensions.json ├── SECURITY.md ├── .pre-commit-config.yaml ├── schema ├── runtime │ ├── deployable.go │ └── deployable.proto ├── server.go ├── storage │ ├── deploy.go │ └── diagnostics.proto ├── filecontents.proto ├── probe.proto ├── README.md ├── tasks │ └── errors.proto └── defextension.proto └── npm-package └── package.json /internal/protos/testdata/secondresource.txt: -------------------------------------------------------------------------------- 1 | Another test. -------------------------------------------------------------------------------- /internal/testdata/service/post/schema.txt: -------------------------------------------------------------------------------- 1 | just a test file -------------------------------------------------------------------------------- /internal/protos/testdata/fileresource.txt: -------------------------------------------------------------------------------- 1 | This is test data. -------------------------------------------------------------------------------- /staticcheck.conf: -------------------------------------------------------------------------------- 1 | checks = [ 2 | "SA*", "-SA1019" 3 | ] 4 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /std/startup/testdriver/test.sh: -------------------------------------------------------------------------------- 1 | echo Nothing to do, servers have started. -------------------------------------------------------------------------------- /framework/planning/render/.snapshots/render-assertSummary-empty.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/complex/src/link_name: -------------------------------------------------------------------------------- 1 | INVALID_VALUE -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/simple/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /cmd/ns/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "ns" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/defaults/pod.podsecuritycontext.yaml: -------------------------------------------------------------------------------- 1 | runAsNonRoot: false -------------------------------------------------------------------------------- /internal/planning/deploy/storage/.snapshots/storage-assertNetworkPlan-empty.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/README.md: -------------------------------------------------------------------------------- 1 | Loading another binary as a sidecar. 2 | -------------------------------------------------------------------------------- /library/aws/s3/README.md: -------------------------------------------------------------------------------- 1 | # AWS S3 Provider 2 | 3 | TODO: implement AWS S3 provider here. 4 | -------------------------------------------------------------------------------- /framework/pages/input.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /library/aws/rds/README.md: -------------------------------------------------------------------------------- 1 | # AWS RDS Providers 2 | 3 | TODO: implement RDS providers here. 4 | -------------------------------------------------------------------------------- /framework/pages/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namespacelabs/foundation/HEAD/framework/pages/logo.png -------------------------------------------------------------------------------- /std/monitoring/grafana/tool/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "ns.tool" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/aws/irsa/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "ns.tool" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /std/development/controller/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "devcontroller" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /std/monitoring/prometheus/tool/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "ns.tool" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/aws/ecr/configure/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "configure-ecr" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/minio/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "minio-prepare-hook" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /orchestration/server/tool/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "orchestrator.tool" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /internal/frontend/cuefrontendopaque/README.md: -------------------------------------------------------------------------------- 1 | CUE frontend bits that handle the simplified syntax to define servers. 2 | -------------------------------------------------------------------------------- /library/kubernetes/helm/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "prepare-helm-release" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/storage/s3/internal/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "s3-prepare-hook" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /internal/versions/versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "api_version": 153, 3 | "minimum_api_version": 40, 4 | "cache_version": 1 5 | } 6 | -------------------------------------------------------------------------------- /library/oss/redis/prepare/cluster/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "redis-prepare-cluster" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/redis/prepare/database/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "redis-prepare-database" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /std/development/filesync/controller/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "filesync-controller" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/networking/tailscale/secrets.cue: -------------------------------------------------------------------------------- 1 | secrets: { 2 | tsAuthKey: { 3 | description: "Tailscale auth key." 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/complex/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | # Ignore invalid soft link 4 | src/link_name -------------------------------------------------------------------------------- /library/kubernetes/ingress/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "kubernetes-prepare-ingress" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/postgres/prepare/cluster/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "postgres-prepare-cluster" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/buildkitprovider/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "testgen" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/kubernetes/manifest/prepare/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "prepare-kubernetes-manifest" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/cockroach/prepare/cluster/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "cockroach-prepare-cluster" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/cockroach/prepare/database/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "cockroach-prepare-database" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/localstack/prepare/bucket/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "localstack-prepare-bucket" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/localstack/prepare/cluster/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "localstack-prepare-server" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/postgres/prepare/database/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "postgres-prepare-database" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/storage/s3/internal/managebuckets/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "s3-manage-buckets-init" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/testgenprovider/testgen/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "testgen" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/redis/prepare/clusterinstance/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "redis-prepare-clusterinstance" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/development/localstack/s3/internal/configure/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "init-managebuckets" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/monitoring/lightstep/secrets.cue: -------------------------------------------------------------------------------- 1 | secrets: { 2 | lightstepAccessToken: { 3 | description: "Lightstep access token" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-empty-deployment.txt: -------------------------------------------------------------------------------- 1 | Services deployed: 2 | 3 | No services exported 4 | 5 | -------------------------------------------------------------------------------- /library/kubernetes/rbac/prepare/clusterrole/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "kubernetes-prepare-clusterrole" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/postgres/prepare/clusterinstance/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "postgres-prepare-clusterinstance" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/development/localstack/s3/internal/managebuckets/init/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "managebuckets" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/kubernetes/kube-state-metrics/configure/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "configure-kube-state-metrics" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /universe/networking/k8s-event-exporter/configure/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "configure-k8s-event-exporter" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/cockroach/prepare/clusterinstance/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "cockroach-prepare-clusterinstance" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/localstack/prepare/serverinstance/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "localstack-prepare-serverinstance" 3 | from: go_package: "." 4 | } 5 | -------------------------------------------------------------------------------- /library/oss/localstack/server/server.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/library/oss/localstack/templates" 2 | 3 | server: templates.#Server 4 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/defaults/container.securitycontext.yaml: -------------------------------------------------------------------------------- 1 | privileged: false 2 | allowPrivilegeEscalation: false 3 | readOnlyRootFilesystem: false -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/simple/README.md: -------------------------------------------------------------------------------- 1 | Using Namespace in a simple case with a dockerfile integration and filesync (for hot reload). 2 | -------------------------------------------------------------------------------- /universe/monitoring/honeycomb/secrets.cue: -------------------------------------------------------------------------------- 1 | secrets: { 2 | xHoneycombTeam: { 3 | description: "x-honeycomb-team" 4 | optional: true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: File a bug 4 | title: '' 5 | labels: needs-triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/simple/foo.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namespacelabs/foundation/HEAD/internal/testdata/integrations/dockerfile/simple/foo.pb -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | ( 2 | import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) { 3 | src = builtins.fetchGit ./.; 4 | } 5 | ) 6 | .shellNix 7 | -------------------------------------------------------------------------------- /cmd/nsc/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "nsc" 3 | 4 | build_plan: [ 5 | {go_build: { 6 | binary_name: "nsc" 7 | binary_only: true 8 | }}, 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-empty-development.txt: -------------------------------------------------------------------------------- 1 | Development mode, services forwarded to mylocalhost: 2 | 3 | No services exported 4 | 5 | -------------------------------------------------------------------------------- /universe/networking/tailscale/image/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "tailscale" 3 | from: dockerfile: "Dockerfile" 4 | config: { 5 | command: ["/entrypoint.sh"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | For clarity, we have split examples into a separate repository. 2 | They can be found at [https://namespacelabs.dev/examples](https://namespacelabs.dev/examples). 3 | -------------------------------------------------------------------------------- /internal/testdata/service/list/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS list ( 2 | Id INT GENERATED ALWAYS AS IDENTITY, 3 | Item varchar(255) NOT NULL, 4 | PRIMARY KEY(Id) 5 | ); -------------------------------------------------------------------------------- /library/nix/baseimage/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "baseimage" 3 | from: prebuilt: "nixos/nix:2.6.0@sha256:f0c68f870c655d8d96658ca762a0704a30704de22d16b4956e762a2ddfbccb09" 4 | } 5 | -------------------------------------------------------------------------------- /universe/vault/testdata/credentials.json: -------------------------------------------------------------------------------- 1 | { 2 | "role_id": "my-role-id", 3 | "secret_id": "geheimnis", 4 | "vault_address": "[::]:8200", 5 | "vault_namespace": "ns/test" 6 | } 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Documentation 4 | url: https://alpha.foundation.namespacelabs.com 5 | about: Documentation 6 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "bbenoist.nix", 4 | "golang.go", 5 | "esbenp.prettier-vscode", 6 | "zxh404.vscode-proto3", 7 | ] 8 | } -------------------------------------------------------------------------------- /library/storage/s3/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Bucket": { 3 | produces: { 4 | type: "library.storage.s3.BucketInstance" 5 | source: "./api.proto" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /internal/sdk/buf/image/prebuilt/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "bufbuild" 3 | from: llb_plan: { 4 | output_of: { 5 | name: "llbgen" 6 | from: go_package: "." 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /internal/testdata/integrations/image/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "myserver" 3 | 4 | image: "redis:6.2.6-alpine@sha256:132337b9d7744ffee4fae83f51de53c3530935ad3ba528b7110f2d805f55cbf5" 5 | } 6 | -------------------------------------------------------------------------------- /internal/sdk/buf/image/prebuiltnodejs/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "bufbuild" 3 | from: llb_plan: { 4 | output_of: { 5 | name: "llbgen" 6 | from: go_package: "." 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /internal/testdata/server/withhelm/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "withhelm" 3 | 4 | integration: "go" 5 | 6 | resources: ["namespacelabs.dev/foundation/internal/testdata/manifests:redisHelm"] 7 | } 8 | -------------------------------------------------------------------------------- /library/golang/baseimage/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "baseimage" 3 | from: prebuilt: "cgr.dev/chainguard/static:latest@sha256:edc3947cea6543079de668b18475cd6335a8c85f191acef5339cba8552859766" 4 | } 5 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report vulnerabilities privately to security@namespacelabs.com. We'll work with you on a coordinated disclosure timeline. 6 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/complex/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker_web_app", 3 | "version": "1.0.0", 4 | "main": "server.js", 5 | "dependencies": { 6 | "express": "^4.18.1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /framework/pages/README.md: -------------------------------------------------------------------------------- 1 | To update the template use: 2 | 3 | ``` 4 | npx tailwindcss -i input.css -o output.css --watch 5 | ``` 6 | 7 | For styles. The HTML must be updated manually to insert the embedded resources. -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/simple/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY package*.json ./ 6 | RUN npm install 7 | 8 | RUN echo foobar2 9 | 10 | COPY src ./src 11 | -------------------------------------------------------------------------------- /internal/testdata/server/withmanifests/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "withmanifests" 3 | 4 | integration: "go" 5 | 6 | resources: ["namespacelabs.dev/foundation/internal/testdata/manifests:existing"] 7 | } 8 | -------------------------------------------------------------------------------- /library/runtime/README.md: -------------------------------------------------------------------------------- 1 | # Namespace Runtime Resources Classes 2 | 3 | This package defines resource classes for Namespace runtime primitives. 4 | Their corresponding providers are embedded in Namespace itself. 5 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16-alpine 2 | 3 | WORKDIR /usr/src/app 4 | 5 | COPY package*.json ./ 6 | RUN npm install 7 | 8 | COPY src . 9 | 10 | CMD [ "node", "server.js" ] -------------------------------------------------------------------------------- /universe/networking/tailscale/image/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/tailscale/tailscale@sha256:a8f3198bccfb3d281735cd99f33537c4023fd18d7aa4bce36cdaa827b1124ba0 2 | RUN apk add --no-cache bash jq 3 | COPY entrypoint.sh /entrypoint.sh -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/complex/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16-alpine 2 | 3 | WORKDIR /usr/src/app 4 | 5 | COPY package*.json ./ 6 | RUN npm install 7 | 8 | COPY src . 9 | 10 | CMD [ "node", "server.js" ] -------------------------------------------------------------------------------- /cmd/docker-credential-nsc/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "docker-credential-nsc" 3 | 4 | build_plan: [ 5 | {go_build: { 6 | binary_name: "docker-credential-nsc" 7 | binary_only: true 8 | }}, 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /universe/README.md: -------------------------------------------------------------------------------- 1 | # Universe 2 | 3 | ## Status 4 | 5 | Work in progress 6 | 7 | The extensions in this directory require the application extension framework and are in the process of being migrated to Namespace resources. 8 | -------------------------------------------------------------------------------- /universe/networking/k8s-event-exporter/configure/config.yaml.tmpl: -------------------------------------------------------------------------------- 1 | logLevel: error 2 | logFormat: json 3 | route: 4 | routes: 5 | - match: 6 | - receiver: "stdout" 7 | receivers: 8 | - name: "stdout" 9 | stdout: { } -------------------------------------------------------------------------------- /internal/testdata/server/justports/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "justports" 3 | 4 | integration: "go" 5 | 6 | ports: { 7 | main: { 8 | containerPort: 3000 9 | // hostPort: 30000 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/mysidecar/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16-alpine 2 | 3 | WORKDIR /usr/src/app 4 | 5 | COPY mysidecar/package*.json ./ 6 | RUN npm install 7 | 8 | COPY mysidecar/src . 9 | 10 | CMD [ "node", "sidecarserver.js" ] -------------------------------------------------------------------------------- /library/oss/localstack/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Cluster": { 3 | description: "LocalStack Server" 4 | produces: { 5 | type: "library.oss.localstack.ClusterInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /internal/frontend/cuefrontend/entity/README.md: -------------------------------------------------------------------------------- 1 | This package allows parsing entities from CUE fields with parsers that depend on the provided URL. 2 | Supported entity parsers need to be provided in advance. 3 | 4 | Used for "integration" and "build" parsing. 5 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.2.0 4 | hooks: 5 | - id: check-merge-conflict 6 | - id: check-yaml 7 | args: [--allow-multiple-documents] 8 | - id: trailing-whitespace 9 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/mysidecar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker_web_app", 3 | "version": "1.0.0", 4 | "description": "Node.js on Docker", 5 | "main": "sidecarserver.js", 6 | "dependencies": { 7 | "express": "^4.18.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /universe/development/localstack/configure/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | extension: fn.#Extension 6 | 7 | configure: fn.#Configure & { 8 | startup: { 9 | env: { 10 | SERVICES: "s3" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/service/roachlist/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS list ( 2 | Id INT GENERATED ALWAYS AS IDENTITY, 3 | Item varchar(255) NOT NULL, 4 | PRIMARY KEY(Id) 5 | ) LOCALITY REGIONAL BY ROW; 6 | 7 | ALTER TABLE list ALTER COLUMN crdb_region SET VISIBLE; -------------------------------------------------------------------------------- /internal/testdata/binaries/filesfrom/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "filesfrom" 3 | 4 | build_plan: { 5 | layer_build_plan: [ 6 | {files_from: { 7 | from: image_id: "busybox" 8 | files: ["lib/libc.so.6"] 9 | target_dir: "wrapped" 10 | }}, 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/build/binary/imageutil/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "imageutil" 3 | build_plan: { 4 | layer_build_plan: [ 5 | {prebuilt: "ubuntu:22.04"}, 6 | {go_build: { 7 | rel_path: "." 8 | binary_name: "bake" 9 | binary_only: true 10 | }}, 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /universe/go/panicparse/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/core" 4 | ) 5 | 6 | extension: fn.#Extension & { 7 | hasInitializerIn: "GO" 8 | 9 | instantiate: { 10 | debugHandler: core.#Exports.DebugHandler 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /library/kubernetes/rbac/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "ClusterRole": { 3 | produces: { 4 | type: "library.kubernetes.rbac.ClusterRoleInstance" 5 | source: "./rbac.proto" 6 | } 7 | defaultProvider: "namespacelabs.dev/foundation/library/kubernetes/rbac/providers" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/simple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker_web_app", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "start": "nodemon src/server.js" 6 | }, 7 | "dependencies": { 8 | "express": "^4.18.1" 9 | }, 10 | "devDependencies": { 11 | "nodemon": "^2.0.20" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/manifests/foobar.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox 5 | spec: 6 | containers: 7 | - image: busybox 8 | command: 9 | - sleep 10 | - "3600" 11 | imagePullPolicy: IfNotPresent 12 | name: busybox 13 | restartPolicy: Always 14 | -------------------------------------------------------------------------------- /internal/testdata/tests/cockroach/test.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | test: fn.#Test & { 4 | name: "test-cockroach" 5 | 6 | binary: { 7 | from: go_package: "." 8 | } 9 | 10 | fixture: { 11 | sut: "namespacelabs.dev/foundation/internal/testdata/server/cockroach" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/tests/postgres/test.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | test: fn.#Test & { 4 | name: "test-postgres" 5 | 6 | binary: { 7 | from: go_package: "." 8 | } 9 | 10 | fixture: { 11 | sut: "namespacelabs.dev/foundation/internal/testdata/server/postgres" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/README.md: -------------------------------------------------------------------------------- 1 | # Internal testdata 2 | 3 | These folder contains artificial servers, extensions and resources that are used to validate releases of Namespace itself. 4 | They don't aspire to be meaningful. For canonical examples, please check out [https://namespacelabs.dev/examples](namespacelabs.dev/examples). 5 | -------------------------------------------------------------------------------- /std/runtime/constants/runtimeconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package constants 6 | 7 | const NamespaceConfigMount = "/namespace/config" 8 | -------------------------------------------------------------------------------- /framework/README.md: -------------------------------------------------------------------------------- 1 | This directory includes various Go-only libraries which can be used by 2 | Namespace users. They include facilities to interact with Namespace's 3 | configurations, as well as facilities to write end-to-end tests, etc. 4 | 5 | Equivalent versions of these libraries in other languages will be available 6 | later. 7 | -------------------------------------------------------------------------------- /internal/testdata/tests/localstacks3/test.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | test: fn.#Test & { 4 | name: "test-localstack-s3" 5 | 6 | binary: { 7 | from: go_package: "." 8 | } 9 | 10 | fixture: { 11 | sut: "namespacelabs.dev/foundation/internal/testdata/server/localstacks3" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/tests/prometheus/canscrape/test.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | test: fn.#Test & { 4 | name: "test-can-scrape" 5 | 6 | binary: { 7 | from: go_package: "." 8 | } 9 | 10 | fixture: { 11 | sut: "namespacelabs.dev/foundation/internal/testdata/server/gogrpc" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testing/testboot/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package testboot 6 | 7 | const TestRequestPath = "fixture/testrequest.binarypb" 8 | -------------------------------------------------------------------------------- /internal/fnerrors/location.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package fnerrors 6 | 7 | type Location interface { 8 | ErrorLocation() string 9 | } 10 | -------------------------------------------------------------------------------- /internal/testdata/tests/modeling/scopes/test.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | test: fn.#Test & { 4 | name: "test-scoped-instantiation" 5 | 6 | binary: { 7 | from: go_package: "." 8 | } 9 | 10 | fixture: { 11 | sut: "namespacelabs.dev/foundation/internal/testdata/server/modeling" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /library/kubernetes/ingress/providers.cue: -------------------------------------------------------------------------------- 1 | providers: { 2 | "namespacelabs.dev/foundation/library/runtime:Ingress": { 3 | prepareWith: "namespacelabs.dev/foundation/library/kubernetes/ingress/prepare" 4 | 5 | intent: { 6 | type: "library.kubernetes.ingress.IngressIntent" 7 | source: "./types.proto" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /library/oss/localstack/resources.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | colocated: { 3 | class: "namespacelabs.dev/foundation/library/oss/localstack:Cluster" 4 | provider: "namespacelabs.dev/foundation/library/oss/localstack" 5 | 6 | intent: { 7 | server: "namespacelabs.dev/foundation/library/oss/localstack/server" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /framework/console/termios/termios.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package termios 6 | 7 | type WinSize struct { 8 | Width uint16 9 | Height uint16 10 | } 11 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-with-not-managed-domains.txt: -------------------------------------------------------------------------------- 1 | Services deployed: 2 | 3 | [✓] Focused Label 4 | http://web.example.com/path1 5 | * http://web.example.com/path2 6 | 7 | (*) The ingress has been configured to support this domain name, but its DNS records are not managed by Namespace. 8 | 9 | -------------------------------------------------------------------------------- /universe/vault/vault_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package vault_test 6 | 7 | import "embed" 8 | 9 | //go:embed testdata/*.json 10 | var lib embed.FS 11 | -------------------------------------------------------------------------------- /orchestration/service/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $proto: inputs.#Proto & { 7 | source: "../proto/service.proto" 8 | } 9 | 10 | service: fn.#Service & { 11 | framework: "GO" 12 | exportService: $proto.services.OrchestrationService 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker_web_app", 3 | "version": "1.0.0", 4 | "description": "Node.js on Docker", 5 | "author": "First Last ", 6 | "main": "server.js", 7 | "scripts": { 8 | "start": "node server.js" 9 | }, 10 | "dependencies": { 11 | "express": "^4.18.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/server/postgres/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#Server & { 6 | id: "q311n9u9uvirr2i42ms0" 7 | name: "postgresdemoserver" 8 | framework: "GO" 9 | testonly: true 10 | 11 | import: [ 12 | "namespacelabs.dev/foundation/internal/testdata/service/list", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /internal/cli/fncobra/name/name.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package name 6 | 7 | // global variable to share the command name (e.g. when generating error messages) 8 | var CmdName = "ns" 9 | -------------------------------------------------------------------------------- /internal/codegen/protos/compat.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package protos 6 | 7 | import "namespacelabs.dev/foundation/internal/protos" 8 | 9 | var WriteFile = protos.WriteFile 10 | -------------------------------------------------------------------------------- /internal/testdata/server/cockroach/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#Server & { 6 | id: "7lb5mgu97tecmdk2muug" 7 | name: "cockroachdemoserver" 8 | framework: "GO" 9 | testonly: true 10 | 11 | import: [ 12 | "namespacelabs.dev/foundation/internal/testdata/service/roachlist", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /internal/testdata/server/localstacks3/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#Server & { 6 | id: "rn5q3mcug1dnkbtue3cg" 7 | name: "localstacks3" 8 | framework: "GO" 9 | testonly: true 10 | 11 | import: [ 12 | "namespacelabs.dev/foundation/internal/testdata/service/localstacks3", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /internal/testdata/server/withhelm/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import "net/http" 8 | 9 | func main() { 10 | _ = http.ListenAndServe(":3000", nil) 11 | } 12 | -------------------------------------------------------------------------------- /internal/tools/cidependencies/ci.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | //go:build tools 6 | 7 | package cidependencies 8 | 9 | import ( 10 | _ "honnef.co/go/tools/cmd/staticcheck" 11 | ) 12 | -------------------------------------------------------------------------------- /library/oss/redis/server/server.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/library/oss/redis/templates" 2 | 3 | server: templates.#Server 4 | 5 | secrets: { 6 | "password": { 7 | description: "Redis root password" 8 | generate: { 9 | uniqueId: "redis-password" 10 | randomByteCount: 32 11 | format: "FORMAT_BASE32" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /internal/testdata/server/withmanifests/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import "net/http" 8 | 9 | func main() { 10 | _ = http.ListenAndServe(":3000", nil) 11 | } 12 | -------------------------------------------------------------------------------- /internal/testdata/server/withminiobucket/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import "net/http" 8 | 9 | func main() { 10 | _ = http.ListenAndServe(":3000", nil) 11 | } 12 | -------------------------------------------------------------------------------- /library/kubernetes/rbac/providers/resourceproviders.cue: -------------------------------------------------------------------------------- 1 | providers: { 2 | "namespacelabs.dev/foundation/library/kubernetes/rbac:ClusterRole": { 3 | prepareWith: "namespacelabs.dev/foundation/library/kubernetes/rbac/prepare/clusterrole" 4 | 5 | intent: { 6 | type: "library.kubernetes.rbac.ClusterRoleIntent" 7 | source: "../rbac.proto" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /std/monitoring/grafana/tool/embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "embed" 9 | ) 10 | 11 | var ( 12 | //go:embed *.json 13 | embeddedData embed.FS 14 | ) 15 | -------------------------------------------------------------------------------- /universe/networking/tailscale/image/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOCKET="/tmp/tailscaled.sock" 4 | 5 | tailscaled --tun=userspace-networking --socket=${SOCKET} --state=mem: & 6 | PID=$! 7 | 8 | tailscale --socket=${SOCKET} up --accept-dns=false --hostname=${FN_SERVER_NAME}-${FN_KUBERNETES_NAMESPACE}-${FN_SERVER_ID} --authkey=${TAILSCALE_AUTH_KEY} 9 | 10 | wait ${PID} -------------------------------------------------------------------------------- /internal/workspace/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package workspace 6 | 7 | const ( 8 | WorkspaceFile = "ns-workspace.cue" 9 | LegacyWorkspaceFile = "fn-workspace.cue" 10 | ) 11 | -------------------------------------------------------------------------------- /std/go/grpc/metrics/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/go/grpc/interceptors" 4 | ) 5 | 6 | extension: fn.#Extension & { 7 | hasInitializerIn: "GO" 8 | 9 | instantiate: { 10 | "interceptors": interceptors.#Exports.InterceptorRegistration & { 11 | name: "prometheus-metrics" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /std/monitoring/prometheus/tool/embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "embed" 9 | ) 10 | 11 | var ( 12 | //go:embed *.yml 13 | embeddedData embed.FS 14 | ) 15 | -------------------------------------------------------------------------------- /library/oss/postgres/server/server.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/library/oss/postgres/templates" 2 | 3 | server: templates.#Server 4 | 5 | secrets: { 6 | "password": { 7 | description: "Postgres server password" 8 | generate: { 9 | uniqueId: "postgres-password" 10 | randomByteCount: 32 11 | format: "FORMAT_BASE32" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /std/fn/types.cue: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | #Proto: { 4 | typename: string 5 | source: [...string] 6 | skip_codegen?: bool 7 | } 8 | 9 | #ImageID: { 10 | repository?: string 11 | tag?: string 12 | digest?: string 13 | } 14 | 15 | #Resource: { 16 | path: string 17 | contents: bytes 18 | } 19 | 20 | #Any: { 21 | typeUrl?: string 22 | value?: bytes 23 | } 24 | -------------------------------------------------------------------------------- /std/tasks/logging.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tasks 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/environment" 9 | ) 10 | 11 | var LogActions = environment.IsRunningInCI() 12 | -------------------------------------------------------------------------------- /internal/github/env/env.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package github 6 | 7 | import ( 8 | "os" 9 | ) 10 | 11 | func IsRunningInActions() bool { 12 | return os.Getenv("GITHUB_ACTIONS") == "true" 13 | } 14 | -------------------------------------------------------------------------------- /internal/planning/deploy/resourceops.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package deploy 6 | 7 | func RegisterDeployOps() { 8 | register_OpWaitForProviderResults() 9 | register_OpCaptureServerConfig() 10 | } 11 | -------------------------------------------------------------------------------- /internal/testdata/integrations/withsidecar/myinit/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import "log" 8 | 9 | func main() { 10 | log.Println("I'm a happy little init container") 11 | } 12 | -------------------------------------------------------------------------------- /library/oss/cockroach/server/server.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/library/oss/cockroach/templates" 2 | 3 | server: templates.#Server 4 | 5 | secrets: { 6 | "password": { 7 | description: "CockroachDB server password" 8 | generate: { 9 | uniqueId: "cockroach-password" 10 | randomByteCount: 32 11 | format: "FORMAT_BASE32" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /internal/protos/clone.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package protos 6 | 7 | import "google.golang.org/protobuf/proto" 8 | 9 | func Clone[V proto.Message](msg V) V { 10 | return proto.Clone(msg).(V) 11 | } 12 | -------------------------------------------------------------------------------- /internal/artifacts/reference.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package artifacts 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | type Reference struct { 10 | URL string 11 | Digest schema.Digest 12 | } 13 | -------------------------------------------------------------------------------- /framework/pages/tailwind.config.js: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | /** @type {import('tailwindcss').Config} */ 6 | module.exports = { 7 | content: ["./*.html"], 8 | theme: { 9 | extend: {}, 10 | }, 11 | plugins: [], 12 | }; 13 | -------------------------------------------------------------------------------- /universe/networking/tailscale/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | extension: fn.#Extension & {} 6 | 7 | configure: fn.#Configure & { 8 | sidecar: tailscaled: { 9 | binary: "namespacelabs.dev/foundation/universe/networking/tailscale/image" 10 | } 11 | startup: { 12 | env: { 13 | "TAILSCALE_AUTH_KEY": fromSecret: ":tsAuthKey" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /std/monitoring/otelcollector/trampoline/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "otelcol-trampoline" 3 | 4 | build_plan: { 5 | layer_build_plan: [ 6 | {prebuilt: "otel/opentelemetry-collector-contrib:0.78.0"}, 7 | {go_build: { 8 | rel_path: "." 9 | binary_name: "trampoline" 10 | binary_only: true 11 | }}, 12 | ] 13 | } 14 | 15 | config: { 16 | command: ["/trampoline"] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /std/tasks/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tasks 6 | 7 | type contextKey string 8 | 9 | var ( 10 | _sinkKey = contextKey("fn.workspace.action.sink") 11 | _actionKey = contextKey("fn.workspace.action") 12 | ) 13 | -------------------------------------------------------------------------------- /framework/console/termios/syscalls_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package termios 6 | 7 | import ( 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | const ( 12 | ioctlGETATTR = unix.TCGETS 13 | ioctlSETATTR = unix.TCSETS 14 | ) 15 | -------------------------------------------------------------------------------- /internal/testdata/server/modeling/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#Server & { 6 | id: "m9v09613qsdlddj3a8i0" 7 | name: "modelingserver" // test server that allows testing data modeling of foundation 8 | framework: "GO" 9 | testonly: true 10 | 11 | import: [ 12 | "namespacelabs.dev/foundation/internal/testdata/service/count", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /std/go/http/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $inputs: { 7 | httpPort: inputs.#Port & { 8 | name: "http-port" 9 | } 10 | } 11 | 12 | extension: fn.#Extension & {} 13 | 14 | configure: fn.#Configure & { 15 | startup: { 16 | args: { 17 | grpcserver_http_port: "\($inputs.httpPort.port)" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-basic-no-support.txt: -------------------------------------------------------------------------------- 1 | Services deployed: 2 | 3 | [✓] Focused Label 4 | http://web.example.com/path1 5 | http://web.example.com/path2 6 | 7 | [ ] Focused Longer Label 8 | grpcurl hello world long command 9 | 10 | [ ] focused.short.proto.name 11 | http://localhost 12 | 13 | [ ] f.l.p.name 14 | http://localhost 15 | 16 | -------------------------------------------------------------------------------- /internal/testdata/service/grpclistener/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $proto: inputs.#Proto & { 7 | source: "../proto/simple.proto" 8 | } 9 | 10 | service: fn.#Service & { 11 | framework: "GO" 12 | exportService: $proto.services.EmptyService 13 | listener: "mtls" 14 | ingress: "INTERNET_FACING" 15 | } 16 | -------------------------------------------------------------------------------- /std/startup/testdriver/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "startup-test" 3 | build_plan: { 4 | layer_build_plan: [ 5 | {alpine_build: { 6 | version: "sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a" 7 | package: ["bash"] 8 | }}, 9 | {snapshot_files: ["test.sh"]}, // XXX update to `files`. 10 | ] 11 | } 12 | config: { 13 | command: ["/bin/bash", "/test.sh"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /universe/aws/ecr/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package ecr 3 | 4 | #Exports: { 5 | Client: { 6 | #Definition: { 7 | packageName: "namespacelabs.dev/foundation/universe/aws/ecr" 8 | type: "Client" 9 | typeDefinition: { 10 | "typename": "foundation.universe.aws.ecr.ClientArgs" 11 | "source": [ 12 | "provider.proto", 13 | ] 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /universe/aws/ecr/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.aws.ecr; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/aws/ecr"; 10 | 11 | message ClientArgs { 12 | } 13 | -------------------------------------------------------------------------------- /library/database/redis/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Database": { 3 | description: "Redis Database" 4 | produces: { 5 | type: "library.database.redis.DatabaseInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | "Cluster": { 10 | description: "Redis Database Cluster" 11 | produces: { 12 | type: "library.database.redis.ClusterInstance" 13 | source: "./types.proto" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /universe/aws/client/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.aws.client; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/aws/client"; 10 | 11 | message ClientFactoryArgs {} 12 | -------------------------------------------------------------------------------- /universe/gcp/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.providers.gcp; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/gcp"; 10 | 11 | message Project { 12 | string id = 1; 13 | } 14 | -------------------------------------------------------------------------------- /std/core/info/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package info 3 | 4 | #Exports: { 5 | ServerInfo: { 6 | #Definition: { 7 | packageName: "namespacelabs.dev/foundation/std/core/info" 8 | type: "ServerInfo" 9 | typeDefinition: { 10 | "typename": "foundation.std.core.types.ServerInfoArgs" 11 | "source": [ 12 | "../types/coretypes.proto", 13 | ] 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /internal/testdata/integrations/golang/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "myserver" 3 | 4 | integration: "go" 5 | 6 | env: { 7 | NAME: "\($env.name)-Bob" 8 | } 9 | 10 | annotations: { 11 | "foobar.com": fromField: { 12 | instance: fromService: ":webapi" 13 | fieldRef: "owner" 14 | } 15 | } 16 | 17 | services: { 18 | webapi: { 19 | port: 4000 20 | kind: "http" 21 | 22 | ingress: true 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /universe/networking/k8s-event-exporter/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#OpaqueServer & { 6 | id: "rvbjsgm9fbukqa75u2p0" 7 | name: "k8s-event-exporter" 8 | 9 | binary: image: "ghcr.io/opsgenie/kubernetes-event-exporter:v0.11" 10 | } 11 | 12 | configure: fn.#Configure & { 13 | with: binary: "namespacelabs.dev/foundation/universe/networking/k8s-event-exporter/configure" 14 | } 15 | -------------------------------------------------------------------------------- /library/database/postgres/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Database": { 3 | description: "Postgres Database" 4 | produces: { 5 | type: "library.database.postgres.DatabaseInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | "Cluster": { 10 | description: "Postgres Database Cluster" 11 | produces: { 12 | type: "library.database.postgres.ClusterInstance" 13 | source: "./types.proto" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /library/oss/minio/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package library.oss.minio; 8 | 9 | option go_package = "namespacelabs.dev/foundation/library/oss/minio"; 10 | 11 | message BucketIntent { 12 | string bucket_name = 1; 13 | } 14 | -------------------------------------------------------------------------------- /universe/db/redis/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.db.redis; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/db/redis"; 10 | 11 | message RedisArgs { 12 | int32 database = 1; 13 | } -------------------------------------------------------------------------------- /universe/gcp/gke/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.providers.gcp.gke; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/gcp/gke"; 10 | 11 | message Cluster { 12 | string name = 1; 13 | } 14 | -------------------------------------------------------------------------------- /internal/providers/gcp/project.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package gcp 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/std/cfg" 9 | gcppb "namespacelabs.dev/foundation/universe/gcp" 10 | ) 11 | 12 | var ProjectConfigType = cfg.DefineConfigType[*gcppb.Project]() 13 | -------------------------------------------------------------------------------- /internal/testdata/service/proto/simple.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package internal.testdata.service.proto; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/service/proto"; 10 | 11 | service EmptyService { 12 | } -------------------------------------------------------------------------------- /library/runtime/secrets.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.library.runtime; 8 | 9 | option go_package = "namespacelabs.dev/foundation/library/runtime"; 10 | 11 | message SecretInstance { 12 | string path = 1; 13 | } 14 | -------------------------------------------------------------------------------- /schema/runtime/deployable.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package runtime 6 | 7 | import schema "namespacelabs.dev/foundation/schema" 8 | 9 | func (d *Deployable) IsOneShot() bool { 10 | return d.GetDeployableClass() == string(schema.DeployableClass_ONESHOT) 11 | } 12 | -------------------------------------------------------------------------------- /schema/server.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package schema 6 | 7 | func (x *Server) GetPackageRef() *PackageRef { 8 | if x == nil { 9 | return nil 10 | } 11 | 12 | return &PackageRef{ 13 | PackageName: x.PackageName, 14 | Name: x.Name, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /std/monitoring/tracing/global/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.monitoring.tracing.global; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/monitoring/tracing/global"; 10 | 11 | message NoArgs {} 12 | -------------------------------------------------------------------------------- /universe/aws/client/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package client 3 | 4 | #Exports: { 5 | ClientFactory: { 6 | #Definition: { 7 | packageName: "namespacelabs.dev/foundation/universe/aws/client" 8 | type: "ClientFactory" 9 | typeDefinition: { 10 | "typename": "foundation.universe.aws.client.ClientFactoryArgs" 11 | "source": [ 12 | "types.proto", 13 | ] 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /universe/db/redis/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package redis 3 | 4 | #Exports: { 5 | Redis: { 6 | database?: int 7 | 8 | #Definition: { 9 | packageName: "namespacelabs.dev/foundation/universe/db/redis" 10 | type: "Redis" 11 | typeDefinition: { 12 | "typename": "foundation.universe.db.redis.RedisArgs" 13 | "source": [ 14 | "provider.proto", 15 | ] 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /universe/kubernetes/kube-state-metrics/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#OpaqueServer & { 6 | id: "c9kf8ejnhamknruls850" 7 | name: "kube-state-metrics" 8 | 9 | binary: image: "registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.5.0" 10 | } 11 | 12 | configure: fn.#Configure & { 13 | with: binary: "namespacelabs.dev/foundation/universe/kubernetes/kube-state-metrics/configure" 14 | } 15 | -------------------------------------------------------------------------------- /internal/testdata/counter/data/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package data 3 | 4 | #Exports: { 5 | Data: { 6 | #Definition: { 7 | packageName: "namespacelabs.dev/foundation/internal/testdata/counter/data" 8 | type: "Data" 9 | typeDefinition: { 10 | "typename": "foundation.internal.testdata.scopes.data.Input" 11 | "source": [ 12 | "provider.proto", 13 | ] 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /library/database/cockroach/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Database": { 3 | description: "CockroachDB Database" 4 | produces: { 5 | type: "library.database.cockroach.DatabaseInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | "Cluster": { 10 | description: "CockroachDB Database Cluster" 11 | produces: { 12 | type: "library.database.cockroach.ClusterInstance" 13 | source: "./types.proto" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /std/go/http/middleware/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $providerProto: inputs.#Proto & { 7 | source: "provider.proto" 8 | } 9 | 10 | extension: fn.#Extension & { 11 | provides: { 12 | Middleware: { 13 | input: $providerProto.types.MiddlewareRegistration 14 | 15 | availableIn: { 16 | go: type: "Middleware" 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /internal/environment/ci.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package environment 6 | 7 | import "os" 8 | 9 | func IsRunningInCI() bool { 10 | return os.Getenv("CI") != "" 11 | } 12 | 13 | func DigestLocalInputs() bool { 14 | return os.Getenv("DIGEST_LOCAL_INPUTS") == "true" 15 | } 16 | -------------------------------------------------------------------------------- /internal/testdata/server/multiport/server.cue: -------------------------------------------------------------------------------- 1 | server: { 2 | name: "multiport" 3 | 4 | integration: "go" 5 | 6 | services: { 7 | multi: { 8 | ports: [ 9 | { 10 | port: 50000 11 | exportedPort: 5000 12 | }, 13 | { 14 | port: 4000 15 | protocol: "udp" 16 | }, 17 | ] 18 | } 19 | } 20 | 21 | ports: { 22 | main: { 23 | containerPort: 3000 24 | // hostPort: 30000 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /universe/storage/minio/creds/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package creds 3 | 4 | #Exports: { 5 | Creds: { 6 | #Definition: { 7 | packageName: "namespacelabs.dev/foundation/universe/storage/minio/creds" 8 | type: "Creds" 9 | typeDefinition: { 10 | "typename": "foundation.universe.storage.minio.creds.CredsRequest" 11 | "source": [ 12 | "provider.proto", 13 | ] 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /internal/testdata/service/simple/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/internal/testdata/datastore" 5 | "namespacelabs.dev/foundation/std/grpc/deadlines" 6 | ) 7 | 8 | $proto: inputs.#Proto & { 9 | source: "../proto/simple.proto" 10 | } 11 | 12 | service: fn.#Service & { 13 | framework: "GO" 14 | exportService: $proto.services.EmptyService 15 | } 16 | -------------------------------------------------------------------------------- /universe/onepassword/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.providers.onepassword; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/onepassword"; 10 | 11 | message Secret { 12 | string secret_reference = 1; 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/counter/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testdata.counter; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/counter"; 10 | 11 | message Input { 12 | string name = 1; 13 | } 14 | -------------------------------------------------------------------------------- /std/go/grpc/interceptors/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $providerProto: inputs.#Proto & { 7 | source: "provider.proto" 8 | } 9 | 10 | extension: fn.#Extension & { 11 | provides: { 12 | InterceptorRegistration: { 13 | input: $providerProto.types.InterceptorRegistration 14 | 15 | availableIn: { 16 | go: type: "Registration" 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /std/go/http/middleware/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.go.http.middleware; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/go/http/middleware"; 10 | 11 | message MiddlewareRegistration { 12 | string name = 1; 13 | } -------------------------------------------------------------------------------- /framework/ulimit/ulimit_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package ulimit 6 | 7 | import "errors" 8 | 9 | func SetFileLimit(n uint64) error { 10 | return errors.ErrUnsupported 11 | } 12 | 13 | func SetCoreFileLimit(maxCoreFileSize uint64) error { 14 | return errors.ErrUnsupported 15 | } 16 | -------------------------------------------------------------------------------- /internal/buildkite/env.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buildkite 6 | 7 | import ( 8 | "os" 9 | ) 10 | 11 | func IsRunningInBuildkite() bool { 12 | return os.Getenv("BUILDKITE") == "true" 13 | } 14 | 15 | func BuildMessage() string { 16 | return os.Getenv("BUILDKITE_MESSAGE") 17 | } 18 | -------------------------------------------------------------------------------- /internal/process/exec_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package process 6 | 7 | import "os/exec" 8 | 9 | func SetSIDAttr(cmd *exec.Cmd, val bool) { 10 | // Means nothing on Windows. 11 | } 12 | 13 | func ForegroundAttr(cmd *exec.Cmd, val bool) { 14 | // Means nothing on Windows. 15 | } 16 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/environment.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package kubernetes 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | func deployAsPods(env *schema.Environment) bool { 10 | return env.GetPurpose() == schema.Environment_TESTING && DeployAsPodsInTests 11 | } 12 | -------------------------------------------------------------------------------- /internal/testdata/counter/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package counter 3 | 4 | #Exports: { 5 | Counter: { 6 | name?: string 7 | 8 | #Definition: { 9 | packageName: "namespacelabs.dev/foundation/internal/testdata/counter" 10 | type: "Counter" 11 | typeDefinition: { 12 | "typename": "foundation.internal.testdata.counter.Input" 13 | "source": [ 14 | "provider.proto", 15 | ] 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /universe/aws/s3/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.aws.s3; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/aws/s3"; 10 | 11 | message BucketConfig { 12 | string region = 1; 13 | string bucket_name = 2; 14 | } 15 | -------------------------------------------------------------------------------- /framework/console/termios/syscalls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | //go:build !windows && !linux 6 | // +build !windows,!linux 7 | 8 | package termios 9 | 10 | import ( 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | const ( 15 | ioctlGETATTR = unix.TIOCGETA 16 | ioctlSETATTR = unix.TIOCSETA 17 | ) 18 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/kubeobserver/funcs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package kubeobserver 6 | 7 | import ( 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 | ) 10 | 11 | func PickPod(name string) metav1.ListOptions { 12 | return metav1.SingleObject(metav1.ObjectMeta{Name: name}) 13 | } 14 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/classes/resourceclasses.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "Database": { 3 | produces: { 4 | type: "foundation.internal.testdata.integrations.resources.classes.protos.DatabaseInstance" 5 | source: "./protos/proto2.proto" 6 | } 7 | } 8 | 9 | "Database2": { 10 | produces: { 11 | type: "foundation.internal.testdata.integrations.resources.classes.protos.DatabaseInstance" 12 | source: "./protos/proto2.proto" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /std/runtime/kubernetes/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.runtime.kubernetes; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/runtime/kubernetes"; 10 | 11 | message ServerExtensionArgs { 12 | bool ensureServiceAccount = 1; 13 | } 14 | -------------------------------------------------------------------------------- /universe/storage/s3/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package s3 3 | 4 | #Exports: { 5 | Bucket: { 6 | bucketName?: string 7 | region?: string 8 | 9 | #Definition: { 10 | packageName: "namespacelabs.dev/foundation/universe/storage/s3" 11 | type: "Bucket" 12 | typeDefinition: { 13 | "typename": "foundation.universe.storage.s3.BucketArgs" 14 | "source": [ 15 | "types.proto", 16 | ] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /schema/storage/deploy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package storage 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/planning/constants" 9 | ) 10 | 11 | func (e *Endpoint) IsIngress() bool { 12 | return e != nil && e.EndpointOwner == "" && e.ServiceName == constants.IngressServiceName 13 | } 14 | -------------------------------------------------------------------------------- /std/core/typealiases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package core 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/std/core/types" 9 | ) 10 | 11 | type LivenessCheckArgs = types.LivenessCheckArgs 12 | type ReadinessCheckArgs = types.ReadinessCheckArgs 13 | type DebugHandlerArgs = types.DebugHandlerArgs 14 | -------------------------------------------------------------------------------- /internal/sdk/host/platform.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package host 6 | 7 | import ( 8 | specs "github.com/opencontainers/image-spec/specs-go/v1" 9 | "namespacelabs.dev/foundation/internal/parsing/platform" 10 | ) 11 | 12 | func HostPlatform() specs.Platform { 13 | return platform.RuntimePlatform() 14 | } 15 | -------------------------------------------------------------------------------- /std/execution/inputs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package execution 6 | 7 | import "google.golang.org/protobuf/proto" 8 | 9 | type Input struct { 10 | Message proto.Message 11 | Instance any 12 | } 13 | 14 | type Inputs map[string]Input 15 | 16 | var InputsInjection = Define[Inputs]("namespace.ops.inputs") 17 | -------------------------------------------------------------------------------- /std/go/http/middleware/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package middleware 3 | 4 | #Exports: { 5 | Middleware: { 6 | name?: string 7 | 8 | #Definition: { 9 | packageName: "namespacelabs.dev/foundation/std/go/http/middleware" 10 | type: "Middleware" 11 | typeDefinition: { 12 | "typename": "foundation.std.go.http.middleware.MiddlewareRegistration" 13 | "source": [ 14 | "provider.proto", 15 | ] 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /cmd/ns/gon.hcl: -------------------------------------------------------------------------------- 1 | source = ["./dist/macos_darwin_amd64/fn","./dist/macos_darwin_arm64/fn"] 2 | bundle_id = "com.namespacelabs.foundation" 3 | 4 | apple_id { 5 | username = "hugosantos@gmail.com" 6 | password = "@env:APPLE_PASSWORD" 7 | } 8 | 9 | sign { 10 | application_identity = "Developer ID Application: Namespace Labs Inc" 11 | } 12 | 13 | zip { 14 | output_path = "./dist/fn_macos.zip" 15 | } 16 | 17 | dmg { 18 | output_path = "./dist/fn_macos.dmg" 19 | volume_name = "Foundation" 20 | } -------------------------------------------------------------------------------- /framework/kubernetes/kubedef/details.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.kubedef; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/kubernetes/kubedef"; 10 | 11 | message ServiceAccountDetails { 12 | string service_account_name = 1; 13 | } -------------------------------------------------------------------------------- /internal/integrations/opaque/dev.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package opaque 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | const ( 10 | forceProd = false 11 | ) 12 | 13 | func UseDevBuild(env *schema.Environment) bool { 14 | return !forceProd && env.Purpose == schema.Environment_DEVELOPMENT 15 | } 16 | -------------------------------------------------------------------------------- /orchestration/server/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#Server & { 6 | id: "0fomj22adbua2u0ug3og" 7 | name: "orchestration-api-server" 8 | framework: "GO" 9 | 10 | import: [ 11 | "namespacelabs.dev/foundation/orchestration/service", 12 | "namespacelabs.dev/foundation/std/grpc/logging", 13 | ] 14 | } 15 | 16 | configure: fn.#Configure & { 17 | with: binary: "namespacelabs.dev/foundation/orchestration/server/tool" 18 | } 19 | -------------------------------------------------------------------------------- /std/module/packageloader.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package module 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/parsing" 9 | "namespacelabs.dev/foundation/std/cfg" 10 | ) 11 | 12 | func NewPackageLoader(env cfg.Context) *parsing.PackageLoader { 13 | return parsing.NewPackageLoader(env) 14 | } 15 | -------------------------------------------------------------------------------- /std/protocol/logging.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.protocol; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/protocol"; 10 | 11 | // A request ID may be attached to a status.Status used as an error. 12 | message RequestID { 13 | string id = 1; 14 | } -------------------------------------------------------------------------------- /std/tasks/idtypes/id.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package idtypes 6 | 7 | import "github.com/cespare/xxhash/v2" 8 | 9 | type IdAndHash struct { 10 | ID string 11 | Digest uint64 12 | } 13 | 14 | func IdAndHashFrom(id string) IdAndHash { 15 | return IdAndHash{ID: id, Digest: xxhash.Sum64String(id)} 16 | } 17 | -------------------------------------------------------------------------------- /universe/development/localstack/s3/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.development.localstack.s3; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/development/localstack/s3"; 10 | 11 | import public "universe/aws/s3/provider.proto"; 12 | 13 | -------------------------------------------------------------------------------- /internal/build/assets/buildassets.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package assets 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/compute" 9 | "namespacelabs.dev/foundation/schema" 10 | ) 11 | 12 | type AvailableBuildAssets struct { 13 | IngressFragments compute.Computable[[]*schema.IngressFragment] 14 | } 15 | -------------------------------------------------------------------------------- /internal/testdata/counter/data/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testdata.scopes.data; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/scopes/data"; 10 | 11 | message Input {} 12 | 13 | message Data { 14 | int32 value = 1; 15 | } -------------------------------------------------------------------------------- /internal/networking/ingress/nginx/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema.runtime.kubernetes.networking.ingress.nginx; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/networking/ingress/nginx"; 10 | 11 | message ProxyBodySize { 12 | string limit = 1; 13 | } -------------------------------------------------------------------------------- /std/development/filesync/config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.development.filesync; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/development/filesync"; 10 | 11 | message FileSyncConfiguration { 12 | string root_dir = 1; 13 | int32 port = 2; 14 | } -------------------------------------------------------------------------------- /std/runtime/kubernetes/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package kubernetes 3 | 4 | #Exports: { 5 | ServerExtension: { 6 | ensureServiceAccount?: bool 7 | 8 | #Definition: { 9 | packageName: "namespacelabs.dev/foundation/std/runtime/kubernetes" 10 | type: "ServerExtension" 11 | typeDefinition: { 12 | "typename": "foundation.std.runtime.kubernetes.ServerExtensionArgs" 13 | "source": [ 14 | "types.proto", 15 | ] 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /internal/build/buildkit/fix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buildkit 6 | 7 | // Force a direct dependency so we can more easily manage fsutil's version, and 8 | // ensure that 9 | // https://github.com/tonistiigi/fsutil/commit/c08f2311f936733e8f998dd2395aff7605cb7379 10 | // is in. 11 | import _ "github.com/tonistiigi/fsutil" 12 | -------------------------------------------------------------------------------- /internal/frontend/cuefrontend/integration/api/integration.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package api 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/frontend/cuefrontend/entity" 9 | ) 10 | 11 | var ( 12 | IntegrationParser *entity.DispatchingEntityParser 13 | BuildParser *entity.DispatchingEntityParser 14 | ) 15 | -------------------------------------------------------------------------------- /universe/development/localstack/s3/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package s3 3 | 4 | #Exports: { 5 | Bucket: { 6 | region?: string 7 | bucketName?: string 8 | 9 | #Definition: { 10 | packageName: "namespacelabs.dev/foundation/universe/development/localstack/s3" 11 | type: "Bucket" 12 | typeDefinition: { 13 | "typename": "foundation.universe.aws.s3.BucketConfig" 14 | "source": [ 15 | "provider.proto", 16 | ] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /internal/artifacts/oci/reference.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package oci 6 | 7 | import "github.com/google/go-containerregistry/pkg/name" 8 | 9 | type imageReference struct { 10 | name.Reference 11 | repository name.Repository 12 | } 13 | 14 | func (i *imageReference) Context() name.Repository { 15 | return i.repository 16 | } 17 | -------------------------------------------------------------------------------- /std/pkggraph/injections.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package pkggraph 6 | 7 | import "namespacelabs.dev/foundation/std/execution" 8 | 9 | var ( 10 | PackageLoaderInjection = execution.Define[PackageLoader]("ns.pkggraph.package-loader") 11 | MutableModuleInjection = execution.Define[MutableModule]("ns.pkggraph.mutable-module") 12 | ) 13 | -------------------------------------------------------------------------------- /internal/providers/k3d/configuration.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.providers.k3d; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/providers/k3d"; 10 | 11 | message Configuration { 12 | string registry_container_name = 1; 13 | string cluster_name = 2; 14 | } 15 | -------------------------------------------------------------------------------- /library/oss/redis/resources.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | // colocated represents a Redis cluster that can be easily used by multiple users, within a single cluster. 3 | colocated: { 4 | class: "namespacelabs.dev/foundation/library/database/redis:Cluster" 5 | provider: "namespacelabs.dev/foundation/library/oss/redis" 6 | 7 | intent: { 8 | server: "namespacelabs.dev/foundation/library/oss/redis/server" 9 | password_secret: "namespacelabs.dev/foundation/library/oss/redis/server:password" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /std/runtime/kubernetes/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $typesProto: inputs.#Proto & { 7 | source: "types.proto" 8 | } 9 | 10 | extension: fn.#Extension & { 11 | provides: { 12 | ServerExtension: { 13 | input: $typesProto.types.ServerExtensionArgs 14 | } 15 | } 16 | 17 | on: { 18 | prepare: { 19 | invokeInternal: "namespacelabs.dev/foundation/std/runtime/kubernetes.ApplyServerExtensions" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cmd/ns/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | "namespacelabs.dev/foundation/internal/cli/cmd" 10 | "namespacelabs.dev/foundation/internal/cli/fncobra/ns" 11 | ) 12 | 13 | func main() { 14 | ns.DoMain("ns", true, func(root *cobra.Command) { 15 | cmd.RegisterCommands(root) 16 | }) 17 | } 18 | -------------------------------------------------------------------------------- /internal/cli/cmd/gcp/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package gcp 6 | 7 | import "github.com/spf13/cobra" 8 | 9 | func NewGcpCmd() *cobra.Command { 10 | cmd := &cobra.Command{ 11 | Use: "gcp", 12 | Short: "Google Cloud Platform Federation related commands.", 13 | } 14 | 15 | cmd.AddCommand(newImpersonateCmd()) 16 | 17 | return cmd 18 | } 19 | -------------------------------------------------------------------------------- /internal/testdata/service/rawlistener/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/grpc/deadlines" 5 | "namespacelabs.dev/foundation/internal/testdata/counter" 6 | ) 7 | 8 | service: fn.#Service & { 9 | framework: "GO" 10 | listener: "second" 11 | ingress: "LOAD_BALANCER" 12 | exportedPort: 10000 13 | 14 | instantiate: { 15 | one: counter.#Exports.Counter & { 16 | name: "one" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /std/execution/defs/makedef.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package defs 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | type MakeDefinition interface { 10 | ToDefinition(...schema.PackageName) (*schema.SerializedInvocation, error) 11 | } 12 | 13 | type MakeExtension interface { 14 | ToDefinition() (*schema.DefExtension, error) 15 | } 16 | -------------------------------------------------------------------------------- /internal/testdata/counter/data/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package data 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/go/core" 9 | ) 10 | 11 | type _checkProvideData func(context.Context, *Input) (*Data, error) 12 | 13 | var _ _checkProvideData = ProvideData 14 | 15 | var ( 16 | Package__1ncqmo = &core.Package{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/counter/data", 18 | } 19 | ) 20 | -------------------------------------------------------------------------------- /internal/testdata/counter/data/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | $providerProto: inputs.#Proto & { 7 | source: "provider.proto" 8 | } 9 | 10 | extension: fn.#Extension & { 11 | provides: { 12 | Data: { 13 | input: $providerProto.types.Input 14 | 15 | availableIn: { 16 | go: { 17 | package: "namespacelabs.dev/foundation/internal/testdata/counter/data" 18 | type: "*Data" 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /internal/testdata/server/justports/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "net/http" 10 | ) 11 | 12 | func main() { 13 | http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 14 | fmt.Fprintln(w, "hello world") 15 | })) 16 | http.ListenAndServe(":3000", http.DefaultServeMux) 17 | } 18 | -------------------------------------------------------------------------------- /internal/testdata/server/multiport/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "net/http" 10 | ) 11 | 12 | func main() { 13 | http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 14 | fmt.Fprintln(w, "hello world") 15 | })) 16 | http.ListenAndServe(":3000", http.DefaultServeMux) 17 | } 18 | -------------------------------------------------------------------------------- /library/oss/externaldns/resources.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | permissions: { 3 | class: "namespacelabs.dev/foundation/library/kubernetes/rbac:ClusterRole" 4 | intent: { 5 | name: "ExternalDNS" 6 | rules: [ 7 | {apiGroups: [""], resources: ["services", "endpoints", "pods"], verbs: ["get", "watch", "list"]}, 8 | {apiGroups: ["extensions", "networking.k8s.io"], resources: ["ingresses"], verbs: ["get", "watch", "list"]}, 9 | {apiGroups: [""], resources: ["nodes"], verbs: ["watch", "list"]}, 10 | ] 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /std/grpc/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package grpc 5 | 6 | import ( 7 | "context" 8 | "google.golang.org/grpc" 9 | "namespacelabs.dev/foundation/std/go/core" 10 | ) 11 | 12 | type _checkProvideConn func(context.Context, *Backend) (*grpc.ClientConn, error) 13 | 14 | var _ _checkProvideConn = ProvideConn 15 | 16 | var ( 17 | Package__k4hdjh = &core.Package{ 18 | PackageName: "namespacelabs.dev/foundation/std/grpc", 19 | } 20 | ) 21 | -------------------------------------------------------------------------------- /std/grpc/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.grpc; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/grpc"; 10 | 11 | import "std/proto/options.proto"; 12 | 13 | // Separating the protos so fn can compiled them in with minimal dependencies. 14 | import public "std/grpc/protos/provider.proto"; -------------------------------------------------------------------------------- /internal/build/binary/prebuilt.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.build.binary; 8 | 9 | import "schema/workspace.proto"; 10 | 11 | option go_package = "namespacelabs.dev/foundation/internal/build/binary"; 12 | 13 | message Prebuilts { 14 | repeated foundation.schema.Workspace.BinaryDigest prebuilt_binary = 1; 15 | } -------------------------------------------------------------------------------- /internal/cli/cmd/scratch/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package scratch 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | func NewScratchCmd() *cobra.Command { 12 | cmd := &cobra.Command{ 13 | Use: "scratch", 14 | Short: "Manage temporary scratch instances.", 15 | } 16 | 17 | cmd.AddCommand(NewSshCmd()) 18 | 19 | return cmd 20 | } 21 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/client/hostconfig.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package client 6 | 7 | import "namespacelabs.dev/foundation/std/cfg" 8 | 9 | func NewLocalHostEnv(contextName string, env cfg.Context) *HostEnv { 10 | hostEnv := &HostEnv{ 11 | Kubeconfig: "~/.kube/config", 12 | Context: contextName, 13 | } 14 | 15 | return hostEnv 16 | } 17 | -------------------------------------------------------------------------------- /internal/testdata/counter/data/wire.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package data 6 | 7 | import ( 8 | "context" 9 | 10 | "namespacelabs.dev/foundation/std/go/core" 11 | ) 12 | 13 | func ProvideData(ctx context.Context, _ *Input) (*Data, error) { 14 | core.ZLog.Printf("[debug] path: %s", core.InstantiationPathFromContext(ctx)) 15 | return &Data{}, nil 16 | } 17 | -------------------------------------------------------------------------------- /universe/storage/minio/creds/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package creds 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/go/core" 9 | ) 10 | 11 | type _checkProvideCreds func(context.Context, *CredsRequest) (*Creds, error) 12 | 13 | var _ _checkProvideCreds = ProvideCreds 14 | 15 | var ( 16 | Package__cld7nf = &core.Package{ 17 | PackageName: "namespacelabs.dev/foundation/universe/storage/minio/creds", 18 | } 19 | ) 20 | -------------------------------------------------------------------------------- /internal/cli/cmd/image/image.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package image 6 | 7 | import "github.com/spf13/cobra" 8 | 9 | func NewImageCmd() *cobra.Command { 10 | cmd := &cobra.Command{ 11 | Use: "image", 12 | Short: "Internal commands, for debugging.", 13 | Hidden: true, 14 | } 15 | 16 | cmd.AddCommand(newMakeDiskCmd()) 17 | 18 | return cmd 19 | } 20 | -------------------------------------------------------------------------------- /internal/disk/disk_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package disk 6 | 7 | // We don't require filesystem information in MacOS. Filesystem information 8 | // is used temporarily as part of #121, which doesn't affect MacOS. This 9 | // package is expected to be removed afterwards. 10 | func FSType(path string) (string, error) { 11 | return "unknown", nil 12 | } 13 | -------------------------------------------------------------------------------- /internal/runtime/docker/config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package runtime.docker; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/runtime/docker"; 10 | 11 | message Configuration { 12 | string host = 1; 13 | string version = 2; 14 | string cert_path = 3; 15 | bool verify_tls = 4; 16 | } 17 | -------------------------------------------------------------------------------- /library/oss/postgres/resources.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | // colocated represents a Postgres cluster that can be easily used by multiple users, within a single cluster. 3 | colocated: { 4 | class: "namespacelabs.dev/foundation/library/database/postgres:Cluster" 5 | provider: "namespacelabs.dev/foundation/library/oss/postgres" 6 | 7 | intent: { 8 | server: "namespacelabs.dev/foundation/library/oss/postgres/server" 9 | password_secret: "namespacelabs.dev/foundation/library/oss/postgres/server:password" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /universe/go/panicparse/prepare.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package panicparse 6 | 7 | import ( 8 | "context" 9 | "net/http" 10 | 11 | "github.com/maruel/panicparse/v2/stack/webstack" 12 | ) 13 | 14 | func Prepare(ctx context.Context, deps ExtensionDeps) error { 15 | deps.DebugHandler.Handle(http.HandlerFunc(webstack.SnapshotHandler)) 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /universe/storage/minio/creds/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.storage.minio.creds; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/storage/minio/creds"; 10 | 11 | message CredsRequest { 12 | } 13 | 14 | message Creds { 15 | string user = 1; 16 | string password = 2; 17 | } 18 | -------------------------------------------------------------------------------- /internal/cli/cmd/cluster/private/root.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package private 6 | 7 | import "github.com/spf13/cobra" 8 | 9 | func NewInternalCmd() *cobra.Command { 10 | cmd := &cobra.Command{ 11 | Use: "internal", 12 | Args: cobra.NoArgs, 13 | Hidden: true, 14 | } 15 | 16 | cmd.AddCommand(newInternalTerminalAttach()) 17 | 18 | return cmd 19 | } 20 | -------------------------------------------------------------------------------- /internal/disk/disk_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package disk 6 | 7 | // We don't require filesystem information in Windows. Filesystem information 8 | // is used temporarily as part of #121, which doesn't affect Windows. This 9 | // package is expected to be removed afterwards. 10 | func FSType(path string) (string, error) { 11 | return "unknown", nil 12 | } 13 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/testgenprovider/proto1.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testdata.integrations.resources.classes; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/integrations/resources/testgenprovider"; 10 | 11 | message DatabaseIntent { 12 | string name = 1; 13 | } -------------------------------------------------------------------------------- /library/oss/cockroach/resources.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | // colocated represents a cockroach cluster that can be easily used by multiple users, within a single cluster. 3 | colocated: { 4 | class: "namespacelabs.dev/foundation/library/database/cockroach:Cluster" 5 | provider: "namespacelabs.dev/foundation/library/oss/cockroach" 6 | 7 | intent: { 8 | server: "namespacelabs.dev/foundation/library/oss/cockroach/server" 9 | password_secret: "namespacelabs.dev/foundation/library/oss/cockroach/server:password" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /std/go/grpc/interceptors/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package interceptors 3 | 4 | #Exports: { 5 | InterceptorRegistration: { 6 | name?: string 7 | after?: [...string] 8 | 9 | #Definition: { 10 | packageName: "namespacelabs.dev/foundation/std/go/grpc/interceptors" 11 | type: "InterceptorRegistration" 12 | typeDefinition: { 13 | "typename": "foundation.std.go.grpc.interceptors.InterceptorRegistration" 14 | "source": [ 15 | "provider.proto", 16 | ] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /std/grpc/methodname.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package grpc 6 | 7 | import "strings" 8 | 9 | func SplitMethodName(fullMethodName string) (string, string) { 10 | fullMethodName = strings.TrimPrefix(fullMethodName, "/") 11 | if i := strings.Index(fullMethodName, "/"); i >= 0 { 12 | return fullMethodName[:i], fullMethodName[i+1:] 13 | } 14 | return "", "" 15 | } 16 | -------------------------------------------------------------------------------- /universe/storage/minio/configure/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | extension: fn.#Extension & { 6 | import: [ 7 | "namespacelabs.dev/foundation/universe/storage/minio/creds", 8 | ] 9 | } 10 | 11 | configure: fn.#Configure & { 12 | startup: { 13 | args: [ 14 | "server", 15 | "/tmp", 16 | "--address=:9000", 17 | "--console-address=:9001", 18 | ] 19 | 20 | env: { 21 | // Disable update checking as self-update will never be used. 22 | MINIO_UPDATE: "off" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /framework/kubernetes/kubeobj/podreference.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.kubeobj; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/kubernetes/kubeobj"; 10 | 11 | message ContainerPodReference { 12 | string namespace = 1; 13 | string pod_name = 2; 14 | string container = 3; 15 | } -------------------------------------------------------------------------------- /internal/build/buildkit/estargz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buildkit 6 | 7 | var ForceEstargz bool 8 | 9 | func MaybeForceEstargz(src map[string]string) map[string]string { 10 | if !ForceEstargz { 11 | return src 12 | } 13 | 14 | src["compression"] = "estargz" 15 | src["oci-mediatypes"] = "true" 16 | src["force-compress"] = "true" 17 | return src 18 | } 19 | -------------------------------------------------------------------------------- /internal/providers/aws/eks/op.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.providers.aws.eks; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/providers/aws/eks"; 10 | 11 | message OpEnsureAwsAuth { 12 | string username = 1; 13 | string rolearn = 2; 14 | repeated string group = 3; 15 | } -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/classes/protos/proto2.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testdata.integrations.resources.classes.protos; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/integrations/resources/classes/protos"; 10 | 11 | message DatabaseInstance { 12 | string url = 1; 13 | } -------------------------------------------------------------------------------- /std/monitoring/tracing/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.monitoring.tracing; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/monitoring/tracing"; 10 | 11 | message ExporterArgs { 12 | string name = 1; 13 | } 14 | 15 | message DetectorArgs { 16 | string name = 1; 17 | } 18 | 19 | message NoArgs {} 20 | -------------------------------------------------------------------------------- /framework/deploy/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.framework.deploy; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/deploy"; 10 | 11 | message Deployment { 12 | bool require_reason = 1; 13 | string update_slack_channel = 2; 14 | string slack_bot_token_secret_ref = 3; 15 | } 16 | -------------------------------------------------------------------------------- /internal/compression/zstd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package compression 6 | 7 | import ( 8 | "bytes" 9 | "io" 10 | 11 | "github.com/klauspost/compress/zstd" 12 | ) 13 | 14 | func DecompressZstd(payload []byte) ([]byte, error) { 15 | r, err := zstd.NewReader(bytes.NewReader(payload)) 16 | if err != nil { 17 | return nil, err 18 | } 19 | return io.ReadAll(r) 20 | } 21 | -------------------------------------------------------------------------------- /std/cfg/knobs/config/config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.planning.knobs.config; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/planning/knobs/config"; 10 | 11 | import "google/protobuf/any.proto"; 12 | 13 | message Knob { 14 | string name = 1; 15 | google.protobuf.Any value = 2; 16 | } 17 | -------------------------------------------------------------------------------- /std/go/grpc/interceptors/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.go.grpc.interceptors; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/go/grpc/interceptors"; 10 | 11 | message InterceptorRegistration { 12 | string name = 1; 13 | repeated string after = 2; // Run this interceptor after the specified ones. 14 | } -------------------------------------------------------------------------------- /std/grpc/protos/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.grpc.protos; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/grpc/protos"; 10 | 11 | import "std/proto/options.proto"; 12 | 13 | message Backend { 14 | string package_name = 1 [(foundation.std.proto.is_package) = true]; 15 | string service_name = 2; 16 | } -------------------------------------------------------------------------------- /std/monitoring/prometheus/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | extension: fn.#Extension & {} 7 | 8 | $promServer: inputs.#Server & { 9 | packageName: "namespacelabs.dev/foundation/std/monitoring/prometheus/server" 10 | } 11 | 12 | configure: fn.#Configure & { 13 | stack: { 14 | append: [$promServer] 15 | } 16 | 17 | with: { 18 | binary: "namespacelabs.dev/foundation/std/monitoring/prometheus/tool" 19 | args: { 20 | mode: "client" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /internal/codegen/protos/filedescset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package protos 6 | 7 | import dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" 8 | 9 | func (fds *FileDescriptorSetAndDeps) AsFileDescriptorSet() *dpb.FileDescriptorSet { 10 | return &dpb.FileDescriptorSet{ 11 | File: append(append([]*dpb.FileDescriptorProto{}, fds.File...), fds.Dependency...), 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /internal/sdk/buf/buf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buf 6 | 7 | type GenerateTmpl struct { 8 | Version string `json:"version"` 9 | Plugins []PluginTmpl `json:"plugins"` 10 | } 11 | 12 | type PluginTmpl struct { 13 | Name string `json:"name,omitempty"` 14 | Path string `json:"path,omitempty"` 15 | Out string `json:"out"` 16 | Opt []string `json:"opt"` 17 | } 18 | -------------------------------------------------------------------------------- /internal/testdata/datastore/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/core" 5 | ) 6 | 7 | $providerProto: inputs.#Proto & { 8 | source: "provider.proto" 9 | } 10 | 11 | extension: fn.#Extension & { 12 | instantiate: { 13 | readinessCheck: core.#Exports.ReadinessCheck 14 | } 15 | 16 | provides: { 17 | Database: { 18 | input: $providerProto.types.Database 19 | 20 | availableIn: { 21 | go: type: "*DB" 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/testdata/service/localstacks3/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/universe/storage/s3" 5 | ) 6 | 7 | $proto: inputs.#Proto & { 8 | source: "../proto/file.proto" 9 | } 10 | 11 | service: fn.#Service & { 12 | framework: "GO" 13 | 14 | instantiate: { 15 | "bucket": s3.#Exports.Bucket & { 16 | bucketName: "test-foo-bucket" 17 | } 18 | } 19 | 20 | exportService: $proto.services.FileService 21 | ingress: "INTERNET_FACING" 22 | } 23 | -------------------------------------------------------------------------------- /std/go/http/middleware/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package middleware 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/go/core" 9 | ) 10 | 11 | type _checkProvideMiddleware func(context.Context, *MiddlewareRegistration) (Middleware, error) 12 | 13 | var _ _checkProvideMiddleware = ProvideMiddleware 14 | 15 | var ( 16 | Package__c3bggl = &core.Package{ 17 | PackageName: "namespacelabs.dev/foundation/std/go/http/middleware", 18 | } 19 | ) 20 | -------------------------------------------------------------------------------- /internal/testdata/datastore/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testdata.datastore; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/datastore"; 10 | 11 | import "std/types/resource.proto"; 12 | 13 | message Database { 14 | string name = 1; 15 | foundation.std.types.Resource schema_file = 2; 16 | } -------------------------------------------------------------------------------- /internal/protos/consolidate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package protos 6 | 7 | import ( 8 | "reflect" 9 | 10 | "google.golang.org/protobuf/proto" 11 | ) 12 | 13 | func CheckConsolidate[V proto.Message](check V, out *V) bool { 14 | if reflect.ValueOf(out).Elem().IsNil() { 15 | *out = check 16 | } else if !proto.Equal(*out, check) { 17 | return false 18 | } 19 | return true 20 | } 21 | -------------------------------------------------------------------------------- /internal/testdata/integrations/dockerfile/complex/test/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "injected endpoint is $ENDPOINT" 4 | 5 | RESPONSE=`curl -s $ENDPOINT/mypath` 6 | 7 | if [[ "$RESPONSE" != *"Hello from complex docker"* ]]; then 8 | echo "Unexpected response: $RESPONSE" 9 | exit 1 10 | fi 11 | 12 | # Testing Namespace itself: verifying that `fromServiceIngress` works. 13 | # In tests the result is the in-cluster address. 14 | if [[ "$INGRESS" != "http://webapi-mdpnh1j3smf8t83e:4000" ]]; then 15 | echo "Unexpected ingress: $INGRESS" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /std/grpc/deadlines/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package deadlines 3 | 4 | #Exports: { 5 | Deadlines: { 6 | configuration?: [...{ 7 | serviceName?: string 8 | methodName?: string 9 | maximumDeadline?: float 10 | }] 11 | 12 | #Definition: { 13 | packageName: "namespacelabs.dev/foundation/std/grpc/deadlines" 14 | type: "Deadlines" 15 | typeDefinition: { 16 | "typename": "foundation.std.grpc.deadlines.Deadline" 17 | "source": [ 18 | "provider.proto", 19 | ] 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /std/grpc/logging/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "encoding/json" 3 | "namespacelabs.dev/foundation/std/fn" 4 | "namespacelabs.dev/foundation/std/fn:inputs" 5 | "namespacelabs.dev/foundation/std/go/grpc/interceptors" 6 | "namespacelabs.dev/foundation/std/go/http/middleware" 7 | ) 8 | 9 | extension: fn.#Extension & { 10 | hasInitializerIn: "GO" 11 | 12 | instantiate: { 13 | "interceptors": interceptors.#Exports.InterceptorRegistration & { 14 | name: "grpc-logging" 15 | after: ["namespace-rid"] 16 | } 17 | "middleware": middleware.#Exports.Middleware 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /universe/aws/configuration/eks/config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.aws.configuration.eks; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/aws/configuration/eks"; 10 | 11 | // Used as a configuration provider in an environment. 12 | message Cluster { 13 | string name = 1; 14 | string ingress_class = 2; 15 | } 16 | -------------------------------------------------------------------------------- /universe/aws/irsa/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/runtime/kubernetes" 4 | ) 5 | 6 | extension: fn.#Extension & { 7 | instantiate: { 8 | k8s: kubernetes.#Exports.ServerExtension & { 9 | ensureServiceAccount: true 10 | } 11 | } 12 | 13 | on: { 14 | prepare: { 15 | invokeInternal: "namespacelabs.dev/foundation/universe/aws/eks.DescribeCluster" 16 | } 17 | } 18 | } 19 | 20 | configure: fn.#Configure & { 21 | with: binary: "namespacelabs.dev/foundation/universe/aws/irsa/prepare" 22 | } 23 | -------------------------------------------------------------------------------- /internal/cli/cmd/admin/admin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package admin 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | func NewAdminCmd(hidden bool) *cobra.Command { 12 | cmd := &cobra.Command{ 13 | Use: "admin", 14 | Short: "Partner administration commands.", 15 | Hidden: hidden, 16 | } 17 | 18 | cmd.AddCommand(newSignPartnerTokenCmd()) 19 | 20 | return cmd 21 | } 22 | -------------------------------------------------------------------------------- /internal/testdata/service/count/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/internal/testdata/counter" 5 | ) 6 | 7 | $proto: inputs.#Proto & { 8 | source: "../proto/count.proto" 9 | } 10 | 11 | service: fn.#Service & { 12 | framework: "GO" 13 | 14 | instantiate: { 15 | one: counter.#Exports.Counter & { 16 | name: "one" 17 | } 18 | two: counter.#Exports.Counter & { 19 | name: "two" 20 | } 21 | } 22 | 23 | exportService: $proto.services.CountService 24 | } 25 | -------------------------------------------------------------------------------- /internal/hotreload/constants/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package hotreload 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | var ( 10 | ControllerPkg = schema.MakePackageSingleRef(schema.PackageName("namespacelabs.dev/foundation/std/development/filesync/controller")) 11 | ) 12 | 13 | const ( 14 | FileSyncPort = 50000 15 | ControllerCommand = "/filesync-controller" 16 | ) 17 | -------------------------------------------------------------------------------- /library/kubernetes/helm/resources.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "HelmRelease": { 3 | description: "Helm release from a static set of charts" 4 | produces: { 5 | type: "library.kubernetes.helm.HelmReleaseInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | } 10 | 11 | providers: { 12 | "namespacelabs.dev/foundation/library/kubernetes/helm:HelmRelease": { 13 | prepareWith: "namespacelabs.dev/foundation/library/kubernetes/helm/prepare" 14 | 15 | intent: { 16 | type: "library.kubernetes.helm.HelmReleaseIntent" 17 | source: "./types.proto" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /schema/storage/diagnostics.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema.storage; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema/storage"; 10 | 11 | import "google/protobuf/any.proto"; 12 | 13 | message EnvironmentDiagnostics { 14 | string runtime = 1; 15 | repeated google.protobuf.Any runtime_specific = 2; 16 | } -------------------------------------------------------------------------------- /std/core/info/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package info 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/core/types" 9 | "namespacelabs.dev/foundation/std/go/core" 10 | ) 11 | 12 | type _checkProvideServerInfo func(context.Context, *ServerInfoArgs) (*types.ServerInfo, error) 13 | 14 | var _ _checkProvideServerInfo = ProvideServerInfo 15 | 16 | var ( 17 | Package__e86rl8 = &core.Package{ 18 | PackageName: "namespacelabs.dev/foundation/std/core/info", 19 | } 20 | ) 21 | -------------------------------------------------------------------------------- /std/go/http/csrf/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package csrf 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/go/core" 9 | ) 10 | 11 | var ( 12 | Package__hfr5jb = &core.Package{ 13 | PackageName: "namespacelabs.dev/foundation/std/go/http/csrf", 14 | } 15 | 16 | Initializers__hfr5jb = []*core.Initializer{ 17 | { 18 | Package: Package__hfr5jb, 19 | Do: func(ctx context.Context, di core.Dependencies) error { return Prepare(ctx) }, 20 | }, 21 | } 22 | ) 23 | -------------------------------------------------------------------------------- /internal/git/branch.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package git 6 | 7 | import ( 8 | "context" 9 | "strings" 10 | ) 11 | 12 | func CurrentBranch(ctx context.Context, path string) (string, error) { 13 | out, _, err := RunGit(ctx, path, "symbolic-ref", "--short", "HEAD") 14 | if err != nil { 15 | return "", err 16 | } 17 | 18 | branch := strings.TrimSuffix(string(out), "\n") 19 | return branch, nil 20 | } 21 | -------------------------------------------------------------------------------- /schema/filecontents.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema"; 10 | 11 | // TODO reconcile with std.types.Resource. 12 | message FileContents { 13 | string path = 1; 14 | bytes contents = 2; 15 | 16 | reserved 3; 17 | } 18 | 19 | message InlineJson { 20 | string inline_json = 1; 21 | } -------------------------------------------------------------------------------- /internal/cli/cmd/aws/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package aws 6 | 7 | import "github.com/spf13/cobra" 8 | 9 | func NewAwsCmd() *cobra.Command { 10 | cmd := &cobra.Command{ 11 | Use: "aws", 12 | Short: "AWS Federation related commands.", 13 | } 14 | 15 | cmd.AddCommand(newAssumeRoleCmd()) 16 | cmd.AddCommand(newEcrDockerLoginCmd()) 17 | cmd.AddCommand(newSetupWebIdentity()) 18 | 19 | return cmd 20 | } 21 | -------------------------------------------------------------------------------- /internal/sync/writer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package sync 6 | 7 | import ( 8 | "io" 9 | "sync" 10 | ) 11 | 12 | type syncWriter struct { 13 | mu sync.Mutex 14 | w io.Writer 15 | } 16 | 17 | func SyncWriter(w io.Writer) io.Writer { 18 | return &syncWriter{w: w} 19 | } 20 | 21 | func (s *syncWriter) Write(p []byte) (int, error) { 22 | s.mu.Lock() 23 | defer s.mu.Unlock() 24 | return s.w.Write(p) 25 | } 26 | -------------------------------------------------------------------------------- /library/kubernetes/manifest/resources.cue: -------------------------------------------------------------------------------- 1 | resourceClasses: { 2 | "AppliedManifest": { 3 | description: "Kubernetes Manifest" 4 | produces: { 5 | type: "library.kubernetes.manifest.AppliedManifestInstance" 6 | source: "./types.proto" 7 | } 8 | } 9 | } 10 | 11 | providers: { 12 | "namespacelabs.dev/foundation/library/kubernetes/manifest:AppliedManifest": { 13 | prepareWith: "namespacelabs.dev/foundation/library/kubernetes/manifest/prepare" 14 | 15 | intent: { 16 | type: "library.kubernetes.manifest.AppliedManifestIntent" 17 | source: "./types.proto" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /orchestration/server/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/orchestration/server", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /universe/aws/ecr/client.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package ecr 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/aws/aws-sdk-go-v2/service/ecr" 11 | ) 12 | 13 | func ProvideClient(ctx context.Context, _ *ClientArgs, deps ExtensionDeps) (*ecr.Client, error) { 14 | cfg, err := deps.ClientFactory.New(ctx) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | return ecr.NewFromConfig(cfg), nil 20 | } 21 | -------------------------------------------------------------------------------- /internal/cli/cmd/source/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package source 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | func NewSourceCmd() *cobra.Command { 12 | cmd := &cobra.Command{ 13 | Use: "source", 14 | Short: "Source-related commands.", 15 | Aliases: []string{"src"}, 16 | } 17 | 18 | cmd.AddCommand(newBufGenerateCmd()) 19 | cmd.AddCommand(newNewIdCmd()) 20 | 21 | return cmd 22 | } 23 | -------------------------------------------------------------------------------- /internal/testdata/datastore/exports.fn.cue: -------------------------------------------------------------------------------- 1 | // This file is automatically generated. 2 | package datastore 3 | 4 | import ( 5 | "namespacelabs.dev/foundation/std/fn:types" 6 | ) 7 | 8 | #Exports: { 9 | Database: { 10 | name?: string 11 | schemaFile?: types.#Resource 12 | 13 | #Definition: { 14 | packageName: "namespacelabs.dev/foundation/internal/testdata/datastore" 15 | type: "Database" 16 | typeDefinition: { 17 | "typename": "foundation.internal.testdata.datastore.Database" 18 | "source": [ 19 | "provider.proto", 20 | ] 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /std/monitoring/grafana/server/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#OpaqueServer & { 6 | id: "4dt58k5hmmwh5sq878msdwpn74" 7 | name: "Grafana" 8 | 9 | binary: { 10 | image: "grafana/grafana-enterprise:8.2.3@sha256:436c264303bb2cc03ba91912ee2711f1bf029f12ba5a7ec1db1a6e1f8774d9c8" 11 | } 12 | 13 | service: "web": { 14 | label: "Grafana" 15 | containerPort: 3000 16 | metadata: protocol: "http" 17 | } 18 | } 19 | 20 | configure: fn.#Configure & { 21 | with: binary: "namespacelabs.dev/foundation/std/monitoring/grafana/tool" 22 | } 23 | -------------------------------------------------------------------------------- /std/runtime/constants/volumes.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package constants 6 | 7 | const ( 8 | VolumeKindEphemeral = "namespace.so/volume/ephemeral" 9 | VolumeKindPersistent = "namespace.so/volume/persistent" 10 | VolumeKindConfigurable = "namespace.so/volume/configurable" 11 | VolumeKindWorkspaceSync = "namespace.so/volume/workspacesync" 12 | VolumeKindHostPath = "namespace.so/volume/hostpath" 13 | ) 14 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | push: 4 | tags: ["v*"] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | goreleaser: 9 | runs-on: namespace-profile-foundation-releaser 10 | permissions: 11 | contents: write 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Set up Go 15 | uses: actions/setup-go@v6 16 | with: 17 | go-version: 1.24.x 18 | - uses: goreleaser/goreleaser-action@v6 19 | with: 20 | args: release --clean 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /framework/kubernetes/kubedef/storage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.kubedef; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/kubernetes/kubedef"; 10 | 11 | import "framework/kubernetes/kubedef/systeminfo.proto"; 12 | 13 | message KubernetesEnvDiagnostics { 14 | SystemInfo system_info = 1; 15 | 16 | string serialized_event_list = 2; 17 | } -------------------------------------------------------------------------------- /internal/cli/cmd/tools/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tools 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | ) 10 | 11 | func NewToolsCmd() *cobra.Command { 12 | cmd := &cobra.Command{ 13 | Use: "tools", 14 | Short: "Tool-related commands.", 15 | Aliases: []string{"t", "tool"}, 16 | } 17 | 18 | cmd.AddCommand(newGRPCurlCmd()) 19 | cmd.AddCommand(NewKubeCtlCmd(false)) 20 | 21 | return cmd 22 | } 23 | -------------------------------------------------------------------------------- /std/go/grpc/interceptors/deps.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | 4 | package interceptors 5 | 6 | import ( 7 | "context" 8 | "namespacelabs.dev/foundation/std/go/core" 9 | ) 10 | 11 | type _checkProvideInterceptorRegistration func(context.Context, *InterceptorRegistration) (Registration, error) 12 | 13 | var _ _checkProvideInterceptorRegistration = ProvideInterceptorRegistration 14 | 15 | var ( 16 | Package__4svfm7 = &core.Package{ 17 | PackageName: "namespacelabs.dev/foundation/std/go/grpc/interceptors", 18 | } 19 | ) 20 | -------------------------------------------------------------------------------- /std/go/core/server.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package core 6 | 7 | import ( 8 | "go.uber.org/atomic" 9 | ) 10 | 11 | var ( 12 | running struct { 13 | is atomic.Bool 14 | } 15 | ) 16 | 17 | func AssertNotRunning(what string) { 18 | if running.is.Load() { 19 | Log.Fatalf("tried to call %s after the server has been initialized", what) 20 | } 21 | } 22 | 23 | func InitializationDone() { 24 | running.is.Store(true) 25 | } 26 | -------------------------------------------------------------------------------- /internal/cli/cmd/source/newid_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package source 6 | 7 | import ( 8 | "testing" 9 | 10 | "namespacelabs.dev/foundation/internal/parsing" 11 | "namespacelabs.dev/foundation/schema" 12 | ) 13 | 14 | func TestGeneratesValidServerId(t *testing.T) { 15 | s := schema.Server{ 16 | Id: newId(), 17 | } 18 | 19 | if err := parsing.ValidateServerID(&s); err != nil { 20 | t.Errorf("%v", err) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /internal/testdata/server/gogrpc/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/gogrpc", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /internal/testdata/service/simple/impl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package simple 6 | 7 | import ( 8 | "context" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | "namespacelabs.dev/foundation/internal/testdata/service/proto" 12 | ) 13 | 14 | type Service struct { 15 | } 16 | 17 | func WireService(ctx context.Context, srv server.Registrar, deps ServiceDeps) { 18 | proto.RegisterEmptyServiceServer(srv, &Service{}) 19 | } 20 | -------------------------------------------------------------------------------- /internal/production/runas.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package production 6 | 7 | import ( 8 | "fmt" 9 | 10 | "namespacelabs.dev/foundation/internal/runtime" 11 | ) 12 | 13 | func NonRootRunAsWithID(id int, fsGroup *int) *runtime.RunAs { 14 | runAs := &runtime.RunAs{ 15 | UserID: fmt.Sprintf("%d", id), 16 | } 17 | if fsGroup != nil { 18 | x := fmt.Sprintf("%d", *fsGroup) 19 | runAs.FSGroup = &x 20 | } 21 | return runAs 22 | } 23 | -------------------------------------------------------------------------------- /internal/testdata/server/modeling/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/modeling", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /internal/testdata/server/postgres/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/postgres", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /std/types/resource.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.types; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/types"; 10 | 11 | import "std/types/invocation.proto"; 12 | 13 | message Resource { 14 | string path = 1; 15 | bytes contents = 2; 16 | } 17 | 18 | message DeferredResource { 19 | reserved 1; 20 | DeferredInvocationSource from_invocation = 2; 21 | } 22 | -------------------------------------------------------------------------------- /universe/nscloud/configuration/config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.universe.nscloud.configuration; 8 | 9 | option go_package = "namespacelabs.dev/foundation/universe/nscloud/configuration"; 10 | 11 | // Used as a configuration provider in an environment. 12 | message Cluster { 13 | string cluster_id = 1; 14 | string api_endpoint = 3; 15 | bool use_build_cluster = 2; 16 | } -------------------------------------------------------------------------------- /internal/artifacts/oci/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.artifacts.oci; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/artifacts/oci"; 10 | 11 | message RawDescriptor { 12 | string repository = 1; 13 | string media_type = 2; 14 | bytes raw_manifest = 3; 15 | bytes raw_config = 4; // Only available when the descriptor points at an image. 16 | } 17 | -------------------------------------------------------------------------------- /internal/testdata/server/cockroach/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/cockroach", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /std/core/info/wire.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package info 6 | 7 | import ( 8 | "context" 9 | 10 | "namespacelabs.dev/foundation/std/core/types" 11 | "namespacelabs.dev/foundation/std/go/core" 12 | ) 13 | 14 | type ServerInfoArgs = types.ServerInfoArgs 15 | type ServerInfo = types.ServerInfo 16 | 17 | func ProvideServerInfo(ctx context.Context, args *ServerInfoArgs) (*ServerInfo, error) { 18 | return core.ProvideServerInfo(ctx, args) 19 | } 20 | -------------------------------------------------------------------------------- /internal/providers/nscloud/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.providers.nscloud; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/providers/nscloud"; 10 | 11 | message PrebuiltCluster { 12 | string cluster_id = 1; 13 | string api_endpoint = 4; 14 | bytes serialized_config = 2; // Deprecated, always fetched now. 15 | bool ephemeral = 3; 16 | } 17 | -------------------------------------------------------------------------------- /internal/testdata/datastore/db.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package datastore 6 | 7 | import ( 8 | "context" 9 | 10 | "namespacelabs.dev/foundation/std/go/core" 11 | ) 12 | 13 | type DB struct{} 14 | 15 | func ProvideDatabase(_ context.Context, _ *Database, deps ExtensionDeps) (*DB, error) { 16 | deps.ReadinessCheck.Register("foobar", core.CheckerFunc(func(ctx context.Context) error { 17 | return nil 18 | })) 19 | 20 | return &DB{}, nil 21 | } 22 | -------------------------------------------------------------------------------- /internal/testdata/server/localstacks3/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/localstacks3", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /std/tasks/idtypes/serialize.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package idtypes 6 | 7 | import ( 8 | "encoding/json" 9 | 10 | "google.golang.org/protobuf/encoding/protojson" 11 | "google.golang.org/protobuf/proto" 12 | ) 13 | 14 | func SerializeToBytes(msg interface{}) ([]byte, error) { 15 | if msg, ok := msg.(proto.Message); ok { 16 | return protojson.MarshalOptions{UseProtoNames: true}.Marshal(msg) 17 | } 18 | 19 | return json.Marshal(msg) 20 | } 21 | -------------------------------------------------------------------------------- /internal/localexec/interactive.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package localexec 6 | 7 | import ( 8 | "context" 9 | "os" 10 | "os/exec" 11 | 12 | "namespacelabs.dev/foundation/internal/console" 13 | ) 14 | 15 | func RunInteractive(ctx context.Context, cmd *exec.Cmd) error { 16 | done := console.EnterInputMode(ctx) 17 | defer done() 18 | 19 | cmd.Stdout = os.Stdout 20 | cmd.Stderr = os.Stderr 21 | cmd.Stdin = os.Stdin 22 | return cmd.Run() 23 | } 24 | -------------------------------------------------------------------------------- /internal/testing/testboot/testprotocol.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.testing.testboot; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testing/testboot"; 10 | 11 | import "schema/networking.proto"; 12 | 13 | message TestRequest { 14 | repeated .foundation.schema.Endpoint endpoint = 1; 15 | repeated .foundation.schema.InternalEndpoint internal_endpoint = 2; 16 | } -------------------------------------------------------------------------------- /std/grpc/deadlines/provider.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.grpc.deadlines; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/grpc/deadlines"; 10 | 11 | message Deadline { 12 | repeated Configuration configuration = 1; 13 | 14 | message Configuration { 15 | string service_name = 1; 16 | string method_name = 2; 17 | float maximum_deadline = 3; 18 | } 19 | } -------------------------------------------------------------------------------- /internal/codegen/protos/filedescset.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.workspace.source.protos; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/codegen/protos"; 10 | 11 | import "google/protobuf/descriptor.proto"; 12 | 13 | message FileDescriptorSetAndDeps { 14 | repeated google.protobuf.FileDescriptorProto file = 1; 15 | repeated google.protobuf.FileDescriptorProto dependency = 2; 16 | } -------------------------------------------------------------------------------- /internal/console/unwrap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package console 6 | 7 | import "namespacelabs.dev/foundation/std/tasks" 8 | 9 | func UnwrapSink(sink tasks.ActionSink) tasks.ActionSink { 10 | if sink != nil { 11 | switch x := sink.(type) { 12 | case hasUnwrap: 13 | return UnwrapSink(x.Unwrap()) 14 | default: 15 | return x 16 | } 17 | } 18 | 19 | return nil 20 | } 21 | 22 | type hasUnwrap interface { 23 | Unwrap() tasks.ActionSink 24 | } 25 | -------------------------------------------------------------------------------- /internal/networking/ingress/nginx/op.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.networking.ingress.nginx; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/networking/ingress/nginx"; 10 | 11 | message OpGenerateWebhookCert { 12 | string namespace = 1; 13 | string secret_name = 2; 14 | bytes webhook_definition = 3; 15 | string target_host = 4; 16 | } 17 | -------------------------------------------------------------------------------- /internal/planning/tool/handler.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tool 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/planning/invocation" 9 | "namespacelabs.dev/foundation/schema" 10 | ) 11 | 12 | type Source struct { 13 | PackageName schema.PackageName 14 | } 15 | 16 | type Definition struct { 17 | TargetServer schema.PackageName 18 | Source Source // Where the invocation was declared. 19 | Invocation *invocation.Invocation 20 | } 21 | -------------------------------------------------------------------------------- /internal/testdata/server/withconfiguration/main.fn.go: -------------------------------------------------------------------------------- 1 | // This file was automatically generated by Namespace. 2 | // DO NOT EDIT. To update, re-run `ns generate`. 3 | // This file was automatically generated. 4 | package main 5 | 6 | import ( 7 | "context" 8 | "flag" 9 | 10 | "namespacelabs.dev/foundation/std/go/server" 11 | ) 12 | 13 | func main() { 14 | flag.Parse() 15 | 16 | server.Run(context.Background(), server.RunOpts{ 17 | PackageName: "namespacelabs.dev/foundation/internal/testdata/server/withconfiguration", 18 | RegisterInitializers: RegisterInitializers, 19 | WireServices: WireServices, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /std/core/info/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "encoding/json" 3 | "namespacelabs.dev/foundation/std/fn" 4 | "namespacelabs.dev/foundation/std/fn:inputs" 5 | ) 6 | 7 | $coreTypesProto: inputs.#Proto & { 8 | source: "../types/coretypes.proto" 9 | } 10 | 11 | // We use a separate extension for ServerInfo as VCS causes servers to redeploy on edits 12 | extension: fn.#Extension & { 13 | provides: { 14 | ServerInfo: { 15 | input: $coreTypesProto.types.ServerInfoArgs 16 | availableIn: { 17 | go: { 18 | package: "namespacelabs.dev/foundation/std/core/types" 19 | type: "*ServerInfo" 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /std/go/http/csrf/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | extension: fn.#Extension & { 7 | hasInitializerIn: "GO" 8 | 9 | resources: { 10 | "token-secret-resource": { 11 | kind: "namespacelabs.dev/foundation/library/runtime:Secret" 12 | input: ":token-secret" 13 | } 14 | } 15 | } 16 | 17 | secrets: { 18 | "token-secret": { 19 | description: "A generated secret, for testing purposes." 20 | generate: { 21 | uniqueId: "http-csrf-token" 22 | randomByteCount: 32 23 | format: "FORMAT_BASE64" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /internal/filewatcher/filewatcher_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package filewatcher 6 | 7 | import "testing" 8 | 9 | func TestLongestCommonPathPrefix(t *testing.T) { 10 | list := []string{ 11 | "/path/to/server/file", 12 | "/path/to/service", 13 | "/path/to/shared/", 14 | } 15 | got := longestCommonPathPrefix(list) 16 | want := "/path/to" 17 | if got != want { 18 | t.Errorf("longestCommonPathPrefix%v: got %q, want %q", list, got, want) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /internal/parsing/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package parsing 6 | 7 | import ( 8 | "bytes" 9 | "encoding/json" 10 | ) 11 | 12 | // JSON decoder that maps numbers to json.Number. 13 | // This allows us to recover integer types with native error checking as JSON uses float64 for all numbers by default. 14 | func NewJsonNumberDecoder(s string) *json.Decoder { 15 | dec := json.NewDecoder(bytes.NewReader([]byte(s))) 16 | dec.UseNumber() 17 | return dec 18 | } 19 | -------------------------------------------------------------------------------- /universe/monitoring/honeycomb/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/monitoring/tracing" 5 | ) 6 | 7 | extension: fn.#Extension & { 8 | hasInitializerIn: "GO" 9 | initializeBefore: ["namespacelabs.dev/foundation/std/monitoring/tracing"] 10 | 11 | instantiate: { 12 | openTelemetry: tracing.#Exports.Exporter & { 13 | name: "honeycomb" 14 | } 15 | } 16 | } 17 | 18 | configure: fn.#Configure & { 19 | startup: { 20 | env: { 21 | "MONITORING_HONEYCOMB_X_HONEYCOMB_TEAM": fromSecret: ":xHoneycombTeam" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /framework/kubernetes/kubetool/hostenv.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.kubetool; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/kubernetes/kubetool"; 10 | 11 | message KubernetesEnv { 12 | string namespace = 1; 13 | } 14 | 15 | message KubernetesToolContext { 16 | string namespace = 1; 17 | bool can_set_namespace = 2; 18 | bool has_apply_role_binding = 3; 19 | } -------------------------------------------------------------------------------- /schema/probe.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema"; 10 | 11 | message Probe { 12 | string kind = 1; 13 | Http http = 2; 14 | Exec exec = 3; 15 | 16 | message Exec { 17 | repeated string command = 1; 18 | } 19 | 20 | message Http { 21 | string path = 1; 22 | int32 container_port = 2; 23 | } 24 | } -------------------------------------------------------------------------------- /std/tasks/flags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tasks 6 | 7 | import "github.com/spf13/pflag" 8 | 9 | func SetupFlags(flags *pflag.FlagSet) { 10 | flags.BoolVar(&LogActions, "log_actions", LogActions, "If set to true, each completed action is also output as a log message.") 11 | 12 | flags.Int32Var(&concurrentBuilds, "concurrent_build_limit", concurrentBuilds, "Limit how many builds may run in parallel.") 13 | _ = flags.MarkHidden("concurrent_build_limit") 14 | } 15 | -------------------------------------------------------------------------------- /framework/kubernetes/kubeclient/staticconfig.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.framework.kubernetes.kubeclient; 8 | 9 | option go_package = "namespacelabs.dev/foundation/framework/kubernetes/kubeclient"; 10 | 11 | message StaticConfig { 12 | string endpoint_address = 1; 13 | bytes certificate_authority_data = 2; 14 | bytes client_certificate_data = 3; 15 | bytes client_key_data = 4; 16 | } 17 | -------------------------------------------------------------------------------- /internal/build/buildkit/secrets.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buildkit 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/moby/buildkit/session/secrets" 11 | ) 12 | 13 | type secretSource struct { 14 | base secrets.SecretStore 15 | m map[string][]byte 16 | } 17 | 18 | func (fs secretSource) GetSecret(ctx context.Context, id string) ([]byte, error) { 19 | v, ok := fs.m[id] 20 | if ok { 21 | return v, nil 22 | } 23 | return fs.base.GetSecret(ctx, id) 24 | } 25 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/instances/resourceinstances.cue: -------------------------------------------------------------------------------- 1 | resources: { 2 | test1: { 3 | kind: "namespacelabs.dev/foundation/internal/testdata/integrations/resources/classes:Database" 4 | provider: "namespacelabs.dev/foundation/internal/testdata/integrations/resources/testgenprovider" 5 | 6 | input: { 7 | name: "helloworld" 8 | } 9 | } 10 | 11 | test2: { 12 | kind: "namespacelabs.dev/foundation/internal/testdata/integrations/resources/classes:Database2" 13 | provider: "namespacelabs.dev/foundation/internal/testdata/integrations/resources/providers" 14 | 15 | input: { 16 | name: "helloworld" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /schema/README.md: -------------------------------------------------------------------------------- 1 | This directory includes many of the data structures used by Namespace, some of 2 | which are part of the public API, and available to resource providers. 3 | 4 | Namespace relies on Protobuf as the data schema language to define our data 5 | types. However, even though we use protobuf serialization in many internal 6 | use-cases, all public APIs rely the JSON form of the same data types, which 7 | follows the formalized proto3 to json conversion schema. 8 | 9 | Unfortunately the separation between private and public API is not fully 10 | fleshed out, so you'll see both of them represented here. This will be updated 11 | over the next weeks. 12 | -------------------------------------------------------------------------------- /framework/kubernetes/kubenaming/naming.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package kubenaming 6 | 7 | import ( 8 | "crypto/sha256" 9 | "fmt" 10 | 11 | "namespacelabs.dev/go-ids" 12 | ) 13 | 14 | func StableID(str string) string { 15 | h := sha256.New() 16 | fmt.Fprint(h, str) 17 | return ids.EncodeToBase32String(h.Sum(nil)) 18 | } 19 | 20 | func StableIDN(str string, n int) string { 21 | if n < 0 || n > 50 { 22 | panic("invalid N") 23 | } 24 | return StableID(str)[:n] 25 | } 26 | -------------------------------------------------------------------------------- /internal/disk/disk_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package disk 6 | 7 | import "syscall" 8 | 9 | var knownFS = map[uint64]string{ 10 | 0xef53: "ext4", 11 | 0x2fc12fc1: "zfs", 12 | } 13 | 14 | func FSType(path string) (string, error) { 15 | s := syscall.Statfs_t{} 16 | err := syscall.Statfs(path, &s) 17 | if err != nil { 18 | return "", err 19 | } 20 | if known, ok := knownFS[uint64(s.Type)]; ok { 21 | return known, nil 22 | } 23 | return "unknown", nil 24 | } 25 | -------------------------------------------------------------------------------- /framework/testing/http.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package testing 6 | 7 | import ( 8 | "fmt" 9 | "log" 10 | "strings" 11 | 12 | "namespacelabs.dev/foundation/schema" 13 | ) 14 | 15 | func MakeHttpUrl(endpoint *schema.Endpoint, subPath string) string { 16 | if len(endpoint.Ports) == 0 { 17 | log.Fatal("endpoint has no ports") 18 | } 19 | 20 | return fmt.Sprintf("http://%s:%d/%s", endpoint.AllocatedName, endpoint.Ports[0].ExportedPort, strings.TrimPrefix(subPath, "/")) 21 | } 22 | -------------------------------------------------------------------------------- /internal/circleci/env.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package circleci 6 | 7 | import ( 8 | "os" 9 | 10 | "namespacelabs.dev/foundation/internal/fnerrors" 11 | ) 12 | 13 | func IsRunningInCircleci() bool { 14 | return os.Getenv("CIRCLECI") == "true" 15 | } 16 | 17 | func GetOidcTokenV2() (string, error) { 18 | if token, ok := os.LookupEnv("CIRCLE_OIDC_TOKEN_V2"); ok { 19 | return token, nil 20 | } 21 | 22 | return "", fnerrors.BadDataError("no CircleCI OIDC token found") 23 | } 24 | -------------------------------------------------------------------------------- /schema/tasks/errors.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema.tasks; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema/tasks"; 10 | 11 | import "google/rpc/status.proto"; 12 | 13 | // Attached to status protos when the action that produced the error is known. 14 | message ErrorDetail_ActionID { 15 | string action_id = 1; 16 | } 17 | 18 | message ErrorDetail_OriginalErrors { 19 | repeated google.rpc.Status status = 1; 20 | } -------------------------------------------------------------------------------- /internal/cli/cmd/eks/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package eks 6 | 7 | import "github.com/spf13/cobra" 8 | 9 | func NewEksCmd() *cobra.Command { 10 | cmd := &cobra.Command{ 11 | Use: "eks", 12 | Short: "EKS-related activities (internal only).", 13 | Hidden: true, 14 | } 15 | 16 | cmd.AddCommand(newComputeIrsaCmd()) 17 | cmd.AddCommand(newGenerateTokenCmd()) 18 | cmd.AddCommand(newGenerateConfigCmd()) 19 | cmd.AddCommand(newSetupAutopushCmd()) 20 | 21 | return cmd 22 | } 23 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/providers/resourceproviders.cue: -------------------------------------------------------------------------------- 1 | providers: { 2 | "namespacelabs.dev/foundation/internal/testdata/integrations/resources/classes:Database2": { 3 | prepareWith: { 4 | imageFrom: binary: "namespacelabs.dev/foundation/internal/testdata/integrations/resources/buildkitprovider" 5 | env: { 6 | TEST_SECRET: fromSecret: ":testsecret" 7 | } 8 | } 9 | 10 | intent: { 11 | type: "foundation.internal.testdata.integrations.resources.classes.DatabaseIntent" 12 | source: "../testgenprovider/proto1.proto" 13 | } 14 | } 15 | } 16 | 17 | secrets: { 18 | testsecret: { 19 | description: "A test secret." 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /framework/jsonreparser/reparser.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package jsonreparser 6 | 7 | import "encoding/json" 8 | 9 | // Reparse takes the unserialized form of an instance, and re-parses it into the target instance. 10 | func Reparse(obj interface{}, target interface{}) error { 11 | // XXX for now we do a marshal/unmarshal cycle; reconsider this in the future. 12 | b, err := json.Marshal(obj) 13 | if err != nil { 14 | return err 15 | } 16 | 17 | return json.Unmarshal(b, target) 18 | } 19 | -------------------------------------------------------------------------------- /schema/defextension.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema"; 10 | 11 | import "google/protobuf/any.proto"; 12 | 13 | message DefExtension { 14 | reserved 2; 15 | 16 | string description = 1; 17 | google.protobuf.Any impl = 3; 18 | } 19 | 20 | message SerializedMessage { 21 | repeated string name = 1; // Full proto name. 22 | bytes value = 2; 23 | } -------------------------------------------------------------------------------- /std/grpc/deadlines/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "encoding/json" 3 | "namespacelabs.dev/foundation/std/fn" 4 | "namespacelabs.dev/foundation/std/fn:inputs" 5 | "namespacelabs.dev/foundation/std/go/grpc/interceptors" 6 | ) 7 | 8 | $providerProto: inputs.#Proto & { 9 | source: "provider.proto" 10 | } 11 | 12 | extension: fn.#Extension & { 13 | hasInitializerIn: "GO" 14 | 15 | instantiate: { 16 | "interceptors": interceptors.#Exports.InterceptorRegistration 17 | } 18 | 19 | provides: { 20 | Deadlines: { 21 | input: $providerProto.types.Deadline 22 | availableIn: { 23 | go: { 24 | type: "*DeadlineRegistration" 25 | } 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /internal/codegen/protos/fnany/unmarshal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package fnany 6 | 7 | import ( 8 | "google.golang.org/protobuf/proto" 9 | "google.golang.org/protobuf/types/known/anypb" 10 | "namespacelabs.dev/foundation/schema" 11 | ) 12 | 13 | func CheckUnmarshal(any *anypb.Any, pkg schema.PackageName, msg proto.Message) (bool, error) { 14 | if any.GetTypeUrl() != TypeURL(pkg, msg) { 15 | return false, nil 16 | } 17 | 18 | err := proto.Unmarshal(any.Value, msg) 19 | return true, err 20 | } 21 | -------------------------------------------------------------------------------- /internal/codegen/genpackage/op.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.codegen.genpackage; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/codegen/genpackage"; 10 | 11 | import "schema/node.proto"; 12 | import "internal/codegen/protos/filedescset.proto"; 13 | 14 | message OpGenNode { 15 | foundation.schema.Node node = 1; 16 | foundation.workspace.source.protos.FileDescriptorSetAndDeps protos = 2; 17 | } -------------------------------------------------------------------------------- /std/go/grpc/metrics/wiremetrics.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package metrics 6 | 7 | import ( 8 | "context" 9 | 10 | grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" 11 | ) 12 | 13 | func Prepare(ctx context.Context, deps ExtensionDeps) error { 14 | deps.Interceptors.ForClient(grpc_prometheus.UnaryClientInterceptor, grpc_prometheus.StreamClientInterceptor) 15 | deps.Interceptors.ForServer(grpc_prometheus.UnaryServerInterceptor, grpc_prometheus.StreamServerInterceptor) 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /internal/providers/nscloud/api/buildplatform.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package api 6 | 7 | import ( 8 | "strings" 9 | 10 | "namespacelabs.dev/foundation/internal/fnerrors" 11 | ) 12 | 13 | type BuildPlatform string 14 | 15 | func ParseBuildPlatform(value string) (BuildPlatform, error) { 16 | switch strings.ToLower(value) { 17 | case "amd64": 18 | return "amd64", nil 19 | 20 | case "arm64": 21 | return "arm64", nil 22 | } 23 | 24 | return "", fnerrors.Newf("invalid build platform %q", value) 25 | } 26 | -------------------------------------------------------------------------------- /universe/monitoring/sentry/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/core/info" 4 | "namespacelabs.dev/foundation/std/go/grpc/interceptors" 5 | "namespacelabs.dev/foundation/std/go/http/middleware" 6 | ) 7 | 8 | // Using this extension requires the environment variable MONITORING_SENTRY_DSN 9 | // to be set; this is a work-around until secrets can be passed in. 10 | extension: fn.#Extension & { 11 | hasInitializerIn: "GO" 12 | 13 | instantiate: { 14 | serverInfo: info.#Exports.ServerInfo 15 | "interceptors": interceptors.#Exports.InterceptorRegistration 16 | "middleware": middleware.#Exports.Middleware 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /internal/console/tui/styles.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package tui 6 | 7 | import "github.com/charmbracelet/lipgloss" 8 | 9 | var ( 10 | listMainStyle = lipgloss.NewStyle().Margin(0, 2, 1) 11 | askMainStyle = lipgloss.NewStyle().Margin(0, 2, 1, 4) // A wider margin is used to align with lists. 12 | titleStyle = lipgloss.NewStyle().Bold(true) 13 | descStyle = lipgloss.NewStyle() 14 | tableMainStyle = lipgloss.NewStyle().BorderStyle(lipgloss.NormalBorder()).BorderForeground(lipgloss.Color("240")) 15 | ) 16 | -------------------------------------------------------------------------------- /internal/text/timefmt/timefmt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package timefmt 6 | 7 | import ( 8 | "fmt" 9 | "time" 10 | ) 11 | 12 | func Format(dur time.Duration) string { 13 | if micros := dur.Microseconds(); micros < 1000 { 14 | return fmt.Sprintf("%dus", micros) 15 | } 16 | 17 | if mil := dur.Milliseconds(); mil < 1000 { 18 | return fmt.Sprintf("%dms", mil) 19 | } 20 | 21 | return Seconds(dur) 22 | } 23 | 24 | func Seconds(dur time.Duration) string { 25 | return fmt.Sprintf("%.1fs", dur.Seconds()) 26 | } 27 | -------------------------------------------------------------------------------- /orchestration/server/constants/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package constants 6 | 7 | import "namespacelabs.dev/foundation/schema" 8 | 9 | const ( 10 | ServerId = "0fomj22adbua2u0ug3og" 11 | ServerPkg schema.PackageName = "namespacelabs.dev/foundation/orchestration/server" 12 | ToolPkg schema.PackageName = "namespacelabs.dev/foundation/orchestration/server/tool" 13 | ServerName = "orchestration-api-server" 14 | PortName = "server-port" 15 | ) 16 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/kubeops/kubeops.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package kubeops 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/networking/ingress" 9 | ) 10 | 11 | var OutputKubeApiURLs = false 12 | 13 | func Register() { 14 | registerApply() 15 | registerCreate() 16 | RegisterCreateSecret() 17 | registerDelete() 18 | registerDeleteList() 19 | registerCleanup() 20 | registerApplyRoleBinding() 21 | registerEnsureRuntimeConfig() 22 | registerEnsureDeployment() 23 | 24 | ingress.Register() 25 | } 26 | -------------------------------------------------------------------------------- /internal/wscontents/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.internal.wscontents; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/wscontents"; 10 | 11 | message FileEvent { 12 | EventType event = 1; 13 | string path = 2; 14 | bytes new_contents = 3; 15 | uint32 mode = 4; 16 | 17 | enum EventType { 18 | UNKNOWN = 0; 19 | WRITE = 1; 20 | REMOVE = 2; 21 | MKDIR = 3; 22 | } 23 | } -------------------------------------------------------------------------------- /std/grpc/requestid/requestid_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package requestid 6 | 7 | import ( 8 | "context" 9 | "testing" 10 | 11 | "google.golang.org/grpc/codes" 12 | "google.golang.org/grpc/status" 13 | ) 14 | 15 | func TestAttachRequestIDToError(t *testing.T) { 16 | withRid := AttachRequestIDToError(context.DeadlineExceeded, "some-rid") 17 | 18 | st, _ := status.FromError(withRid) 19 | if st.Code() != codes.DeadlineExceeded { 20 | t.Errorf("expected deadline exceeded, got code: %v", st.Code()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /internal/frontend/cuefrontend/integration/golang/golang.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package integrations 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/internal/frontend/cuefrontend/entity" 9 | "namespacelabs.dev/foundation/internal/frontend/cuefrontend/integration/helpers" 10 | "namespacelabs.dev/foundation/schema" 11 | ) 12 | 13 | func NewParser() entity.EntityParser { 14 | return &helpers.SimpleJsonParser[*schema.GoIntegration]{ 15 | SyntaxUrl: "namespace.so/from-go", 16 | SyntaxShortcut: "go", 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /npm-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@namespacelabs/cli", 3 | "version": "0.0.0-dev", 4 | "description": "Namespace CLI", 5 | "homepage": "https://namespace.so", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/namespacelabs/foundation.git" 9 | }, 10 | "license": "Apache-2.0", 11 | "scripts": { 12 | "nsc": "node bin/cli.js", 13 | "test": "jest --forceExit" 14 | }, 15 | "bin": { 16 | "nsc": "bin/cli.js" 17 | }, 18 | "files": [ 19 | "bin", 20 | "lib" 21 | ], 22 | "engines": { 23 | "node": ">=14" 24 | }, 25 | "dependencies": { 26 | "tar": "^7.4.3" 27 | }, 28 | "devDependencies": { 29 | "jest": "^29.7.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /schema/runtime/deployable.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.schema.runtime; 8 | 9 | option go_package = "namespacelabs.dev/foundation/schema/runtime"; 10 | 11 | import "schema/package.proto"; 12 | 13 | message Deployable { 14 | reserved 1; 15 | 16 | foundation.schema.PackageRef package_ref = 5; 17 | string id = 2; 18 | string name = 3; 19 | string deployable_class = 4; 20 | } 21 | -------------------------------------------------------------------------------- /universe/development/localstack/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | ) 4 | 5 | server: fn.#OpaqueServer & { 6 | id: "une8l4h8muitei49gcn0" 7 | name: "localstack" 8 | 9 | isStateful: true 10 | 11 | binary: image: "localstack/localstack@sha256:4ebb75b927bcfc9a79c77075734e51ce6031054b776eed2defcb3c0dfa4cf699" 12 | 13 | import: [ 14 | "namespacelabs.dev/foundation/universe/development/localstack/configure", 15 | ] 16 | 17 | // Export the service so it its endpoint is discoverable by clients. 18 | service: "api": { 19 | containerPort: 4566 20 | metadata: { 21 | // TODO this is required but does not seem to be used 22 | protocol: "dummy string" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-basic-with-support.txt: -------------------------------------------------------------------------------- 1 | Services deployed: 2 | 3 | Support services: 4 | 5 | [✓] Label http://web.example.com/path1 6 | [ ] Longer Label grpcurl hello world long command 7 | [ ] short.proto.name http://localhost # my/package/name 8 | [ ] l.p.name http://localhost 9 | 10 | Main services: 11 | 12 | [✓] Focused Label 13 | http://web.example.com/path1 14 | http://web.example.com/path2 15 | 16 | [ ] Focused Longer Label 17 | grpcurl hello world long command 18 | 19 | [ ] focused.short.proto.name 20 | http://localhost 21 | 22 | [ ] f.l.p.name 23 | http://localhost 24 | 25 | -------------------------------------------------------------------------------- /internal/process/exec_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | //go:build unix 6 | 7 | package process 8 | 9 | import ( 10 | "os/exec" 11 | "syscall" 12 | ) 13 | 14 | func SetSIDAttr(cmd *exec.Cmd, val bool) { 15 | if cmd.SysProcAttr == nil { 16 | cmd.SysProcAttr = &syscall.SysProcAttr{} 17 | } 18 | 19 | cmd.SysProcAttr.Setsid = val 20 | } 21 | 22 | func ForegroundAttr(cmd *exec.Cmd, val bool) { 23 | if cmd.SysProcAttr == nil { 24 | cmd.SysProcAttr = &syscall.SysProcAttr{} 25 | } 26 | 27 | cmd.SysProcAttr.Foreground = val 28 | } 29 | -------------------------------------------------------------------------------- /internal/runtime/kubernetes/helm/ops.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.runtime.kubernetes.helm; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/runtime/kubernetes/helm"; 10 | 11 | message OpHelmInstall { 12 | Blob chart_archive_blob = 1; 13 | string namespace = 2; 14 | string release_name = 3; 15 | JsonBlob values = 4; 16 | } 17 | 18 | message Blob { 19 | bytes inline = 1; 20 | } 21 | 22 | message JsonBlob { 23 | string inline = 1; 24 | } -------------------------------------------------------------------------------- /std/go/core/pprof.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package core 6 | 7 | import ( 8 | "net/http/pprof" 9 | 10 | "github.com/gorilla/mux" 11 | ) 12 | 13 | func registerPprofEndpoints(mux *mux.Router) string { 14 | mux.PathPrefix("/debug/pprof/").HandlerFunc(pprof.Index) 15 | mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) 16 | mux.HandleFunc("/debug/pprof/profile", pprof.Profile) 17 | mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) 18 | mux.HandleFunc("/debug/pprof/trace", pprof.Trace) 19 | 20 | return "/debug/pprof/" 21 | } 22 | -------------------------------------------------------------------------------- /std/grpc/connmap_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package grpc 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/google/go-cmp/cmp" 11 | ) 12 | 13 | func TestParseConnMap(t *testing.T) { 14 | got := parseConn("foo/bar:foo/quux/quux.Service=quuxserver;;;foo/bar:foo/bar/bar.Service=barserver;") 15 | 16 | if d := cmp.Diff(map[string]string{ 17 | "foo/bar:foo/bar/bar.Service": "barserver", 18 | "foo/bar:foo/quux/quux.Service": "quuxserver", 19 | }, got); d != "" { 20 | t.Errorf("mismatch (-want +got):\n%s", d) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /std/monitoring/prometheus/server/server.cue: -------------------------------------------------------------------------------- 1 | import "namespacelabs.dev/foundation/std/fn" 2 | 3 | server: fn.#OpaqueServer & { 4 | id: "04ntvj9zen9ns6ha76mvfb9z4a" 5 | name: "prometheus" 6 | 7 | binary: { 8 | image: "prom/prometheus:v2.37.5@sha256:8fa63fdd8d48e12bc8cd5e84b3e39e8ebf3cbd3580fb2c6449167917aaf0f04e" 9 | } 10 | 11 | service: "prometheus": { 12 | label: "Prometheus" 13 | containerPort: 9090 14 | metadata: { 15 | kind: "prometheus.io/endpoint" 16 | protocol: "http" 17 | } 18 | } 19 | } 20 | 21 | configure: fn.#Configure & { 22 | with: { 23 | binary: "namespacelabs.dev/foundation/std/monitoring/prometheus/tool" 24 | args: { 25 | mode: "server" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /internal/sdk/buf/image/versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "buf": { 3 | "go": "docker.io/library/golang:1.21.8", 4 | "prebuilt": "us-docker.pkg.dev/foundation-344819/prebuilts/namespacelabs.dev/foundation/internal/sdk/buf/image/prebuilt@sha256:5a9f9711fcd93aa2cdb5d2ee2aaa1b2fdd23b7e139ff4a39438153668b9b84ef" 5 | }, 6 | "goPackages": { 7 | "github.com/bufbuild/buf/cmd/buf": "8b26061eeebc26fa9b68583d1a4f14315cdfa69b", 8 | "google.golang.org/protobuf/cmd/protoc-gen-go": "b92717ecb630d4a4824b372bf98c729d87311a4d", 9 | "google.golang.org/grpc/cmd/protoc-gen-go-grpc": "b4c5e24c7373b22c6c38d68379c39ecdc616a968" 10 | }, 11 | "protoc": "3.15.7-r1", 12 | "yarn": "1.22.10-r0", 13 | "protobuf-ts": "554c392ae1bcd7cbb9b3bc40fb0621508751430d" 14 | } -------------------------------------------------------------------------------- /internal/testdata/service/fetch/service.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/grpc" 5 | "namespacelabs.dev/foundation/std/grpc/deadlines" 6 | ) 7 | 8 | $proto: inputs.#Proto & { 9 | source: "../proto/post.proto" 10 | } 11 | 12 | service: fn.#Service & { 13 | framework: "GO" 14 | 15 | instantiate: { 16 | dl: deadlines.#Exports.Deadlines & { 17 | configuration: [ 18 | {serviceName: "PostService", methodName: "Fetch", maximumDeadline: 0.5}, 19 | ] 20 | } 21 | } 22 | 23 | exportMethods: { 24 | service: $proto.services.PostService 25 | methods: ["Fetch"] 26 | } 27 | ingress: "INTERNET_FACING" 28 | } 29 | -------------------------------------------------------------------------------- /std/execution/values.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package execution 6 | 7 | import ( 8 | "google.golang.org/protobuf/proto" 9 | "namespacelabs.dev/foundation/schema" 10 | ) 11 | 12 | func ComputedValue[M proto.Message](inv *schema.SerializedInvocation, name string) (M, error) { 13 | var empty M 14 | 15 | for _, x := range inv.Computed { 16 | if x.Name == name { 17 | v, err := x.Value.UnmarshalNew() 18 | if err != nil { 19 | return empty, err 20 | } 21 | return v.(M), nil 22 | } 23 | } 24 | 25 | return empty, nil 26 | } 27 | -------------------------------------------------------------------------------- /library/database/redis/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package library.database.redis; 8 | 9 | option go_package = "namespacelabs.dev/foundation/library/database/redis"; 10 | 11 | message DatabaseInstance { 12 | int32 database = 1; 13 | string password = 3; 14 | string connection_uri = 4; 15 | string cluster_address = 5; 16 | 17 | reserved 2; 18 | } 19 | 20 | message ClusterInstance { 21 | // Format: host:port 22 | string address = 1; 23 | string password = 2; 24 | } 25 | -------------------------------------------------------------------------------- /internal/planning/deploy/view/.snapshots/view-assertNetworkPlan-basic-with-support-no-checkmark.txt: -------------------------------------------------------------------------------- 1 | Services deployed: 2 | 3 | Support services: 4 | 5 | [✓] Label http://web.example.com/path1 6 | [✓] Longer Label grpcurl hello world long command 7 | [✓] short.proto.name http://localhost # my/package/name 8 | [✓] l.p.name http://localhost 9 | 10 | Main services: 11 | 12 | [✓] Focused Label 13 | http://web.example.com/path1 14 | http://web.example.com/path2 15 | 16 | [✓] Focused Longer Label 17 | grpcurl hello world long command 18 | 19 | [✓] focused.short.proto.name 20 | http://localhost 21 | 22 | [✓] f.l.p.name 23 | http://localhost 24 | 25 | -------------------------------------------------------------------------------- /library/kubernetes/helm/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package library.kubernetes.helm; 8 | 9 | option go_package = "namespacelabs.dev/foundation/library/kubernetes/helm"; 10 | 11 | import "schema/filecontents.proto"; 12 | 13 | message HelmReleaseIntent { 14 | string release_name = 1; 15 | string namespace = 2; // Optional. 16 | foundation.schema.FileContents chart = 3; 17 | foundation.schema.InlineJson values = 4; 18 | } 19 | 20 | message HelmReleaseInstance { 21 | } -------------------------------------------------------------------------------- /std/grpc/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "path" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/go/grpc" 5 | "namespacelabs.dev/foundation/std/fn" 6 | "namespacelabs.dev/foundation/std/fn:inputs" 7 | ) 8 | 9 | $providerProto: inputs.#Proto & { 10 | source: "provider.proto" 11 | } 12 | 13 | extension: fn.#Extension & { 14 | provides: { 15 | Backend: { 16 | input: $providerProto.types.Backend 17 | availableIn: { 18 | go: {} // Computed at runtime. 19 | } 20 | } 21 | 22 | Conn: { 23 | input: $providerProto.types.Backend 24 | availableIn: { 25 | go: { 26 | package: "google.golang.org/grpc" 27 | type: "*ClientConn" 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /std/pkggraph/binary.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package pkggraph 6 | 7 | import ( 8 | "context" 9 | 10 | "namespacelabs.dev/foundation/schema" 11 | ) 12 | 13 | func LoadBinary(ctx context.Context, pl PackageLoader, ref *schema.PackageRef) (*Package, *schema.Binary, error) { 14 | binPkg, err := pl.LoadByName(ctx, ref.AsPackageName()) 15 | if err != nil { 16 | return nil, nil, err 17 | } 18 | 19 | binary, err := binPkg.LookupBinary(ref.Name) 20 | if err != nil { 21 | return nil, nil, err 22 | } 23 | 24 | return binPkg, binary, nil 25 | } 26 | -------------------------------------------------------------------------------- /cmd/nsc/gendoc/gen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | "os" 10 | 11 | "github.com/spf13/cobra" 12 | cobradoc "github.com/spf13/cobra/doc" 13 | nsccmd "namespacelabs.dev/foundation/cmd/nsc/cmd" 14 | ) 15 | 16 | func main() { 17 | if len(os.Args) != 2 { 18 | log.Fatal("Syntax: gendoc ") 19 | } 20 | outDir := os.Args[1] 21 | 22 | root := &cobra.Command{Use: "nsc"} 23 | nsccmd.RegisterCommands(root) 24 | if err := cobradoc.GenMarkdownTree(root, outDir); err != nil { 25 | log.Fatal(err) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /internal/sdk/buf/image.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buf 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/moby/buildkit/client/llb" 11 | specs "github.com/opencontainers/image-spec/specs-go/v1" 12 | "namespacelabs.dev/foundation/internal/build/binary" 13 | "namespacelabs.dev/foundation/internal/sdk/buf/image" 14 | ) 15 | 16 | func State(ctx context.Context, target specs.Platform) (llb.State, error) { 17 | if binary.UsePrebuilts { 18 | return image.Prebuilt(ctx, target) 19 | } 20 | 21 | return image.ImagePlanWithNodeJS(target), nil 22 | } 23 | -------------------------------------------------------------------------------- /internal/testdata/binaries/maketar/binary.cue: -------------------------------------------------------------------------------- 1 | binary: { 2 | name: "maketar" 3 | 4 | build_plan: [ 5 | { 6 | make_fs_image: { 7 | from: image_id: "busybox" 8 | target: "busybox.tgz" 9 | kind: "tgz" 10 | } 11 | }, 12 | { 13 | make_fs_image: { 14 | from: image_id: "busybox" 15 | target: "busybox.tar" 16 | kind: "tar" 17 | } 18 | }, 19 | { 20 | make_fs_image: { 21 | from: image_id: "busybox" 22 | target: "busybox.ext4" 23 | kind: "ext4" 24 | size: "1g" 25 | } 26 | }, 27 | { 28 | make_fs_image: { 29 | from: image_id: "busybox" 30 | target: "busybox.ext4" 31 | kind: "ext4" 32 | size: "1g" 33 | raw: true 34 | } 35 | }, 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /library/runtime/ingress.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | 9 | syntax = "proto3"; 10 | 11 | package foundation.library.runtime; 12 | 13 | option go_package = "namespacelabs.dev/foundation/library/runtime"; 14 | 15 | import "schema/networking.proto"; 16 | 17 | message IngressInstance { 18 | repeated foundation.schema.IngressFragment ingress_fragment = 1; 19 | } -------------------------------------------------------------------------------- /std/tasks/idtypes/known.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package idtypes 6 | 7 | const ( 8 | KnownStdout = "fn.console.stdout" 9 | KnownStderr = "fn.console.stderr" 10 | 11 | CatOutputTool CatOutputType = "fn.output.tool" 12 | CatOutputUs CatOutputType = "fn.output.foundation" 13 | CatOutputDebug CatOutputType = "fn.output.debug" 14 | CatOutputInfo CatOutputType = "fn.output.info" 15 | CatOutputWarnings CatOutputType = "fn.output.warnings" 16 | CatOutputErrors CatOutputType = "fn.output.errors" 17 | ) 18 | 19 | type CatOutputType string 20 | -------------------------------------------------------------------------------- /universe/monitoring/lightstep/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/monitoring/tracing" 5 | ) 6 | 7 | extension: fn.#Extension & { 8 | hasInitializerIn: "GO" 9 | initializeBefore: ["namespacelabs.dev/foundation/std/monitoring/tracing"] 10 | 11 | instantiate: { 12 | openTelemetry: tracing.#Exports.Exporter & { 13 | name: "lightstep" 14 | } 15 | } 16 | } 17 | 18 | configure: fn.#Configure & { 19 | startup: { 20 | env: { 21 | // TODO: support optional secrets 22 | if $env.name == "prod-metal" { 23 | "MONITORING_LIGHTSTEP_ACCESS_TOKEN": fromSecret: ":lightstepAccessToken" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /framework/sync/ctxmutex/ctxmutex.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package ctxmutex 6 | 7 | import "context" 8 | 9 | type Mutex struct { 10 | ch chan struct{} 11 | } 12 | 13 | func NewMutex() *Mutex { 14 | return &Mutex{make(chan struct{}, 1)} 15 | } 16 | 17 | func (mu *Mutex) Lock(ctx context.Context) bool { 18 | select { 19 | case <-ctx.Done(): 20 | return false 21 | case mu.ch <- struct{}{}: 22 | return true 23 | } 24 | } 25 | 26 | func (mu *Mutex) MustLock() { 27 | mu.ch <- struct{}{} 28 | } 29 | 30 | func (mu *Mutex) Unlock() { 31 | <-mu.ch 32 | } 33 | -------------------------------------------------------------------------------- /std/go/core/init_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package core 6 | 7 | import "testing" 8 | 9 | func TestEnforceBefore(t *testing.T) { 10 | initializers := []*Initializer{ 11 | {Package: pkg("a")}, 12 | {Package: pkg("b"), Before: []string{"a"}}, 13 | {Package: pkg("c"), After: []string{"e"}}, 14 | {Package: pkg("d"), Before: []string{"b"}}, 15 | {Package: pkg("e")}, 16 | } 17 | 18 | if _, err := enforceOrder(initializers); err != nil { 19 | t.Fatal(err) 20 | } 21 | } 22 | 23 | func pkg(name string) *Package { return &Package{PackageName: name} } 24 | -------------------------------------------------------------------------------- /internal/cli/cmd/cluster/baseimage/cmd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package baseimage 6 | 7 | import ( 8 | "github.com/spf13/cobra" 9 | "namespacelabs.dev/foundation/internal/cli/cmd/cluster/github" 10 | ) 11 | 12 | func NewBaseImageCmd() *cobra.Command { 13 | cmd := &cobra.Command{ 14 | Use: "base-image", 15 | Short: "Operations for managing your base images.", 16 | } 17 | 18 | cmd.AddCommand(newUploadBaseImageCmd()) 19 | cmd.AddCommand(newOptimizeCmd()) 20 | cmd.AddCommand(github.NewBaseImageBuildCmd("build-github-image")) 21 | 22 | return cmd 23 | } 24 | -------------------------------------------------------------------------------- /internal/testdata/counter/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/internal/testdata/counter/data" 5 | ) 6 | 7 | $providerProto: inputs.#Proto & { 8 | source: "provider.proto" 9 | } 10 | 11 | extension: fn.#Extension & { 12 | provides: { 13 | Counter: { 14 | input: $providerProto.types.Input 15 | 16 | availableIn: { 17 | go: { 18 | package: "namespacelabs.dev/foundation/internal/testdata/counter" 19 | type: "*Counter" 20 | } 21 | } 22 | 23 | // Artificial instantiate used for e2e testing of scoped instantiation. 24 | instantiate: { 25 | "data": data.#Exports.Data 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /internal/testdata/integrations/resources/testgenprovider/testgen/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package main 6 | 7 | import ( 8 | "namespacelabs.dev/foundation/framework/resources/provider" 9 | pb "namespacelabs.dev/foundation/internal/testdata/integrations/resources/classes/protos" 10 | "namespacelabs.dev/foundation/internal/testdata/integrations/resources/testgenprovider" 11 | ) 12 | 13 | func main() { 14 | _, p := provider.MustPrepare[*testgenprovider.DatabaseIntent]() 15 | 16 | p.EmitResult(&pb.DatabaseInstance{Url: "http://test-" + p.Intent.Name}) 17 | } 18 | -------------------------------------------------------------------------------- /internal/testdata/server/withconfiguration/server.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | ) 5 | 6 | server: fn.#Server & { 7 | id: "brc373trnbon6ecla45g" 8 | name: "withconfiguration" 9 | framework: "GO" 10 | 11 | listeners: { 12 | "mtls": { 13 | protocol: "grpc" 14 | port: { 15 | containerPort: 12345 16 | } 17 | } 18 | "second": { 19 | port: { 20 | containerPort: 12346 21 | } 22 | } 23 | } 24 | 25 | import: [ 26 | "namespacelabs.dev/foundation/internal/testdata/service/grpclistener", 27 | "namespacelabs.dev/foundation/internal/testdata/service/rawlistener", 28 | "namespacelabs.dev/foundation/std/grpc/logging", 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /library/oss/localstack/types.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package library.oss.localstack; 8 | 9 | option go_package = "namespacelabs.dev/foundation/library/oss/localstack"; 10 | 11 | import "schema/package.proto"; 12 | 13 | message BucketIntent { 14 | string bucket_name = 1; 15 | } 16 | 17 | message ClusterIntent {} 18 | 19 | message ClusterInstance { 20 | string endpoint = 1; 21 | string public_base_url = 2; // Optional. 22 | } 23 | 24 | message ServerIntent { 25 | foundation.schema.PackageRef server = 1; 26 | } 27 | -------------------------------------------------------------------------------- /universe/aws/client/extension.cue: -------------------------------------------------------------------------------- 1 | import ( 2 | "namespacelabs.dev/foundation/std/fn" 3 | "namespacelabs.dev/foundation/std/fn:inputs" 4 | "namespacelabs.dev/foundation/std/monitoring/tracing" 5 | ) 6 | 7 | $typesProto: inputs.#Proto & { 8 | source: "types.proto" 9 | } 10 | 11 | extension: fn.#Extension & { 12 | instantiate: { 13 | openTelemetry: tracing.#Exports.TracerProvider 14 | } 15 | 16 | provides: { 17 | ClientFactory: { 18 | input: $typesProto.types.ClientFactoryArgs 19 | availableIn: { 20 | go: { 21 | type: "ClientFactory" 22 | } 23 | } 24 | } 25 | } 26 | 27 | // Enable IAM Role / Service Account translation by default. 28 | import: [ 29 | "namespacelabs.dev/foundation/universe/aws/irsa", 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /internal/testdata/service/proto/list.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package internal.testdata.service.proto; 8 | 9 | option go_package = "namespacelabs.dev/foundation/internal/testdata/service/proto"; 10 | 11 | import "google/protobuf/empty.proto"; 12 | 13 | message AddRequest { 14 | string item = 1; 15 | } 16 | 17 | message ListResponse { 18 | repeated string item = 1; 19 | } 20 | 21 | service ListService { 22 | rpc Add(AddRequest) returns (google.protobuf.Empty); 23 | rpc List(google.protobuf.Empty) returns (ListResponse); 24 | } -------------------------------------------------------------------------------- /std/pkggraph/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package pkggraph 6 | 7 | import "namespacelabs.dev/foundation/std/cfg" 8 | 9 | type Context interface { 10 | cfg.Context 11 | PackageLoader 12 | } 13 | 14 | type SealedContext interface { 15 | cfg.Context 16 | SealedPackageLoader 17 | } 18 | 19 | type sealedCtx struct { 20 | cfg.Context 21 | SealedPackageLoader 22 | } 23 | 24 | var _ SealedContext = sealedCtx{} 25 | 26 | func MakeSealedContext(env cfg.Context, pr SealedPackageLoader) SealedContext { 27 | return sealedCtx{Context: env, SealedPackageLoader: pr} 28 | } 29 | -------------------------------------------------------------------------------- /internal/integrations/golang/gobuild.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package golang 6 | 7 | import ( 8 | "golang.org/x/mod/semver" 9 | ) 10 | 11 | func goBuildArgs(goVersion string, strip bool) map[string]string { 12 | m := map[string]string{ 13 | "-v": "", 14 | "-trimpath": "", 15 | } 16 | 17 | if strip { 18 | m["-ldflags"] = "-s -w" 19 | } 20 | 21 | // VCS information is not included in the binaries, to ensure we have reproducible builds. 22 | if semver.Compare("v"+goVersion, "v1.18") >= 0 { 23 | m["-buildvcs"] = "false" 24 | } 25 | 26 | return m 27 | } 28 | -------------------------------------------------------------------------------- /internal/build/buildkit/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | package buildkit 6 | 7 | import ( 8 | "runtime/debug" 9 | 10 | "namespacelabs.dev/foundation/internal/fnerrors" 11 | ) 12 | 13 | func Version() (string, error) { 14 | bi, ok := debug.ReadBuildInfo() 15 | if !ok { 16 | return "", fnerrors.InternalError("no builtin debug information?") 17 | } 18 | 19 | for _, d := range bi.Deps { 20 | if d.Path == "github.com/moby/buildkit" { 21 | return d.Version, nil 22 | } 23 | } 24 | 25 | return "", fnerrors.InternalError("buildkit: vendored version is empty") 26 | } 27 | -------------------------------------------------------------------------------- /std/types/certificates.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Namespace Labs Inc; All rights reserved. 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | 5 | syntax = "proto3"; 6 | 7 | package foundation.std.types; 8 | 9 | option go_package = "namespacelabs.dev/foundation/std/types"; 10 | 11 | import "schema/domain.proto"; 12 | 13 | message TLSCertificateSpec { 14 | repeated string organization = 1; 15 | string description = 2; 16 | string common_name = 3; 17 | repeated string dns_name = 4; 18 | } 19 | 20 | message CertificateChain { 21 | foundation.schema.Certificate CA = 1; 22 | foundation.schema.Certificate Server = 2; 23 | } 24 | --------------------------------------------------------------------------------