omni/cmd/make-cookies/main.go
Artem Chernyshev c9c4c8e10d
Some checks failed
default / default (push) Has been cancelled
default / e2e-backups (push) Has been cancelled
default / e2e-forced-removal (push) Has been cancelled
default / e2e-scaling (push) Has been cancelled
default / e2e-short (push) Has been cancelled
default / e2e-short-secureboot (push) Has been cancelled
default / e2e-templates (push) Has been cancelled
default / e2e-upgrades (push) Has been cancelled
default / e2e-workload-proxy (push) Has been cancelled
test: use go test to build and run Omni integration tests
All test modules were moved under `integration` tag and are now in
`internal/integration` folder: no more `cmd/integration-test`
executable.

New Kres version is able to build the same executable from the tests
directory instead.

All Omni related flags were renamed, for example `--endpoint` ->
`--omni.endpoint`.

2 more functional changes:

- Enabled `--test.failfast` for all test runs.
- Removed finalizers, which were running if the test has failed.

Both of these changes should make it easier to understand the test
failure: Talos node logs won't be cluttered with the finalizer tearing
down the cluster.

Fixes: https://github.com/siderolabs/omni/issues/1171

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
2025-06-03 15:07:00 +03:00

61 lines
1.4 KiB
Go

// Copyright (c) 2025 Sidero Labs, Inc.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
// Package main provides the entrypoint for the make-cookies binary.
package main
import (
"context"
"fmt"
"net/http"
"os"
"github.com/siderolabs/omni/internal/backend/workloadproxy"
"github.com/siderolabs/omni/internal/pkg/clientconfig"
)
func main() {
if err := app(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func app() error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// don't forget to build this with the -tags=sidero.debug
if len(os.Args) != 2 {
return fmt.Errorf("usage: %s <endpoint>", os.Args[0])
}
cfg := clientconfig.New(os.Args[1])
defer cfg.Close() //nolint:errcheck
client, err := cfg.GetClient(ctx)
if err != nil {
return fmt.Errorf("error getting client: %w", err)
}
defer client.Close() //nolint:errcheck
keyID, keyIDSignatureBase64, err := clientconfig.RegisterKeyGetIDSignatureBase64(ctx, client)
if err != nil {
return fmt.Errorf("error registering key: %w", err)
}
cookies := []*http.Cookie{
{Name: workloadproxy.PublicKeyIDCookie, Value: keyID},
{Name: workloadproxy.PublicKeyIDSignatureBase64Cookie, Value: keyIDSignatureBase64},
}
for _, cookie := range cookies {
fmt.Printf("%s\n\n\n", cookie.String())
}
return nil
}