setup

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package setup checks and readies a researcher's laptop for Nautilus: kubectl, the kubelogin plugin, the NRP kubeconfig and sign-in. Checks are read-only. Fixes download the official release binaries into a user folder (no admin rights), verify their published SHA256, and never overwrite anything without a backup.

Index

Constants

View Source
const (
	OK      = "ok"
	Missing = "missing"
	Old     = "update"
	Problem = "problem"
	Manual  = "manual"
	Note    = "note" // advisory; does not block "ready"
)

Status of one check.

View Source
const (
	NRPServerHint = "nrp-nautilus.io"
	NRPConfigURL  = "https://nrp.ai/config"
	KubectlBase   = "https://dl.k8s.io/release"
	KubeloginBase = "https://github.com/int128/kubelogin/releases/download"
	KubeloginTag  = "v1.36.4"
)

Defaults for the NRP.

Variables

View Source
var KubeloginSHA256 = map[string]string{
	"darwin/amd64":  "7927b10c122b55dd4d9632f75d56752bfdc5f7b6ad3104615115c02f5f55e4f0",
	"darwin/arm64":  "5aa470d059a9672d732439474678ac05a0de5623ad3af54966b8fe1ac7df4254",
	"linux/amd64":   "9e8baeb4905d35a301304af2548324997add512fe94ab20e65993d167212bf85",
	"linux/arm64":   "669c2d3bcc6766351ad5a7b03971792b4e7a55117b335a12d9858d43a525d9dc",
	"linux/arm":     "ef21aa5d6697f830459fe1fbea3bfbca7aa3ae82f5b0e8751e788d2321d2e504",
	"linux/ppc64le": "def4768b5b0fb184a727b7c5f42e6cf235f564819fa3474f3f8e314fec0bc0e1",
	"windows/amd64": "a68be8ff153a7d3df1de19f272a9879164f55b8bb39298859d0e20c9e2c414ad",
	"windows/arm64": "6a8f92078f974e3229c26249ef26f2b761aa01c664e3e664c3496a1d96b8545e",
}

KubeloginSHA256 embeds the SHA-256 digests of the official int128/kubelogin release archives for KubeloginTag, verified at build time against the upstream release.

Functions

This section is empty.

Types

type Check

type Check struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Status string `json:"status"`
	Detail string `json:"detail"`
	Fix    string `json:"fix,omitempty"`
	Auto   bool   `json:"can_fix_automatically"`
}

Check is one line of the readiness report.

type Env

type Env struct {
	GOOS, GOARCH string
	Home         string
	Kubeconfig   string // empty: $KUBECONFIG or ~/.kube/config
	Context      string // kubeconfig context to check (default nautilus)
	BinDir       string // where fixes install binaries
	Kubectl      string // configured kubectl (name or path)
	PathEnv      string
	HTTP         func(ctx context.Context, url string) ([]byte, error)
	Run          func(ctx context.Context, name string, args ...string) ([]byte, error)
	LookPath     func(string) (string, error)
	Now          func() time.Time
	Downloads    []string // folders to look for a downloaded NRP config

	Redirect func(ctx context.Context, url string) (string, error) // nil: real HEAD request
	// contains filtered or unexported fields
}

Env holds everything Setup touches, so tests can fake it.

func DefaultEnv

func DefaultEnv(kubeconfig, kubectx, kubectl string) *Env

DefaultEnv builds an Env for this machine.

func (*Env) Fix

func (e *Env) Fix(ctx context.Context) (*Report, error)

Fix installs or updates what it can, then re-inspects. Order matters: the NRP config goes in first so the kubectl version can match the cluster; a second pass picks up anything the first one made fixable (for example a version mismatch that only shows once the config is in place).

func (*Env) Inspect

func (e *Env) Inspect(ctx context.Context, signIn bool) *Report

Inspect runs every check (read-only; the sign-in check may open a browser only if signIn is true).

type Report

type Report struct {
	Summary  string   `json:"summary"`
	Ready    bool     `json:"ready"`
	OS       string   `json:"os"`
	BinDir   string   `json:"bin_dir"`
	Checks   []Check  `json:"checks"`
	Actions  []string `json:"actions,omitempty"`
	Next     string   `json:"next"`
	PathHint string   `json:"path_hint,omitempty"`
}

Report is the result of Check or Fix.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL