juju: github.com/juju/juju/worker/caasadmission Index | Files

package caasadmission

import "github.com/juju/juju/worker/caasadmission"

Index

Package Files

admission.go controller.go handler.go manifold.go

Constants

const (
    ExpectedContentType = "application/json"
    HeaderContentType   = "Content-Type"
)
const (
    // Component describes a sub zone to use on the juju tld for unique resource
    // ids. For example using this component "admission" with "juju.io" would
    // yield admission.juju.io
    Component = "admission"
)
const (
    // DefaultModelOperatorPort
    DefaultModelOperatorPort = int32(17071)
)

Variables

var (
    AdmissionGVK = schema.GroupVersionKind{
        Group:   admission.SchemeGroupVersion.Group,
        Version: admission.SchemeGroupVersion.Version,
        Kind:    "AdmissionReview",
    }
)

func AdmissionPathForModel Uses

func AdmissionPathForModel(modelUUID string) string

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates a Kubernetes mutating admission controller. Manifold has no outputs.

type AdmissionCreator Uses

type AdmissionCreator interface {
    EnsureMutatingWebhookConfiguration() (func(), error)
}

Represents a creator of mutating webhooks that is context aware of the current controller.

func NewAdmissionCreator Uses

func NewAdmissionCreator(
    authority pki.Authority,
    namespace, modelName string,
    ensureConfig func(*admission.MutatingWebhookConfiguration) (func(), error),
    service *admission.ServiceReference) (AdmissionCreator, error)

NewAdmissionCreator instantiates a new AdmissionCreator for the supplied context arguments.

type AdmissionCreatorFunc Uses

type AdmissionCreatorFunc func() (func(), error)

Func type of AdmissionCreator

func (AdmissionCreatorFunc) EnsureMutatingWebhookConfiguration Uses

func (a AdmissionCreatorFunc) EnsureMutatingWebhookConfiguration() (func(), error)

EnsureMutatingWebhookConfiguration implements AdmissionCreator interface for func type

type Controller Uses

type Controller struct {
    // contains filtered or unexported fields
}

Kubernetes controller responsible

func NewController Uses

func NewController(
    logger Logger,
    mux Mux,
    path string,
    admissionCreator AdmissionCreator,
    rbacMapper RBACMapper) (*Controller, error)

func (*Controller) Kill Uses

func (c *Controller) Kill()

func (*Controller) Wait Uses

func (c *Controller) Wait() error

type K8sBroker Uses

type K8sBroker interface {
    // CurrentModel returns the current model the broker is targeting
    CurrentModel() string

    // GetCurrentNamespace returns the current namespace being targeted on the
    // broker
    GetCurrentNamespace() string

    // EnsureMutatingWebhookConfiguration make the supplied webhook config exist
    // inside the k8s cluster if it currently does not. Return values is a
    // cleanup function that will destroy the webhook configuration from k8s
    // when called and a subsequent error if there was a problem. If error is
    // not nil then no other return values should be considered valid.
    EnsureMutatingWebhookConfiguration(*admission.MutatingWebhookConfiguration) (func(), error)
}

K8sBroker describes a Kubernetes broker interface this worker needs to function.

type Logger Uses

type Logger interface {
    Debugf(string, ...interface{})
    Errorf(string, ...interface{})
    Infof(string, ...interface{})
}

Logger represents the methods used by the worker to log details

type ManifoldConfig Uses

type ManifoldConfig struct {
    AgentName        string
    AuthorityName    string
    Authority        pki.Authority
    BrokerName       string
    Logger           Logger
    MuxName          string
    RBACMapperName   string
    ServerInfoName   string
    ServiceName      string
    ServiceNamespace string
}

ManifoldConfig describes the resources used by the admission worker

func (ManifoldConfig) Start Uses

func (c ManifoldConfig) Start(context dependency.Context) (worker.Worker, error)

Start is used to start the manifold an extract a worker from the supplied configuration.

func (ManifoldConfig) Validate Uses

func (c ManifoldConfig) Validate() error

Validate is used to to establish if the configuration is valid for use when creating new workers.

type Mux Uses

type Mux interface {
    AddHandler(string, string, http.Handler) error
    RemoveHandler(string, string)
}

type RBACMapper Uses

type RBACMapper interface {
    // AppNameForServiceAccount fetches the juju application name associated
    // with a given kubernetes service account UID. If no result is found
    // errors.NotFound is returned. All other errors should be considered
    // internal to the interface operation.
    AppNameForServiceAccount(types.UID) (string, error)
}

Package caasadmission imports 25 packages (graph) and is imported by 3 packages. Updated 2020-08-09. Refresh now. Tools for package owners.