k8sconv

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package k8sconv contains helpers related to converting data to Kubernetes resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OPAConfToK8sOPAConfigMap added in v0.36.0

func OPAConfToK8sOPAConfigMap(
	opaconf styra.OPAConfig,
	slpURL string,
	opaDefaultConfig configv2alpha2.OPAConfig,
	customConfig map[string]interface{},
) (corev1.ConfigMap, error)

OPAConfToK8sOPAConfigMap creates a corev1.ConfigMap for the OPA based on the configuration from Styra. The configmap configures the OPA to communicate to an SLP.

func OPAConfToK8sOPAConfigMapNoSLP added in v0.36.0

func OPAConfToK8sOPAConfigMapNoSLP(
	opaconf styra.OPAConfig,
	opaDefaultConfig configv2alpha2.OPAConfig,
	customConfig map[string]interface{},
) (corev1.ConfigMap, error)

OPAConfToK8sOPAConfigMapNoSLP creates a ConfigMap for the OPA based on the configuration from Styra. The ConfigMap configures the OPA to communicate directly to Styra and not via an SLP.

func OPAConfToK8sOPAConfigMapforOCP added in v0.36.0

func OPAConfToK8sOPAConfigMapforOCP(
	opaconf ocp.OPAConfig,
	opaDefaultConfig configv2alpha2.OPAConfig,
	customConfig map[string]interface{},
	_ logr.Logger,
) (corev1.ConfigMap, error)

OPAConfToK8sOPAConfigMapforOCP creates a ConfigMap for the OPA. It configures OPA to fetch bundle from MinIO. OPAConfToK8sOPAConfigMapforOCP merges the information given as input into a ConfigMap for OPA

func OPAConfToK8sSLPConfigMap added in v0.36.0

func OPAConfToK8sSLPConfigMap(opaconf styra.OPAConfig) (corev1.ConfigMap, error)

OPAConfToK8sSLPConfigMap creates a ConfigMap for the SLP based on the configuration from Styra.

Types

type DecisionLogReporting added in v0.36.0

type DecisionLogReporting struct {
	MaxDelaySeconds      int `json:"max_delay_seconds,omitempty" yaml:"max_delay_seconds,omitempty"`
	MinDelaySeconds      int `json:"min_delay_seconds,omitempty" yaml:"min_delay_seconds,omitempty"`
	UploadSizeLimitBytes int `json:"upload_size_limit_bytes,omitempty" yaml:"upload_size_limit_bytes,omitempty"`
}

DecisionLogReporting contains configuration for decision log reporting

type DecisionLogs added in v0.36.0

type DecisionLogs struct {
	RequestContext requestContext        `json:"request_context,omitempty" yaml:"request_context,omitempty"`
	ServiceName    string                `json:"service,omitempty" yaml:"service,omitempty"`
	ResourcePath   string                `json:"resource_path,omitempty" yaml:"resource_path,omitempty"`
	Reporting      *DecisionLogReporting `json:"reporting,omitempty" yaml:"reporting,omitempty"`
}

DecisionLogs contains configuration for decision logs

type HTTPMetricsConfig added in v0.36.0

type HTTPMetricsConfig struct {
	Buckets []float64 `yaml:"buckets,omitempty"`
}

HTTPMetricsConfig represents the HTTP metrics configuration for OPA

type Metricsconfig added in v0.36.0

type Metricsconfig struct {
	Prometheus PrometheusMetricsConfig `yaml:"prom,omitempty"`
}

Metricsconfig represents the metrics configuration for OPA

type OPAConfigMap added in v0.36.0

type OPAConfigMap struct {
	Services     []service    `yaml:"services"`
	Labels       labels       `yaml:"labels"`
	Discovery    discovery    `yaml:"discovery"`
	DecisionLogs DecisionLogs `yaml:"decision_logs,omitempty"`
}

OPAConfigMap represents the structure of the OPA configuration file

type OcpOPAConfigMap added in v0.36.0

type OcpOPAConfigMap struct {
	Services             []*ocp.OPAServiceConfig `yaml:"services"`
	Bundles              bundle                  `yaml:"bundles,omitempty"`
	DecisionLogs         DecisionLogs            `yaml:"decision_logs,omitempty"`
	PersistenceDirectory string                  `yaml:"persistence_directory,omitempty"`
	Labels               labelsOCP               `yaml:"labels,omitempty"`
	Server               Serverconfig            `yaml:"server,omitempty"`
	Status               StatusConfig            `yaml:"status,omitempty"`
}

OcpOPAConfigMap represents the structure of the OPA configuration file for OCP

type PrometheusMetricsConfig added in v0.36.0

type PrometheusMetricsConfig struct {
	HTTP HTTPMetricsConfig `yaml:"http_request_duration_seconds,omitempty"`
}

PrometheusMetricsConfig represents the Prometheus metrics configuration for OPA

type Serverconfig added in v0.36.0

type Serverconfig struct {
	Metrics Metricsconfig `yaml:"metrics,omitempty"`
}

Serverconfig represents the server configuration for OPA

type StatusConfig added in v0.36.0

type StatusConfig struct {
	Prometheus bool `yaml:"prometheus,omitempty"`
}

StatusConfig represents the status configuration for OPA

Jump to

Keyboard shortcuts

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