server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureClientCertAndKey

func EnsureClientCertAndKey(certDir string) error

EnsureClientCertAndKey ensures that the iknite client certificate and key exist in certDir. If they don't exist, they are created signed by the Kubernetes CA.

func EnsureIkniteConf

func EnsureIkniteConf(certDir, confPath string, spec *v1alpha1.IkniteClusterSpec) error

EnsureIkniteConf generates a kubeconfig-style client configuration file at confPath with the CA cert and client cert/key embedded. The server URL is derived from spec.Ip (or localhost as fallback) and spec.StatusServerPort. This file is analogous to /etc/kubernetes/admin.conf but targets the iknite status server. It is (re-)created on every start so that the IP address is always up to date.

func EnsureIkniteServerConfiguration

func EnsureIkniteServerConfiguration(
	certDir string,
	spec *v1alpha1.IkniteClusterSpec,
) error

EnsureIkniteServerConfiguration ensures that the necessary certificates and client configuration file for the iknite server exist in certDir. It uses the cluster spec to determine the SANs for the server certificate and the server URL for the client configuration.

func EnsureServerCertAndKey

func EnsureServerCertAndKey(certDir string, dnsNames []string, ips []net.IP) error

EnsureServerCertAndKey ensures that the iknite server certificate and key exist in certDir. If they don't exist, they are created signed by the Kubernetes CA. DnsNames and ips extend the built-in SANs (iknite, localhost, 127.0.0.1) with values from the cluster configuration.

func ShutdownServer

func ShutdownServer(srv *IkniteServer) error

ShutdownServer is a convenience wrapper around (*IkniteServer).Shutdown.

Types

type IkniteServer

type IkniteServer struct {
	// contains filtered or unexported fields
}

IkniteServer encapsulates the HTTPS status server together with the configuration and an in-memory snapshot of the cluster status. Access to the cluster snapshot is protected by a read/write mutex so that concurrent HTTP requests and background status updates do not race.

func NewIkniteServer

func NewIkniteServer(certDir string, spec *v1alpha1.IkniteClusterSpec) (*IkniteServer, error)

NewIkniteServer builds an IkniteServer from spec and the certificates in certDir. The port is taken from spec.StatusServerPort.

func StartIkniteServer

func StartIkniteServer(
	certDir string,
	cluster *v1alpha1.IkniteCluster,
) (*IkniteServer, error)

StartIkniteServer creates certificates (if needed), builds, and starts the iknite HTTPS server. The initial cluster status is set from cluster. The returned IkniteServer's SetCluster method should be called on every subsequent cluster status update.

func (*IkniteServer) ServeHTTP

func (s *IkniteServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler so that IkniteServer can be used directly as a handler for a custom http.Server (useful in tests or when embedding the mux into a larger application).

func (*IkniteServer) SetCluster

func (s *IkniteServer) SetCluster(c *v1alpha1.IkniteCluster)

SetCluster serializes c to JSON and stores it under the write lock so that subsequent /status requests serve the latest in-memory state.

func (*IkniteServer) Shutdown

func (s *IkniteServer) Shutdown() error

Shutdown gracefully shuts down the server with a 10-second timeout.

Jump to

Keyboard shortcuts

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