juju: github.com/juju/juju/caas/kubernetes/provider/specs Index | Files | Directories

package specs

import "github.com/juju/juju/caas/kubernetes/provider/specs"

Index

Package Files

container_env.go decode.go legacy.go secrets.go types.go v2.go v3.go

func ContainerConfigToK8sEnvConfig Uses

func ContainerConfigToK8sEnvConfig(cc specs.ContainerConfig) (envVars []core.EnvVar, envFromSources []core.EnvFromSource, err error)

ContainerConfigToK8sEnvConfig converts ContainerConfig to k8s format for container value mount.

func ParsePodSpec Uses

func ParsePodSpec(in string) (*specs.PodSpec, error)

ParsePodSpec parses a YAML file which defines how to configure a CAAS pod. We allow for generic container set up plus k8s select specific features.

func ParseRawK8sSpec Uses

func ParseRawK8sSpec(in string) ([]unstructured.Unstructured, error)

ParseRawK8sSpec parses a k8s format of YAML file which defines how to configure a CAAS pod. We allow for generic container set up plus k8s select specific features.

type BindingMetaGetter Uses

type BindingMetaGetter func(sa, roleOrClusterRole NameGetter) v1.ObjectMeta

BindingMetaGetter generates ObjectMeta for role bindings, cluster role bindings.

type K8sContainerSpec Uses

type K8sContainerSpec struct {
    LivenessProbe   *core.Probe           `json:"livenessProbe,omitempty" yaml:"livenessProbe,omitempty"`
    ReadinessProbe  *core.Probe           `json:"readinessProbe,omitempty" yaml:"readinessProbe,omitempty"`
    SecurityContext *core.SecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"`
}

K8sContainerSpec is a subset of v1.Container which defines attributes we expose for charms to set.

func (*K8sContainerSpec) Validate Uses

func (*K8sContainerSpec) Validate() error

Validate validates K8sContainerSpec.

type K8sCustomResourceDefinitionSpec Uses

type K8sCustomResourceDefinitionSpec struct {
    Name        string                                            `json:"name" yaml:"name"`
    Labels      map[string]string                                 `json:"labels,omitempty" yaml:"labels,omitempty"`
    Annotations map[string]string                                 `json:"annotations,omitempty" yaml:"annotations,omitempty"`
    Spec        apiextensionsv1beta1.CustomResourceDefinitionSpec `json:"spec" yaml:"spec"`
}

K8sCustomResourceDefinitionSpec defines spec for creating or updating an CustomResourceDefinition resource.

func (K8sCustomResourceDefinitionSpec) Validate Uses

func (crd K8sCustomResourceDefinitionSpec) Validate() error

Validate validates the spec.

type K8sIngressSpec Uses

type K8sIngressSpec struct {
    Name        string                        `json:"name" yaml:"name"`
    Labels      map[string]string             `json:"labels,omitempty" yaml:"labels,omitempty"`
    Annotations map[string]string             `json:"annotations,omitempty" yaml:"annotations,omitempty"`
    Spec        extensionsv1beta1.IngressSpec `json:"spec" yaml:"spec"`
}

K8sIngressSpec defines spec for creating or updating an ingress resource.

func (K8sIngressSpec) Validate Uses

func (ing K8sIngressSpec) Validate() error

Validate returns an error if the spec is not valid.

type K8sPodSpec Uses

type K8sPodSpec = K8sPodSpecV3

K8sPodSpec is the current k8s pod spec.

type K8sPodSpecV2 Uses

type K8sPodSpecV2 struct {
    // k8s resources.
    KubernetesResources *KubernetesResourcesV2 `json:"kubernetesResources,omitempty" yaml:"kubernetesResources,omitempty"`
}

K8sPodSpecV2 is a subset of v1.PodSpec which defines attributes we expose for charms to set.

func (*K8sPodSpecV2) Validate Uses

func (p *K8sPodSpecV2) Validate() error

Validate is defined on ProviderPod.

type K8sPodSpecV3 Uses

type K8sPodSpecV3 struct {
    // k8s resources.
    KubernetesResources *KubernetesResources `json:"kubernetesResources,omitempty" yaml:"kubernetesResources,omitempty"`
}

K8sPodSpecV3 is a subset of v1.PodSpec which defines attributes we expose for charms to set.

func (*K8sPodSpecV3) Validate Uses

func (p *K8sPodSpecV3) Validate() error

Validate is defined on ProviderPod.

type K8sRBACResources Uses

type K8sRBACResources struct {
    K8sRBACSpecConverter
    ServiceAccounts []K8sServiceAccountSpec `json:"serviceAccounts,omitempty" yaml:"serviceAccounts,omitempty"`
}

K8sRBACResources defines a spec for creating RBAC resources.

func PrimeServiceAccountToK8sRBACResources Uses

func PrimeServiceAccountToK8sRBACResources(spec specs.PrimeServiceAccountSpecV3) (*K8sRBACResources, error)

PrimeServiceAccountToK8sRBACResources converts PrimeServiceAccount to K8sRBACResources.

func (K8sRBACResources) ToK8s Uses

func (ks K8sRBACResources) ToK8s(
    getSaMeta ServiceAccountMetaGetter,
    getRoleMeta, getClusterRoleMeta RoleMetaGetter,
    getBindingMeta, getClusterBindingMeta BindingMetaGetter,
) (
    serviceAccounts []core.ServiceAccount,
    roles []rbacv1.Role,
    clusterroles []rbacv1.ClusterRole,
    roleBindings []rbacv1.RoleBinding,
    clusterRoleBindings []rbacv1.ClusterRoleBinding,
)

ToK8s converts modelled RBAC specs to k8s specs.

func (K8sRBACResources) Validate Uses

func (ks K8sRBACResources) Validate() error

Validate validates the spec.

type K8sRBACSpecConverter Uses

type K8sRBACSpecConverter interface {
    ToK8s(
        getSaMeta ServiceAccountMetaGetter,
        getRoleMeta, getClusterRoleMeta RoleMetaGetter,
        getBindingMeta, getClusterBindingMeta BindingMetaGetter,
    ) (
        []core.ServiceAccount,
        []rbacv1.Role,
        []rbacv1.ClusterRole,
        []rbacv1.RoleBinding,
        []rbacv1.ClusterRoleBinding,
    )
}

K8sRBACSpecConverter has a method to convert modelled RBAC spec to k8s spec.

type K8sServiceAccountSpec Uses

type K8sServiceAccountSpec struct {
    Name                       string `json:"name" yaml:"name"`
    specs.ServiceAccountSpecV3 `json:",inline" yaml:",inline"`
}

K8sServiceAccountSpec defines spec for referencing or creating additional RBAC resources.

func (K8sServiceAccountSpec) Validate Uses

func (sa K8sServiceAccountSpec) Validate() error

Validate returns an error if the spec is not valid.

type K8sServiceAccountSpecV2 Uses

type K8sServiceAccountSpecV2 struct {
    Name                       string `json:"name" yaml:"name"`
    specs.ServiceAccountSpecV2 `json:",inline" yaml:",inline"`
}

K8sServiceAccountSpecV2 defines spec for referencing or creating a service account for version 2.

func (K8sServiceAccountSpecV2) Validate Uses

func (ksa K8sServiceAccountSpecV2) Validate() error

Validate returns an error if the spec is not valid.

type KubernetesResources Uses

type KubernetesResources struct {
    Pod *PodSpec `json:"pod,omitempty" yaml:"pod,omitempty"`

    Secrets                   []Secret                               `json:"secrets" yaml:"secrets"`
    CustomResourceDefinitions []K8sCustomResourceDefinitionSpec      `json:"customResourceDefinitions" yaml:"customResourceDefinitions"`
    CustomResources           map[string][]unstructured.Unstructured `json:"customResources,omitempty" yaml:"customResources,omitempty"`

    MutatingWebhookConfigurations   map[string][]admissionregistration.MutatingWebhook   `json:"mutatingWebhookConfigurations,omitempty" yaml:"mutatingWebhookConfigurations,omitempty"`
    ValidatingWebhookConfigurations map[string][]admissionregistration.ValidatingWebhook `json:"validatingWebhookConfigurations,omitempty" yaml:"validatingWebhookConfigurations,omitempty"`

    K8sRBACResources `json:",inline" yaml:",inline"`

    IngressResources []K8sIngressSpec `json:"ingressResources,omitempty" yaml:"ingressResources,omitempty"`
}

KubernetesResources is the k8s related resources.

func (*KubernetesResources) Validate Uses

func (krs *KubernetesResources) Validate() error

Validate is defined on ProviderPod.

type KubernetesResourcesV2 Uses

type KubernetesResourcesV2 struct {
    Pod *PodSpec `json:"pod,omitempty" yaml:"pod,omitempty"`

    Secrets                   []Secret                                                     `json:"secrets" yaml:"secrets"`
    CustomResourceDefinitions map[string]apiextensionsv1beta1.CustomResourceDefinitionSpec `json:"customResourceDefinitions,omitempty" yaml:"customResourceDefinitions,omitempty"`
    CustomResources           map[string][]unstructured.Unstructured                       `json:"customResources,omitempty" yaml:"customResources,omitempty"`

    MutatingWebhookConfigurations   map[string][]admissionregistration.MutatingWebhook   `json:"mutatingWebhookConfigurations,omitempty" yaml:"mutatingWebhookConfigurations,omitempty"`
    ValidatingWebhookConfigurations map[string][]admissionregistration.ValidatingWebhook `json:"validatingWebhookConfigurations,omitempty" yaml:"validatingWebhookConfigurations,omitempty"`

    ServiceAccounts  []K8sServiceAccountSpecV2 `json:"serviceAccounts,omitempty" yaml:"serviceAccounts,omitempty"`
    IngressResources []K8sIngressSpec          `json:"ingressResources,omitempty" yaml:"ingressResources,omitempty"`
}

KubernetesResourcesV2 is the k8s related resources for version 2.

func (*KubernetesResourcesV2) Validate Uses

func (krs *KubernetesResourcesV2) Validate() error

Validate is defined on ProviderPod.

type NameGetter Uses

type NameGetter interface {
    GetName() string
}

NameGetter defines method to get the name from the resource.

type PodSpec Uses

type PodSpec struct {
    RestartPolicy                 core.RestartPolicy       `json:"restartPolicy,omitempty" yaml:"restartPolicy,omitempty"`
    ActiveDeadlineSeconds         *int64                   `json:"activeDeadlineSeconds,omitempty" yaml:"activeDeadlineSeconds,omitempty"`
    TerminationGracePeriodSeconds *int64                   `json:"terminationGracePeriodSeconds,omitempty" yaml:"terminationGracePeriodSeconds,omitempty"`
    SecurityContext               *core.PodSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"`
    ReadinessGates                []core.PodReadinessGate  `json:"readinessGates,omitempty" yaml:"readinessGates,omitempty"`
    DNSPolicy                     core.DNSPolicy           `json:"dnsPolicy,omitempty" yaml:"dnsPolicy,omitempty"`
    HostNetwork                   bool                     `json:"hostNetwork,omitempty" yaml:"hostNetwork,omitempty"`
}

PodSpec is a subset of v1.PodSpec which defines attributes we expose for charms to set.

func (PodSpec) IsEmpty Uses

func (ps PodSpec) IsEmpty() bool

IsEmpty checks if PodSpec is empty or not.

type PodSpecConverter Uses

type PodSpecConverter interface {
    Validate() error
    ToLatest() *specs.PodSpec
}

PodSpecConverter defines methods to validate and convert a specific version of podspec to latest version.

type RoleMetaGetter Uses

type RoleMetaGetter func(roleName, serviceAccountName string, index int) v1.ObjectMeta

RoleMetaGetter generates ObjectMeta for roles, cluster roles.

type Secret Uses

type Secret struct {
    Name        string            `json:"name" yaml:"name"`
    Type        core.SecretType   `json:"type" yaml:"type"`
    Annotations map[string]string `json:"annotations,omitempty"`
    Data        map[string]string `json:"data,omitempty" yaml:"data,omitempty"`
    StringData  map[string]string `json:"stringData,omitempty" yaml:"stringData,omitempty"`
}

Secret is a subset of v1.Secret which defines attributes we expose for charms to set.

type ServiceAccountMetaGetter Uses

type ServiceAccountMetaGetter func(rawName string) v1.ObjectMeta

ServiceAccountMetaGetter generates ObjectMeta for service accounts.

type YAMLOrJSONDecoder Uses

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

YAMLOrJSONDecoder attempts to decode a stream of JSON documents or YAML documents by sniffing for a leading { character.

func (*YAMLOrJSONDecoder) Decode Uses

func (d *YAMLOrJSONDecoder) Decode(into interface{}) error

Decode unmarshals the next object from the underlying stream into the provide object, or returns an error.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package specs imports 24 packages (graph) and is imported by 9 packages. Updated 2020-04-10. Refresh now. Tools for package owners.