sdscompare

package
v0.0.0-...-af55a85 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPrintConfigTypeInSummary

func SetPrintConfigTypeInSummary(p bool)

Types

type Format

type Format int
const (
	JSON Format = iota
	TABULAR
)

type SDSWriter

type SDSWriter interface {
	PrintSecretItems([]SecretItem) error
	PrintDiffs([]SecretItemDiff) error
}

SDSWriter takes lists of SecretItem or SecretItemDiff and prints them through supplied output writer

func NewSDSWriter

func NewSDSWriter(w io.Writer, format Format) SDSWriter

NewSDSWriter generates a new instance which conforms to SDSWriter interface

type SecretItem

type SecretItem struct {
	Name        string `json:"resource_name"`
	Data        string `json:"cert"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	State       string `json:"state"`
	TrustDomain string `json:"trust_domain"`
	SecretMeta
}

SecretItem is an intermediate representation of secrets, used to provide a common format between the envoy proxy secrets and node agent output which can be diffed

func GetEnvoySecrets

func GetEnvoySecrets(
	wrapper *configdump.Wrapper,
) ([]SecretItem, error)

GetEnvoySecrets parses the secrets section of the config dump into []SecretItem

type SecretItemBuilder

type SecretItemBuilder interface {
	Name(string) SecretItemBuilder
	Data(string) SecretItemBuilder
	Source(string) SecretItemBuilder
	Destination(string) SecretItemBuilder
	State(string) SecretItemBuilder
	TrustDomain(string) SecretItemBuilder
	Build() (SecretItem, error)
}

SecretItemBuilder wraps the process of setting fields for the SecretItem and builds the Metadata fields from the cert contents behind the scenes

func NewSecretItemBuilder

func NewSecretItemBuilder() SecretItemBuilder

NewSecretItemBuilder returns a new builder to create a secret item

type SecretItemDiff

type SecretItemDiff struct {
	Agent string `json:"agent"`
	Proxy string `json:"proxy"`
	SecretItem
}

SecretItemDiff represents a secret that has been diffed between nodeagent and proxy

type SecretMeta

type SecretMeta struct {
	Valid        bool   `json:"cert_valid"`
	SerialNumber string `json:"serial_number"`
	NotAfter     string `json:"not_after"`
	NotBefore    string `json:"not_before"`
	Type         string `json:"type"`
	TrustDomain  string `json:"trust_domain"`
}

SecretMeta holds selected fields which can be extracted from parsed x509 cert

Jump to

Keyboard shortcuts

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