Fork 0
Commit Graph

60 Commits (master)

Author SHA1 Message Date
q3k 97b5cd7b58 go: re-do the entire thing
This is a mega-change, but attempting to split this up further is
probably not worth the effort.


1. Bump up bazel, rules_go, and others.
2. Switch to new go target naming (bye bye go_default_library)
3. Move go deps to go.mod/go.sum, use make gazelle generate from that
4. Bump up Python deps a bit

And also whatever was required to actually get things to work - loads of
small useless changes.

Tested to work on NixOS and Ubuntu 20.04:

   $ bazel build //...
   $ bazel test //...

Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-09-22 21:50:19 +00:00
radex 291f554164 go/pki: show helpful hint to new contributors about -hspki_disable
Change-Id: I714f503f5962578055b99009aa0eccb72517d37b
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1562
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-09-22 20:45:15 +00:00
q3k 54183ba222 go/workspace: fix nix-instantiate exec error typecast
Also skip nix tests on systems without nix.

Change-Id: I4c0069a429df10a496b2651c2506b2d4625d5f43
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1585
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-09-01 17:22:41 +00:00
palid 7094d69a70 //go/workspace: fix go workspace on MacOS
Change-Id: I5d287d53b31c36ef19f2ea4ebc7a0647c87f2e29
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1532
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-07-24 14:01:46 +00:00
q3k a03b60b310 go/workspace: implement EvalHscloudNix
This allows us to access hscloud nix 'facts' from Go.

Change-Id: Ic8fc3350a7d073947c44529fcae0bbb8627421aa
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1508
Reviewed-by: q3k <q3k@hackerspace.pl>
2023-06-19 22:23:52 +00:00
q3k 0f8e5a2132 *: do not require env.sh
This removes the need to source env.{sh,fish} when working with hscloud.

This is done by:

 1. Implementing a Go library to reliably detect the location of the
    active hscloud checkout. That in turn is enabled by
    BUILD_WORKSPACE_DIRECTORY being now a thing in Bazel.
 2. Creating a tool `hscloud`, with a command `hscloud workspace` that
    returns the workspace path.
 3. Wrapping this tool to be accessible from Python and Bash.
 4. Bumping all users of hscloud_root to use either the Go library or
    one of the two implemented wrappers.

We also drive-by replace tools/install.sh to be a proper sh_binary, and
make it yell at people if it isn't being ran as `bazel run

Finally, we also drive-by delete cluster/tools/nixops.sh which was never used.

Change-Id: I7873714319bfc38bbb930b05baa605c5aa36470a
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1169
Reviewed-by: informatic <informatic@hackerspace.pl>
2021-10-17 21:21:58 +00:00
q3k 13c90f0fe6 go/mirko: add GetRemoteHTTPClient
Change-Id: Icf1ec5c28ea487e62a23590069042c5b9edad846
2021-05-23 13:03:19 +02:00
q3k ba28a04c65 go/mirko: move kubernetes clientset state to singleton
We want to access the clientset (or at least check the fact that we're
in a cluster) outside of the Mirko object lifecycle.

In reality, this should _probably_ be moved outside of the Mirko library
and get a better API than this (ie. one that returns complete
information about the state of being in production/dev/...).

Change-Id: I86444477e0306a39a1611207855127a7b963603e
2021-05-22 19:16:39 +00:00
q3k bade46d45f go/pki: fix error return
DeveloperCredentialsLocation used to glog.Exitf instead of returning an
error, and a consumer (prodaccess) used to not check the return code.
Bad refactor?

Change-Id: I6c2d05966ba6b3eb300c24a51584ccf5e324cd49
2021-05-19 22:12:08 +00:00
q3k 376f58720e go/statusz: do not crash on failure to resolve uid
This can happen if a binary is built statically and fails to load
libgcc/nsd libraries at runtime.

Change-Id: Ia76645471b83a6cc75fe6552e70e6a251b50129c
2020-10-30 14:05:07 +01:00
q3k 8887655aa8 go/mirko: fix trace logging
Change-Id: I95b8ce32ad529ffe0b43282f5761495df78b2b10
2020-08-16 13:25:40 +00:00
q3k ef2fbaf892 go/pki: allow overriding host in client
Change-Id: I5d913d6056efc5128c26ffe4db962fdb86b08315
2020-08-01 22:01:33 +02:00
q3k f3312ef77e *: developer machine HSPKI credentials
In addition to k8s certificates, prodaccess now issues HSPKI
certificates, with DN=$username.sso.hswaw.net. These are installed into
XDG_CONFIG_HOME (or os equiv).

//go/pki will now automatically attempt to load these certificates. This
means you can now run any pki-dependant tool with -hspki_disable, and
with automatic mTLS!

Change-Id: I5b28e193e7c968d621bab0d42aabd6f0510fed6d
2020-08-01 17:15:52 +02:00
q3k 006c1bf8f3 *: add more OWNERS
Change-Id: If2740a0aaee845160b38b8ea0b23fea7bab3bded
2020-04-13 01:46:15 +02:00
q3k 400ac7a88d go/{mirko,statusz}: enable profiling
Change-Id: I5f1a51f349196f2a187e484f44fdbff5d0acde3f
2020-01-23 14:17:30 +01:00
q3k 6f773e0004 smsgw: productionize, implement kube/mirko
This productionizes smsgw.

We also add some jsonnet machinery to provide a unified service for Go

This machinery provides all the nice stuff:
 - a deployment
 - a service for all your types of pots
 - TLS certificates for HSPKI

We also update and test hspki for a new name scheme.

Change-Id: I292d00f858144903cbc8fe0c1c26eb1180d636bc
2019-10-04 13:52:34 +02:00
q3k 1fad2e5c6e bgpwtf/cccampix: draw the rest of the fucking owl
Change-Id: I49fd5906e69512e8f2d414f406edc0179522f225
2019-08-11 23:43:25 +02:00
q3k 30317b4278 go/mirko: add SQL migrations machinery
This uses github.com/golang-migrate/migrate and adds a Source that
allows using go_embed data files.

We also provide a test/example.

Change-Id: Icd2b6c7f7d0f728073b3fdf39b432b33ce61a3cd
2019-08-03 23:49:43 +02:00
q3k 8fe651b569 go/{mirko,statusz}: better status, kubernetes client
Change-Id: I66753a79eaf36529aee508d2b7782aab00de1498
2019-07-21 23:54:41 +02:00
q3k c7a4755158 go: remove Gopkg leftovers
These are from pre-bazelification.

Change-Id: I6ba9aae53a3785fd612322d6f2cfb4bef7f9c832
2019-07-21 16:28:10 +02:00
q3k 2da126caff go/svc/leasifier, proto/hswaw -> hswaw/
Continued from https://gerrit.hackerspace.pl/c/hscloud/+/73 .

Change-Id: Ie761c2af588e06739de94fa1eff4f715d1f9b145
2019-07-21 15:36:27 +02:00
q3k cea71e3be8 go/svc/{invoice,speedtest} -> bgpwtf/
Continued from https://gerrit.hackerspace.pl/c/hscloud/+/71 .

Change-Id: I5aef587c7e9a4cec301e3c95530c33914851ad44
2019-07-21 15:30:08 +02:00
q3k 61594bb088 go/svc/(dc stuff) -> dc/
We want to start keeping codebases separated per 'team'/intent, to then
have simple OWNER files/trees to specify review rules.

This means dc/ stuff can all be OWNED by q3k, and review will only
involve a +1 for style/readability, instead  of a +2 for approval.

Change-Id: I05afbc4e1018944b841ec0d88cd24cc95bec8bf1
2019-07-21 15:20:51 +02:00
q3k 838cf6526a go/svc: finish porting services to Bazel
The following services were never ported:
 - cmc-proxy
 - arista-proxy
 - m6220-proxy
 - topo

They now build.

Change-Id: I0688bfe43cdff946e6662e21969ef539382c0e86
2019-07-16 23:31:25 +02:00
q3k 3e21233b14 go/svc/speedtest: prod deploy
This is deployed on https://speedtest.hackerspace.pl/

Change-Id: I510d98535ae64d13e745613c49acf96b4d7e90c9
2019-07-13 18:11:11 +02:00
q3k f448f99385 go/svc/speedtest: bazelify
Change-Id: If83422929432a316c11e25c7dda68d8172f25167
2019-07-13 16:28:14 +02:00
q3k a51df9c2ab go/svc/speedtest: init from github.com/q3k/speedtest
commit: 6109ea9470199468120836d1fb1c89cac7667d86
Change-Id: If93617b3b8f0ac5bc548ab81a6801e464a03143d
2019-07-13 16:17:05 +02:00
q3k bc27e64692 go/svc/invoice: template changes for EU VAT invoices, restore FV/ numbering 2019-06-20 16:11:07 +02:00
q3k a818ef2c16 go/svc/invoice: add shitty multilanguage support 2019-06-07 10:37:22 +02:00
q3k a103f060a8 go/svc/invoice: tiny template fixes 2019-05-18 16:23:58 +02:00
q3k ac140b3427 go/svc/invoice: statusz cleanups
- Remove internal ID
 - Sort by time
2019-05-01 17:11:47 +02:00
q3k 3976e3cee8 go/svc/invoice: refactor
We unify calculation logic, move the existing Invoice proto message into
InvoiceData, and create other messages/fields around it to hold
denormalized data.
2019-05-01 15:27:49 +02:00
q3k 57ef6b0d7f go/svc/invoice: add statusz 2019-05-01 14:08:29 +02:00
q3k c2d322c504 go/svc/invoice: polishify 2019-05-01 13:14:32 +02:00
q3k fb18c99df3 go/svc/invoice: import from code.hackerspace.pl/q3k/inboice 2019-05-01 12:27:43 +02:00
q3k 208f005830 go/svc/leasifier: sort returned leases 2019-04-06 01:28:04 +02:00
q3k a9a266c08c go/svc/leasifier: fixes, add statusz table 2019-04-06 01:21:25 +02:00
q3k 1affad42e7 go/statusz: factor out load avg to separate file 2019-04-06 01:21:04 +02:00
q3k 9dc4b68f24 go: add bazel buildfiles, implement leasifier 2019-04-05 23:53:25 +02:00
q3k efc7928a73 go/vendor: nuke 2019-04-05 23:50:28 +02:00
informatic 11603cb9fd cmc-proxy: logout properly to prevent session exhaustion
Multiple calls to GetKVMData in a short timespan would make iDRAC refuse
all authentications because of dangling sessions... (and 5 concurrent
sessions limit)
2019-02-10 15:34:01 +01:00
q3k c6fd662d4b begin docker-composing 2018-11-01 22:39:01 +01:00
q3k 8fab2beab9 statusz: fix executable sha256 2018-10-25 23:37:37 +02:00
q3k f311e26c93 statusz: make our own copy 2018-10-25 23:26:57 +02:00
q3k 477ffe775b topo: fix proto path 2018-10-25 05:36:18 -07:00
q3k b224002a0f do not ship generated proto stubs 2018-10-25 14:22:28 +02:00
q3k 31dd616632 vendorify compiletime deps 2018-10-25 14:20:50 +02:00
q3k cc25bdf82c vendorify 2018-10-25 14:02:58 +02:00
Serge Bazanski 26f1ee8fe7 move topo control proto into new proto infra libarary 2018-10-25 12:45:00 +01:00
Serge Bazanski ab55ccac0d topo: builds 2018-10-25 12:35:55 +01:00