Documentation
¶
Overview ¶
Package mesh provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.
Package mesh provides the types and functions for interacting with the NGINX Service Mesh API and configuration.
Index ¶
- Constants
- Variables
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewGetConfigRequest(server string) (*http.Request, error)
- func NewGetServicesRequest(server string) (*http.Request, error)
- func NewInjectSidecarProxyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewPatchConfigRequest(server string, body PatchConfigJSONRequestBody) (*http.Request, error)
- func NewPatchConfigRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func ParseAPIError(res *http.Response) error
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type APIConfig
- type BadRequest
- type Client
- func (c *Client) GetConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetServices(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) InjectSidecarProxyWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PatchConfig(ctx context.Context, body PatchConfigJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PatchConfigWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigResponse, error)
- func (c *ClientWithResponses) GetServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetServicesResponse, error)
- func (c *ClientWithResponses) InjectSidecarProxyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*InjectSidecarProxyResponse, error)
- func (c *ClientWithResponses) PatchConfigWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PatchConfigResponse, error)
- func (c *ClientWithResponses) PatchConfigWithResponse(ctx context.Context, body PatchConfigJSONRequestBody, ...) (*PatchConfigResponse, error)
- type ClientWithResponsesInterface
- type EchoRouter
- type ErrorDetail
- type ErrorModel
- type ExportersConfig
- type Forbidden
- type GetConfigResponse
- type GetServicesResponse
- type HttpRequestDoer
- type Image
- type InjectConfig
- type InjectSidecarProxyMultipartBody
- type InjectSidecarProxyMultipartRequestBody
- type InjectSidecarProxyResponse
- type InternalServerError
- type MeshConfig
- type MeshConfigAccessControlMode
- type MeshConfigEnvironment
- type MeshConfigLoadBalancingMethod
- type MeshConfigNginxErrorLogLevel
- type MeshConfigNginxLogFormat
- type MetricsConfig
- type MtlsConfig
- type MtlsConfigCaKeyType
- type MtlsConfigMode
- type OtlpExporterConfig
- type PatchConfig
- type PatchConfigFieldAccessControlMode
- type PatchConfigFieldLoadBalancingMethod
- type PatchConfigFieldNginxErrorLogLevel
- type PatchConfigFieldNginxLogFormat
- type PatchConfigJSONBody
- type PatchConfigJSONBody1
- type PatchConfigJSONRequestBody
- type PatchConfigOp
- type PatchConfigResponse
- type PortsConfig
- type ProxiedResources
- type ProxyConfig
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- type Service
- type ServicePort
- type TelemetryConfig
- type TraceConfig
- type TraceConfigBackend
- type Unauthorized
Constants ¶
const ( // InjectedAnnotation tells us if a pod has been injected. InjectedAnnotation = "injector.nsm.nginx.com/status" // AutoInjectLabel tells whether a pod should be injected with the sidecar. AutoInjectLabel = "injector.nsm.nginx.com/auto-inject" )
injector annotations and labels.
const ( // NatsAgentConfigChannel sends the mesh config from mesh-api to agent. NatsAgentConfigChannel = "nginx.nsm.agent.config" // NatsAgentSubChannel sends a subscription and version notice from agent to mesh-api. NatsAgentSubChannel = "nginx.nsm.agent.subscription" // NatsAPIPingChannel sends a ping from mesh-api to agent on restart. NatsAPIPingChannel = "nginx.nsm.api.ping" )
NATS channel names.
const ( // MeshConfigMap is the name of the config map that holds the mesh config. MeshConfigMap = "mesh-config" // MeshConfigFileName is the name of the file where the mesh config is stored. MeshConfigFileName = "mesh-config.json" // NatsServer is the name of the nats-server service. NatsServer = "nats-server" // MeshAPI is the name of the mesh api. MeshAPI = "nginx-mesh-api" // MeshCertReloader is the name of the mesh cert reloader image. MeshCertReloader = "nginx-mesh-cert-reloader" // MeshSidecar is the name of the mesh sidecar. MeshSidecar = "nginx-mesh-sidecar" // MeshSidecarInit is the name of the mesh init container. MeshSidecarInit = "nginx-mesh-init" // MetricsService is the name of the traffic metrics service. MetricsService = "nginx-mesh-metrics-svc" // MetricsServiceAccount is the name of the service account of traffic metrics. MetricsServiceAccount = "nginx-mesh-metrics" // MetricsDeployment is the name of the traffic metrics deployment. MetricsDeployment = MetricsServiceAccount // HTTPRouteGroupKind is the kind for HTTPRouteGroups. HTTPRouteGroupKind = "HTTPRouteGroup" // TCPRouteKind is the kind of TcpRoutes. TCPRouteKind = "TCPRoute" )
k8s static resource names.
const ( // IgnoreIncomingPortsField is the field that lists ports to ignore for incoming traffic. IgnoreIncomingPortsField = "ignoreIncomingPorts" // IgnoreOutgoingPortsField is the field that lists ports to ignore for outgoing traffic. IgnoreOutgoingPortsField = "ignoreOutgoingPorts" // FileField is the field that contains the binary data of the file to inject. FileField = "file" )
field names for inject payload.
const DeployLabel = "nsm.nginx.com/"
DeployLabel is the label key for deployment type of the resource.
const Injected = "injected"
Injected is used as the value in the InjectedAnnotation.
Variables ¶
var Environments = map[string]struct{}{ string(Kubernetes): {}, string(Openshift): {}, }
Environments are the supported kubernetes environments.
var IgnoredNamespaces = map[string]bool{ "kube-system": true, }
IgnoredNamespaces is a map of the namespaces that the service mesh will ignore.
var LoadBalancingMethods = map[string]struct{}{ string(MeshConfigLoadBalancingMethodRoundRobin): {}, string(MeshConfigLoadBalancingMethodLeastConn): {}, string(MeshConfigLoadBalancingMethodLeastTime): {}, string(MeshConfigLoadBalancingMethodLeastTimeLastByte): {}, string(MeshConfigLoadBalancingMethodLeastTimeLastByteInflight): {}, string(MeshConfigLoadBalancingMethodRandom): {}, string(MeshConfigLoadBalancingMethodRandomTwo): {}, string(MeshConfigLoadBalancingMethodRandomTwoLeastConn): {}, string(MeshConfigLoadBalancingMethodRandomTwoLeastTime): {}, string(MeshConfigLoadBalancingMethodRandomTwoLeastTimeLastByte): {}, }
LoadBalancingMethods are the available NGINX load balancing methods.
var MtlsModes = map[string]struct{}{ string(Off): {}, string(Permissive): {}, string(Strict): {}, }
MtlsModes are the supported mtls modes.
var NGINXLogFormats = map[string]struct{}{ string(MeshConfigNginxLogFormatDefault): {}, string(MeshConfigNginxLogFormatJson): {}, }
NGINXLogFormats are the supported NGINX log formats.
var TracingBackends = map[string]struct{}{ string(Zipkin): {}, string(Jaeger): {}, string(Datadog): {}, }
TracingBackends are the supported tracing backends.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func NewGetConfigRequest ¶
NewGetConfigRequest generates requests for GetConfig
func NewGetServicesRequest ¶
NewGetServicesRequest generates requests for GetServices
func NewInjectSidecarProxyRequestWithBody ¶
func NewInjectSidecarProxyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewInjectSidecarProxyRequestWithBody generates requests for InjectSidecarProxy with any type of body
func NewPatchConfigRequest ¶
func NewPatchConfigRequest(server string, body PatchConfigJSONRequestBody) (*http.Request, error)
NewPatchConfigRequest calls the generic PatchConfig builder with application/json body
func NewPatchConfigRequestWithBody ¶
func NewPatchConfigRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPatchConfigRequestWithBody generates requests for PatchConfig with any type of body
func ParseAPIError ¶
ParseAPIError parses the error message from an HTTP response.
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type APIConfig ¶
type APIConfig struct { // Address The Kubernetes DNS name of the NGINX Service Mesh API. Address string `json:"address"` // ContainerPort The container port of the NGINX Service Mesh API. ContainerPort int `json:"containerPort"` // Port The port of the NGINX Service Mesh API. Port int `json:"port"` }
APIConfig The configuration of the NGINX Service Mesh API.
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func NewMeshClient ¶
NewMeshClient returns a new Client object for communicating with the mesh API.
func (*Client) GetServices ¶
func (*Client) InjectSidecarProxyWithBody ¶
func (*Client) PatchConfig ¶
func (c *Client) PatchConfig(ctx context.Context, body PatchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // GetConfig request GetConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // PatchConfig request with any body PatchConfigWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PatchConfig(ctx context.Context, body PatchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // InjectSidecarProxy request with any body InjectSidecarProxyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // GetServices request GetServices(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetConfigWithResponse ¶
func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigResponse, error)
GetConfigWithResponse request returning *GetConfigResponse
func (*ClientWithResponses) GetServicesWithResponse ¶
func (c *ClientWithResponses) GetServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetServicesResponse, error)
GetServicesWithResponse request returning *GetServicesResponse
func (*ClientWithResponses) InjectSidecarProxyWithBodyWithResponse ¶
func (c *ClientWithResponses) InjectSidecarProxyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InjectSidecarProxyResponse, error)
InjectSidecarProxyWithBodyWithResponse request with arbitrary body returning *InjectSidecarProxyResponse
func (*ClientWithResponses) PatchConfigWithBodyWithResponse ¶
func (c *ClientWithResponses) PatchConfigWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchConfigResponse, error)
PatchConfigWithBodyWithResponse request with arbitrary body returning *PatchConfigResponse
func (*ClientWithResponses) PatchConfigWithResponse ¶
func (c *ClientWithResponses) PatchConfigWithResponse(ctx context.Context, body PatchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchConfigResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetConfig request GetConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigResponse, error) // PatchConfig request with any body PatchConfigWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchConfigResponse, error) PatchConfigWithResponse(ctx context.Context, body PatchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchConfigResponse, error) // InjectSidecarProxy request with any body InjectSidecarProxyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InjectSidecarProxyResponse, error) // GetServices request GetServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetServicesResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type EchoRouter ¶
type EchoRouter interface { CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route }
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type ErrorDetail ¶
type ErrorDetail struct { // Description A detailed error message returned by the server. // // These messages contain the following information, where applicable: // // - What happened. // - Why it happened. // - What the consequences are (if any). // - Recommended action to take to resolve the issue. Description string `json:"description"` }
ErrorDetail defines model for ErrorDetail.
type ErrorModel ¶
type ErrorModel struct { // Code A numeric error code that can be used to identify errors for support purposes. Code int `json:"code"` Details *[]ErrorDetail `json:"details,omitempty"` // Message A human-readable message, in English, that describes the error. Message string `json:"message"` }
ErrorModel defines model for ErrorModel.
type ExportersConfig ¶
type ExportersConfig struct { // Otlp The configuration for an OTLP gRPC exporter. Otlp *OtlpExporterConfig `json:"otlp,omitempty"` }
ExportersConfig The configuration of exporters to send telemetry data to.
type GetConfigResponse ¶
type GetConfigResponse struct { Body []byte HTTPResponse *http.Response JSON200 *MeshConfig JSON401 *ErrorModel JSON403 *ErrorModel JSON500 *ErrorModel }
func ParseGetConfigResponse ¶
func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error)
ParseGetConfigResponse parses an HTTP response from a GetConfigWithResponse call
func (GetConfigResponse) Status ¶
func (r GetConfigResponse) Status() string
Status returns HTTPResponse.Status
func (GetConfigResponse) StatusCode ¶
func (r GetConfigResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetServicesResponse ¶
type GetServicesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]Service JSON401 *ErrorModel JSON403 *ErrorModel JSON500 *ErrorModel }
func ParseGetServicesResponse ¶
func ParseGetServicesResponse(rsp *http.Response) (*GetServicesResponse, error)
ParseGetServicesResponse parses an HTTP response from a GetServicesWithResponse call
func (GetServicesResponse) Status ¶
func (r GetServicesResponse) Status() string
Status returns HTTPResponse.Status
func (GetServicesResponse) StatusCode ¶
func (r GetServicesResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Image ¶
type Image struct { // Image The tag of the image. Image string `json:"image"` // Name The name of the image. Name string `json:"name"` }
Image A container image, comprised of an image name and image tag.
type InjectConfig ¶
type InjectConfig struct { // DisabledNamespaces A list of namespaces where automatic injection is disabled. To set this field, the isAutoInjectEnabled field must be true. DisabledNamespaces *[]string `json:"disabledNamespaces,omitempty"` // EnabledNamespaces A list of namespaces where automatic injection is enabled. To set this field, the isAutoInjectEnabled field must be false. EnabledNamespaces *[]string `json:"enabledNamespaces,omitempty"` // IsAutoInjectEnabled Whether or not automatic injection of the NGINX Service Mesh sidecar is enabled. This value can be overridden on a per-Pod basis with a Pod annotation. IsAutoInjectEnabled *bool `json:"isAutoInjectEnabled,omitempty"` }
InjectConfig The configuration for injection of the NGINX Service Mesh sidecar.
type InjectSidecarProxyMultipartBody ¶
type InjectSidecarProxyMultipartBody struct { // File The file that contains one or more Kubernetes resource definitions. File openapi_types.File `json:"file"` // IgnoreIncomingPorts A list of ports that the sidecar proxy should ignore for incoming traffic. IgnoreIncomingPorts *[]string `json:"ignoreIncomingPorts,omitempty"` // IgnoreOutgoingPorts A list of ports that the sidecar proxy should ignore for outgoing traffic. IgnoreOutgoingPorts *[]string `json:"ignoreOutgoingPorts,omitempty"` }
InjectSidecarProxyMultipartBody defines parameters for InjectSidecarProxy.
type InjectSidecarProxyMultipartRequestBody ¶
type InjectSidecarProxyMultipartRequestBody InjectSidecarProxyMultipartBody
InjectSidecarProxyMultipartRequestBody defines body for InjectSidecarProxy for multipart/form-data ContentType.
type InjectSidecarProxyResponse ¶
type InjectSidecarProxyResponse struct { Body []byte HTTPResponse *http.Response JSON400 *ErrorModel JSON401 *ErrorModel JSON403 *ErrorModel JSON500 *ErrorModel }
func ParseInjectSidecarProxyResponse ¶
func ParseInjectSidecarProxyResponse(rsp *http.Response) (*InjectSidecarProxyResponse, error)
ParseInjectSidecarProxyResponse parses an HTTP response from a InjectSidecarProxyWithResponse call
func (InjectSidecarProxyResponse) Status ¶
func (r InjectSidecarProxyResponse) Status() string
Status returns HTTPResponse.Status
func (InjectSidecarProxyResponse) StatusCode ¶
func (r InjectSidecarProxyResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type InternalServerError ¶
type InternalServerError = ErrorModel
InternalServerError defines model for InternalServerError.
type MeshConfig ¶
type MeshConfig struct { // AccessControlMode The access control mode of NGINX Service Mesh. AccessControlMode MeshConfigAccessControlMode `json:"accessControlMode"` // Api The configuration of the NGINX Service Mesh API. Api APIConfig `json:"api"` // AutoInjectorPort The port that the automatic injection webhook binds to. AutoInjectorPort int `json:"autoInjectorPort"` // ClientMaxBodySize The maximum allowed size of the client request body. ClientMaxBodySize string `json:"clientMaxBodySize"` // EnabledNamespaces A list of namespaces where automatic injection is enabled. To set this field, the isAutoInjectEnabled field must be false. EnabledNamespaces *[]string `json:"enabledNamespaces,omitempty"` // Environment The environment that the NGINX Service Mesh control plane is installed in. Environment MeshConfigEnvironment `json:"environment"` // Injection The configuration for injection of the NGINX Service Mesh sidecar. Injection InjectConfig `json:"injection"` // IsAutoInjectEnabled Whether or not automatic injection of the NGINX Service Mesh sidecar is enabled globally. IsAutoInjectEnabled *bool `json:"isAutoInjectEnabled,omitempty"` // IsUDPEnabled Enable UDP traffic proxying. IsUDPEnabled bool `json:"isUDPEnabled"` // LoadBalancingMethod The global load balancing method for Services in NGINX Service Mesh. This value can be overridden on a per-Service basis with a Service annotation. LoadBalancingMethod MeshConfigLoadBalancingMethod `json:"loadBalancingMethod"` // Mtls The configuration for mTLS. Mtls MtlsConfig `json:"mtls"` // Namespace The namespace where the NGINX Service Mesh control plane is installed. Namespace string `json:"namespace"` // NginxErrorLogLevel The error log level of the NGINX Service Mesh sidecar proxies. NginxErrorLogLevel MeshConfigNginxErrorLogLevel `json:"nginxErrorLogLevel"` // NginxLogFormat The log format of the NGINX Service Mesh sidecar proxies. NginxLogFormat MeshConfigNginxLogFormat `json:"nginxLogFormat"` // PrometheusAddress The address of the Prometheus server deployment. PrometheusAddress string `json:"prometheusAddress"` // Proxy The configuration of the NGINX Service Mesh sidecar proxies. Proxy ProxyConfig `json:"proxy"` // RegistryKeyName The name of the registry key that is used to pull the NGINX Service Mesh docker images. RegistryKeyName string `json:"registryKeyName"` // SidecarImage A container image, comprised of an image name and image tag. SidecarImage Image `json:"sidecarImage"` // SidecarInitImage A container image, comprised of an image name and image tag. SidecarInitImage Image `json:"sidecarInitImage"` // Telemetry The configuration for telemetry. Telemetry TelemetryConfig `json:"telemetry"` // Tracing The configuration for tracing. Tracing TraceConfig `json:"tracing"` // TrustDomain The trust domain of the NGINX Service Mesh. TrustDomain string `json:"trustDomain"` }
MeshConfig Holds combined configuration required to run the NGINX Service Mesh control plane and the data plane.
func (*MeshConfig) CheckForInvalidConfig ¶
func (config *MeshConfig) CheckForInvalidConfig(k8sClient client.Client) error
CheckForInvalidConfig returns an error if config is not valid Invalid configs:
- AutoInjection is disabled but there are disabled namespaces
- AutoInjection is enabled but there are enabled namespaces
- LoadBalancingMethod is "random" when CircuitBreakers exist
- both tracing and telemetry are enabled
type MeshConfigAccessControlMode ¶
type MeshConfigAccessControlMode string
MeshConfigAccessControlMode The access control mode of NGINX Service Mesh.
const ( MeshConfigAccessControlModeAllow MeshConfigAccessControlMode = "allow" MeshConfigAccessControlModeDeny MeshConfigAccessControlMode = "deny" )
Defines values for MeshConfigAccessControlMode.
type MeshConfigEnvironment ¶
type MeshConfigEnvironment string
MeshConfigEnvironment The environment that the NGINX Service Mesh control plane is installed in.
const ( Kubernetes MeshConfigEnvironment = "kubernetes" Openshift MeshConfigEnvironment = "openshift" )
Defines values for MeshConfigEnvironment.
type MeshConfigLoadBalancingMethod ¶
type MeshConfigLoadBalancingMethod string
MeshConfigLoadBalancingMethod The global load balancing method for Services in NGINX Service Mesh. This value can be overridden on a per-Service basis with a Service annotation.
const ( MeshConfigLoadBalancingMethodLeastConn MeshConfigLoadBalancingMethod = "least_conn" MeshConfigLoadBalancingMethodLeastTime MeshConfigLoadBalancingMethod = "least_time" MeshConfigLoadBalancingMethodLeastTimeLastByte MeshConfigLoadBalancingMethod = "least_time last_byte" MeshConfigLoadBalancingMethodLeastTimeLastByteInflight MeshConfigLoadBalancingMethod = "least_time last_byte inflight" MeshConfigLoadBalancingMethodRandom MeshConfigLoadBalancingMethod = "random" MeshConfigLoadBalancingMethodRandomTwo MeshConfigLoadBalancingMethod = "random two" MeshConfigLoadBalancingMethodRandomTwoLeastConn MeshConfigLoadBalancingMethod = "random two least_conn" MeshConfigLoadBalancingMethodRandomTwoLeastTime MeshConfigLoadBalancingMethod = "random two least_time" MeshConfigLoadBalancingMethodRandomTwoLeastTimeLastByte MeshConfigLoadBalancingMethod = "random two least_time=last_byte" MeshConfigLoadBalancingMethodRoundRobin MeshConfigLoadBalancingMethod = "round_robin" )
Defines values for MeshConfigLoadBalancingMethod.
type MeshConfigNginxErrorLogLevel ¶
type MeshConfigNginxErrorLogLevel string
MeshConfigNginxErrorLogLevel The error log level of the NGINX Service Mesh sidecar proxies.
const ( MeshConfigNginxErrorLogLevelAlert MeshConfigNginxErrorLogLevel = "alert" MeshConfigNginxErrorLogLevelCrit MeshConfigNginxErrorLogLevel = "crit" MeshConfigNginxErrorLogLevelDebug MeshConfigNginxErrorLogLevel = "debug" MeshConfigNginxErrorLogLevelEmerg MeshConfigNginxErrorLogLevel = "emerg" MeshConfigNginxErrorLogLevelError MeshConfigNginxErrorLogLevel = "error" MeshConfigNginxErrorLogLevelInfo MeshConfigNginxErrorLogLevel = "info" MeshConfigNginxErrorLogLevelNotice MeshConfigNginxErrorLogLevel = "notice" MeshConfigNginxErrorLogLevelWarn MeshConfigNginxErrorLogLevel = "warn" )
Defines values for MeshConfigNginxErrorLogLevel.
type MeshConfigNginxLogFormat ¶
type MeshConfigNginxLogFormat string
MeshConfigNginxLogFormat The log format of the NGINX Service Mesh sidecar proxies.
const ( MeshConfigNginxLogFormatDefault MeshConfigNginxLogFormat = "default" MeshConfigNginxLogFormatJson MeshConfigNginxLogFormat = "json" )
Defines values for MeshConfigNginxLogFormat.
type MetricsConfig ¶
type MetricsConfig struct {
PromAddr *string `json:"PrometheusAddress,omitempty"`
}
MetricsConfig holds the data that may be dynamically updated at runtime for the nginx-mesh-metrics component.
type MtlsConfig ¶
type MtlsConfig struct { // CaKeyType The key type used for the SPIRE Server CA. CaKeyType *MtlsConfigCaKeyType `json:"caKeyType,omitempty"` // CaTTL The CA/signing key TTL in hours(h). Min value 24h. Max value 999999h. CaTTL *string `json:"caTTL,omitempty"` // Mode The mTLS mode of NGINX Service Mesh. Mode *MtlsConfigMode `json:"mode,omitempty"` // SvidTTL The TTL of certificates issued to workloads in hours(h) or minutes(m). Max value is 999999. SvidTTL *string `json:"svidTTL,omitempty"` }
MtlsConfig The configuration for mTLS.
type MtlsConfigCaKeyType ¶
type MtlsConfigCaKeyType string
MtlsConfigCaKeyType The key type used for the SPIRE Server CA.
const ( EcP256 MtlsConfigCaKeyType = "ec-p256" EcP384 MtlsConfigCaKeyType = "ec-p384" Rsa2048 MtlsConfigCaKeyType = "rsa-2048" Rsa4096 MtlsConfigCaKeyType = "rsa-4096" )
Defines values for MtlsConfigCaKeyType.
type MtlsConfigMode ¶
type MtlsConfigMode string
MtlsConfigMode The mTLS mode of NGINX Service Mesh.
const ( Off MtlsConfigMode = "off" Permissive MtlsConfigMode = "permissive" Strict MtlsConfigMode = "strict" )
Defines values for MtlsConfigMode.
type OtlpExporterConfig ¶
type OtlpExporterConfig struct { // Host The host of the OpenTelemetry gRPC exporter to connect to. Host string `json:"host"` // Port The port of the OpenTelemetry gRPC exporter to connect to. Port int `json:"port"` }
OtlpExporterConfig The configuration for an OTLP gRPC exporter.
type PatchConfig ¶
type PatchConfig struct { Field struct { // AccessControlMode The access control mode of NGINX Service Mesh. AccessControlMode *PatchConfigFieldAccessControlMode `json:"accessControlMode,omitempty"` // ClientMaxBodySize The maximum allowed size of the client request body. ClientMaxBodySize *string `json:"clientMaxBodySize,omitempty"` // EnabledNamespaces A list of namespaces where automatic injection is enabled. To set this field, the isAutoInjectEnabled field must be false. EnabledNamespaces *[]string `json:"enabledNamespaces,omitempty"` // Injection The configuration for injection of the NGINX Service Mesh sidecar. Injection *InjectConfig `json:"injection,omitempty"` // IsAutoInjectEnabled Whether or not automatic injection of the NGINX Service Mesh sidecar is enabled. This value can be overridden on a per-Pod basis with a Pod annotation. IsAutoInjectEnabled *bool `json:"isAutoInjectEnabled,omitempty"` // LoadBalancingMethod The global load balancing method for Services in NGINX Service Mesh. This value can be overridden on a per-Service basis with a Service annotation. LoadBalancingMethod *PatchConfigFieldLoadBalancingMethod `json:"loadBalancingMethod,omitempty"` // Mtls The configuration for mTLS. Mtls *MtlsConfig `json:"mtls,omitempty"` // NginxErrorLogLevel The error log level of the NGINX Service Mesh sidecar proxies. NginxErrorLogLevel *PatchConfigFieldNginxErrorLogLevel `json:"nginxErrorLogLevel,omitempty"` // NginxLogFormat The log format of the NGINX Service Mesh sidecar proxies. NginxLogFormat *PatchConfigFieldNginxLogFormat `json:"nginxLogFormat,omitempty"` // PrometheusAddress The address of the Prometheus server. Must be reachable from the Kubernetes cluster that NGINX Service Mesh is installed in. PrometheusAddress *string `json:"prometheusAddress,omitempty"` // Telemetry The configuration for telemetry. Telemetry *TelemetryConfig `json:"telemetry,omitempty"` // Tracing The configuration for tracing. Tracing *TraceConfig `json:"tracing,omitempty"` } `json:"field"` // Op The type of operation to be performed on the NGINX Service Mesh configuration. Values in the NGINX Service Mesh configuration can be added, removed, or replaced. Op PatchConfigOp `json:"op"` }
PatchConfig The configuration object that holds the updates to be made to the NGINX Service Mesh configuration.
type PatchConfigFieldAccessControlMode ¶
type PatchConfigFieldAccessControlMode string
PatchConfigFieldAccessControlMode The access control mode of NGINX Service Mesh.
const ( PatchConfigFieldAccessControlModeAllow PatchConfigFieldAccessControlMode = "allow" PatchConfigFieldAccessControlModeDeny PatchConfigFieldAccessControlMode = "deny" )
Defines values for PatchConfigFieldAccessControlMode.
type PatchConfigFieldLoadBalancingMethod ¶
type PatchConfigFieldLoadBalancingMethod string
PatchConfigFieldLoadBalancingMethod The global load balancing method for Services in NGINX Service Mesh. This value can be overridden on a per-Service basis with a Service annotation.
const ( PatchConfigFieldLoadBalancingMethodLeastConn PatchConfigFieldLoadBalancingMethod = "least_conn" PatchConfigFieldLoadBalancingMethodLeastTime PatchConfigFieldLoadBalancingMethod = "least_time" PatchConfigFieldLoadBalancingMethodLeastTimeLastByte PatchConfigFieldLoadBalancingMethod = "least_time last_byte" PatchConfigFieldLoadBalancingMethodLeastTimeLastByteInflight PatchConfigFieldLoadBalancingMethod = "least_time last_byte inflight" PatchConfigFieldLoadBalancingMethodRandom PatchConfigFieldLoadBalancingMethod = "random" PatchConfigFieldLoadBalancingMethodRandomTwo PatchConfigFieldLoadBalancingMethod = "random two" PatchConfigFieldLoadBalancingMethodRandomTwoLeastConn PatchConfigFieldLoadBalancingMethod = "random two least_conn" PatchConfigFieldLoadBalancingMethodRandomTwoLeastTime PatchConfigFieldLoadBalancingMethod = "random two least_time" PatchConfigFieldLoadBalancingMethodRandomTwoLeastTimeLastByte PatchConfigFieldLoadBalancingMethod = "random two least_time=last_byte" PatchConfigFieldLoadBalancingMethodRoundRobin PatchConfigFieldLoadBalancingMethod = "round_robin" )
Defines values for PatchConfigFieldLoadBalancingMethod.
type PatchConfigFieldNginxErrorLogLevel ¶
type PatchConfigFieldNginxErrorLogLevel string
PatchConfigFieldNginxErrorLogLevel The error log level of the NGINX Service Mesh sidecar proxies.
const ( PatchConfigFieldNginxErrorLogLevelAlert PatchConfigFieldNginxErrorLogLevel = "alert" PatchConfigFieldNginxErrorLogLevelCrit PatchConfigFieldNginxErrorLogLevel = "crit" PatchConfigFieldNginxErrorLogLevelDebug PatchConfigFieldNginxErrorLogLevel = "debug" PatchConfigFieldNginxErrorLogLevelEmerg PatchConfigFieldNginxErrorLogLevel = "emerg" PatchConfigFieldNginxErrorLogLevelError PatchConfigFieldNginxErrorLogLevel = "error" PatchConfigFieldNginxErrorLogLevelInfo PatchConfigFieldNginxErrorLogLevel = "info" PatchConfigFieldNginxErrorLogLevelNotice PatchConfigFieldNginxErrorLogLevel = "notice" PatchConfigFieldNginxErrorLogLevelWarn PatchConfigFieldNginxErrorLogLevel = "warn" )
Defines values for PatchConfigFieldNginxErrorLogLevel.
type PatchConfigFieldNginxLogFormat ¶
type PatchConfigFieldNginxLogFormat string
PatchConfigFieldNginxLogFormat The log format of the NGINX Service Mesh sidecar proxies.
const ( PatchConfigFieldNginxLogFormatDefault PatchConfigFieldNginxLogFormat = "default" PatchConfigFieldNginxLogFormatJson PatchConfigFieldNginxLogFormat = "json" )
Defines values for PatchConfigFieldNginxLogFormat.
type PatchConfigJSONBody ¶
type PatchConfigJSONBody struct {
// contains filtered or unexported fields
}
PatchConfigJSONBody defines parameters for PatchConfig.
type PatchConfigJSONBody1 ¶
type PatchConfigJSONBody1 = []PatchConfig
PatchConfigJSONBody1 defines parameters for PatchConfig.
type PatchConfigJSONRequestBody ¶
type PatchConfigJSONRequestBody PatchConfigJSONBody
PatchConfigJSONRequestBody defines body for PatchConfig for application/json ContentType.
type PatchConfigOp ¶
type PatchConfigOp string
PatchConfigOp The type of operation to be performed on the NGINX Service Mesh configuration. Values in the NGINX Service Mesh configuration can be added, removed, or replaced.
const ( Add PatchConfigOp = "add" Remove PatchConfigOp = "remove" Replace PatchConfigOp = "replace" )
Defines values for PatchConfigOp.
type PatchConfigResponse ¶
type PatchConfigResponse struct { Body []byte HTTPResponse *http.Response JSON200 *MeshConfig JSON400 *ErrorModel JSON401 *ErrorModel JSON403 *ErrorModel }
func ParsePatchConfigResponse ¶
func ParsePatchConfigResponse(rsp *http.Response) (*PatchConfigResponse, error)
ParsePatchConfigResponse parses an HTTP response from a PatchConfigWithResponse call
func (PatchConfigResponse) Status ¶
func (r PatchConfigResponse) Status() string
Status returns HTTPResponse.Status
func (PatchConfigResponse) StatusCode ¶
func (r PatchConfigResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PortsConfig ¶
type PortsConfig struct { // Incoming The incoming HTTP port. Incoming int `json:"incoming"` // IncomingGrpc The incoming gRPC port. IncomingGrpc int `json:"incomingGrpc"` // IncomingGrpcPermissive The incoming gRPC port when the mTLS mode of the sidecar proxy is set to permissive. IncomingGrpcPermissive int `json:"incomingGrpcPermissive"` // IncomingNotInKeyval The incoming port that handles requests from Services not in the NGINX Service Mesh. IncomingNotInKeyval int `json:"incomingNotInKeyval"` // IncomingPermissive The incoming HTTP port when the mTLS mode of the sidecar proxy is set to permissive. IncomingPermissive int `json:"incomingPermissive"` // IncomingRedirect The incoming redirect port. This port redirects requests to another port on the sidecar proxy based on the protocol of the request. IncomingRedirect int `json:"incomingRedirect"` // IncomingTcp The incoming TCP port. IncomingTcp int `json:"incomingTcp"` // IncomingTcpDeny The incoming TCP deny port. This port denies TCP traffic if it is not a part of NGINX Service Mesh or if the access to the sidecar is not allowed. IncomingTcpDeny int `json:"incomingTcpDeny"` // IncomingTcpPermissive The incoming TCP port when the mTLS mode of the sidecar proxy is set to perissive. IncomingTcpPermissive int `json:"incomingTcpPermissive"` // IncomingUdp The incoming UDP port. IncomingUdp int `json:"incomingUdp"` // Metrics The Prometheus metrics port. Metrics int `json:"metrics"` // Outgoing The outgoing HTTP port. Outgoing int `json:"outgoing"` // OutgoingDefaultEgress The outgoing traffic port for egress traffic when the NGINX Plus Ingress Controller is deployed as an egress controller. OutgoingDefaultEgress int `json:"outgoingDefaultEgress"` // OutgoingGrpc The outgoing gRPC port. OutgoingGrpc int `json:"outgoingGrpc"` // OutgoingNotInKeyval The outgoing port for destinations that are not a part of NGINX Service Mesh. OutgoingNotInKeyval int `json:"outgoingNotInKeyval"` // OutgoingRedirect The outgoing redirect port. This port redirects requests to another port on the sidecar proxy based on the protocol of the request. OutgoingRedirect int `json:"outgoingRedirect"` // OutgoingTcp The outgoing TCP port. OutgoingTcp int `json:"outgoingTcp"` // OutgoingUdp The outgoing UDP port. OutgoingUdp int `json:"outgoingUdp"` // PlusApi The port for the NGINX Plus API. This API is not accessible outside of the NGINX Service Mesh sidecar container. PlusApi int `json:"plusApi"` // RedirectHealthPort This port redirects HTTP health probes to the application container. RedirectHealthPort int `json:"redirectHealthPort"` // RedirectHealthPortHTTPS This port redirects HTTPS health probes to the application container. RedirectHealthPortHTTPS int `json:"redirectHealthPortHTTPS"` }
PortsConfig The ports that the NGINX Service Mesh sidecar proxies listen on.
type ProxiedResources ¶
ProxiedResources is a map of namespace -> k8s resource type -> resource names; used by the CLI to print out proxied resources when removing the mesh.
type ProxyConfig ¶
type ProxyConfig struct { // Ports The ports that the NGINX Service Mesh sidecar proxies listen on. Ports PortsConfig `json:"ports"` // Transparent Whether or not the NGINX Service Mesh sidecar proxies are running in transparent mode. Transparent mode means that the sidecar proxies are passing the traffic through to the destination without applying any rules to the traffic. Transparent bool `json:"transparent"` }
ProxyConfig The configuration of the NGINX Service Mesh sidecar proxies.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Get NGINX Service Mesh configuration // (GET /config) GetConfig(ctx echo.Context) error // Update NGINX Service Mesh Configuration // (PATCH /config) PatchConfig(ctx echo.Context) error // Inject a Kubernetes resource // (POST /inject) InjectSidecarProxy(ctx echo.Context) error // List all Services // (GET /services) GetServices(ctx echo.Context) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) GetConfig ¶
func (w *ServerInterfaceWrapper) GetConfig(ctx echo.Context) error
GetConfig converts echo context to params.
func (*ServerInterfaceWrapper) GetServices ¶
func (w *ServerInterfaceWrapper) GetServices(ctx echo.Context) error
GetServices converts echo context to params.
func (*ServerInterfaceWrapper) InjectSidecarProxy ¶
func (w *ServerInterfaceWrapper) InjectSidecarProxy(ctx echo.Context) error
InjectSidecarProxy converts echo context to params.
func (*ServerInterfaceWrapper) PatchConfig ¶
func (w *ServerInterfaceWrapper) PatchConfig(ctx echo.Context) error
PatchConfig converts echo context to params.
type Service ¶
type Service struct { // Addresses The IP addresses of the Endpoints of the Kubernetes Service. Addresses []string `json:"addresses"` // Name The Kubernetes Service name. Name string `json:"name"` // Namespace The namespace of the Kubernetes Service. Namespace *string `json:"namespace,omitempty"` // Ports The ports of the Kubernetes Service. Ports []ServicePort `json:"ports"` // ServiceIP The IP address of the Kubernetes Service. ServiceIP *string `json:"serviceIP,omitempty"` }
Service The configuration of a Service resource in NGINX Service Mesh.
type ServicePort ¶
type ServicePort struct { // Port The port number. Port int32 `json:"port"` // Protocol The protocol of the traffic. Protocol string `json:"protocol"` }
ServicePort A representation of a Service Port in NGINX Service Mesh. Contains the port number and the protocol.
type TelemetryConfig ¶
type TelemetryConfig struct { // Exporters The configuration of exporters to send telemetry data to. Exporters *ExportersConfig `json:"exporters,omitempty"` // SamplerRatio The percentage of traces that are processed and exported to the telemetry backend. SamplerRatio *float32 `json:"samplerRatio,omitempty"` }
TelemetryConfig The configuration for telemetry.
type TraceConfig ¶
type TraceConfig struct { // Backend The name of the tracing backend. Backend *TraceConfigBackend `json:"backend,omitempty"` // BackendAddress The address of the tracing backend. Must be reachable from the Kubernetes cluster that NGINX Service Mesh is installed in. BackendAddress *string `json:"backendAddress,omitempty"` // SampleRate The percentage of traces that are processed and exported to the tracing backend. SampleRate *float32 `json:"sampleRate,omitempty"` }
TraceConfig The configuration for tracing.
type TraceConfigBackend ¶
type TraceConfigBackend string
TraceConfigBackend The name of the tracing backend.
const ( Datadog TraceConfigBackend = "datadog" Jaeger TraceConfigBackend = "jaeger" Zipkin TraceConfigBackend = "zipkin" )
Defines values for TraceConfigBackend.