scaler

package
v0.0.0-...-231794a Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2020 GreenKey Technologies

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var KeyScaleDownAt = "zero-pod-autoscaler/scale-down-at"

Functions

func JsonPatchEscape

func JsonPatchEscape(s string) string

JsonPatchEscape escapes a string for use as a path component in a JSON Patch by replacing "~" with "~0" and "/" with "~1".

http://jsonpatch.com/

Types

type Scaler

type Scaler struct {
	Client    kubernetes.Interface
	Namespace string
	Name      string

	// Target address to which requests are proxied. We need this
	// because endpoints reporting available doesn't mean the
	// Service can actually handle a request... so we ping the
	// actual target also.
	Target string

	TTL time.Duration
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	client kubernetes.Interface,
	namespace string,
	deployOptions, epOptions metav1.ListOptions,
	target string,
	ttl time.Duration,
) (*Scaler, error)

func (*Scaler) Available

func (sc *Scaler) Available() (available chan struct{})

Available returns a channel that will be closed when upstream is available. The returned channel may already be closed if upstream is currently available.

func (*Scaler) Run

func (sc *Scaler) Run(ctx context.Context) error

func (*Scaler) TryConnect

func (sc *Scaler) TryConnect(ctx context.Context) error

func (*Scaler) UseConnection

func (sc *Scaler) UseConnection(f func() error) error

Jump to

Keyboard shortcuts

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