cfgardenobserver

package module
v0.118.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 19 Imported by: 1

README

Cloud Foundry Garden Observer Extension

Status
Stability development
Distributions []
Issues Open issues Closed issues
Code Owners @crobert-1, @cemdk, @m1rp, @jriguera

Cloud Foundry (CF) is a platform as a service (PaaS) which has implemented their own container technology. The component in charge of providing a local API in each node (also known as "diego-cell") is named Garden.

The cfgarden_observer looks at the current host to discover Garden containers.

Example Config

extensions:
  cfgarden_observer:
    refresh_interval: 30s
    cache_sync_interval: 10m
    include_app_labels: true
    garden:
      endpoint: my/path/to/garden.sock
    cloud_foundry:
      endpoint: https://api.cf.mydomain.com
      auth:
        type: client_credentials
        client_id: myclientid
        client_secret: myclientsecret

receivers:
  receiver_creator:
    watch_observers: [cfgarden_observer]
    receivers:
      prometheus_simple:
        rule: type == "container" && labels["prometheus.io/scrape"] == "true" 
        config:
          metrics_path: /metrics
          endpoint: '`endpoint`'
Configuration
Name Type Default Description
refresh_interval string 1m Determines how often to look for changes in endpoints.
cache_sync_interval string 5m Determines how often app metadata cache is refreshed
include_app_labels bool false Determines whether or not app labels get added to container labels
garden.endpoint string /var/vcap/data/garden/garden.sock Path to garden socket.
cloud_foundry.endpoint string none. required when include_app_labels is set to true CloudFoundry API endpoint
cloud_foundry.auth.type string none. required when include_app_labels is set to true Authentication type, one of: user_pass, client_credentials, token
cloud_foundry.auth.username string none Username (auth.type: user_pass)
cloud_foundry.auth.password string none Password (auth.type: user_pass)
cloud_foundry.auth.client_id string none Client ID (auth.type: client_credentials)
cloud_foundry.auth.client_secret string none Client Secret (auth.type: client_credentials)
cloud_foundry.auth.access_token string none Access Token (auth.type: token)
cloud_foundry.auth.refresh_token string none Refresh Token (auth.type: token)
Endpoint Variables

Endpoint variables exposed by this observer are as follows.

Variable Description
type This value is always container
name Name of the Garden container associated to the port
labels map[string]string with labels set on the log_config tags and application resource
port Exposed port of the container
container_id ID of the container
host Hostname or IP of the underlying host the container is running on
transport Transport protocol used by the endpoint (TCP or UDP)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() extension.Factory

NewFactory creates a factory for CfGardenObserver extension.

Types

type CfAuth added in v0.113.0

type CfAuth struct {
	// Authentication method, there are 3 options
	Type authType `mapstructure:"type"`

	// Used for user_pass authentication method
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`

	// Used for token authentication method
	AccessToken  string `mapstructure:"access_token"`
	RefreshToken string `mapstructure:"refresh_token"`

	// Used for client_credentials authentication method
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
}

type CfConfig added in v0.113.0

type CfConfig struct {
	// The URL of the CloudFoundry API
	Endpoint string `mapstructure:"endpoint"`

	// Authentication details
	Auth CfAuth `mapstructure:"auth"`
}

type Config

type Config struct {
	// CloudFoundry API Configuration
	CloudFoundry CfConfig `mapstructure:"cloud_foundry"`

	// Garden API Configuration
	Garden GardenConfig `mapstructure:"garden"`

	// RefreshInterval determines the frequency at which the observer
	// needs to poll for collecting information about new processes.
	// Default: "1m"
	RefreshInterval time.Duration `mapstructure:"refresh_interval"`

	// The time to wait before resyncing app information on cached containers
	// using the CloudFoundry API.
	// Default: "5m"
	CacheSyncInterval time.Duration `mapstructure:"cache_sync_interval"`

	// Determines whether or not Application labels get added to the Endpoint labels.
	// This requires cloud_foundry to be configured, such that API calls can be made
	// Default: false
	IncludeAppLabels bool `mapstructure:"include_app_labels"`
}

Config defines configuration for CF Garden observer.

func (*Config) Validate added in v0.113.0

func (config *Config) Validate() error

Validate overrides the embedded noop validation so that load config can trigger our own validation logic.

type GardenConfig added in v0.113.0

type GardenConfig struct {
	// The URL of the CF Garden api. Default is "/var/vcap/data/garden/garden.sock"
	Endpoint string `mapstructure:"endpoint"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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