googlesqlproxy

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Google Cloud SQL Auth Proxy Plugin

The rigdev.google_cloud_sql_auth_proxy plugins injects a Google Cloud SQL auth proxy container into your deployment as a sidecar. See here for a description of the auth proxy. It will append a container named google-cloud-sql-proxy running the gcr.io/cloud-sql-connectors/cloud-sql-proxy image to your deployment and set its arguments, environment variables and config files according the the configuration of this plugin.

The config can be templated with standard Go templating and has

.capsule

as its templating context.

Example

Config (in context of the rig-operator Helm values):

config:
  pipeline:
    steps:
      - plugins:
        - name: rigdev.google_cloud_sql_auth_proxy
          config: |
            tag: 2.9  
            args
              - arg1
              - arg2
            envFromSource:
              - kind: ConfigMap
                name: my-configmap
            envVars:
              name: MY_ENV_VAR
              value: some-value
            resources:
              cpu: 0.1
              memory: 128M
            instanceConnectionNames:
              - instance-name

Resulting Deployment

kind: Deployment
spec:
  initContainers:
    ...
    - name: google-cloud-sql-proxy
      image: gcr.io/cloud-sql-connectors/cloud-sql-proxy
      args: ['instance-name', 'arg1', 'arg2']
      envFrom:
        - configMapRef:
            name: my-configmap
      env:
        - name: MY_ENV_VAR
          value: some-value
      resources:
        requests:
          cpu: 0.1
          memory: 128M
      securityContext:
        runAsNonRoot: true
      restartPolicy: Always

Config

Configuration for the google_cloud_sql_auth_proxy plugin

Field Description
image string The image running on the new container. Defaults to gcr.io/cloud-sql-connectors/cloud-sql-proxy
tag string The tag of the image
args string array Arguments to pass to the cloud sql proxy. These will be appended after the instance connection names.
envFromSource EnvReference array A list of either ConfigMaps or Secrets which will be mounted in as environment variables to the container. It's a reuse of the Capsule CRD
envVars EnvVar array A list of environment variables to set in the container
files File array Files is a list of files to mount in the container. These can either be based on ConfigMaps or Secrets. It's a reuse of the Capsule CRD
resources Resources Resources defines how large the container request should be. Defaults to the Kubernetes defaults.
instanceConnectionNames string array The instance_connection_names passed to the cloud_sql_proxy.
Resources

Resources configures the size of the request of the cloud_sql_proxy container

Field Description
cpu string The number of CPU cores to request.
memory string The bytes of memory to request.

Documentation

Overview

+groupName=plugins.rig.dev -- Only used for config doc generation

Index

Constants

View Source
const Name = "rigdev.google_cloud_sql_auth_proxy"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The image running on the new container. Defaults to gcr.io/cloud-sql-connectors/cloud-sql-proxy
	Image string `json:"image,omitempty"`
	// The tag of the image
	Tag string `json:"tag,omitempty"`
	// Arguments to pass to the cloud sql proxy. These will be appended after the instance connection names.
	Args []string `json:"args,omitempty"`
	// A list of either ConfigMaps or Secrets which will be mounted in as environment variables to the container.
	// It's a reuse of the Capsule CRD
	EnvFromSource []v1alpha2.EnvReference `json:"envFromSource,omitempty"`
	// A list of environment variables to set in the container
	EnvVars []corev1.EnvVar `json:"envVars,omitempty"`
	// Files is a list of files to mount in the container. These can either be
	// based on ConfigMaps or Secrets.
	// It's a reuse of the Capsule CRD
	Files []v1alpha2.File `json:"files,omitempty"`
	// Resources defines how large the container request should be. Defaults to the Kubernetes defaults.
	Resources Resources `json:"resources,omitempty"`
	// The instance_connection_names passed to the cloud_sql_proxy.
	InstanceConnectionNames []string `json:"instanceConnectionNames,omitempty"`
}

Configuration for the google_cloud_sql_auth_proxy plugin +kubebuilder:object:root=true

type Plugin

type Plugin struct {
	plugin.NoWatchObjectStatus
	// contains filtered or unexported fields
}

func (*Plugin) Initialize

func (p *Plugin) Initialize(req plugin.InitializeRequest) error

func (*Plugin) Run

func (p *Plugin) Run(_ context.Context, req pipeline.CapsuleRequest, _ hclog.Logger) error

type Resources

type Resources struct {
	// The number of CPU cores to request.
	CPU string `json:"cpu"`
	// The bytes of memory to request.
	Memory string `json:"memory"`
}

Resources configures the size of the request of the cloud_sql_proxy container

Jump to

Keyboard shortcuts

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