poddisruptionbudgettrait

command module
v0.0.0-...-9421b25 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

PodDisruptionBudgetTrait

Use Cron expressions to periodically scale your workload.

Supported workloads:

  • ContainerizedWorkload
  • Deployment
  • StatefulSet
  • ReplicaSet

Prerequisites

Please follow common prerequisites to install OAM Controllers.

Getting started

  • Get the PodDisruptionBudgetTrait project
git clone https://github.com/oam-dev/catalog.git
  • Install CRD to your Kubernetes cluster
cd catalog/traits/poddisruptionbudgettrait/

make install
  • Run the PodDisruptionBudgetTrait controller
make run
ContainerizedWorkload
  • Apply the sample ContainerizedWorkload
kubectl apply -f config/samples/containerized
# ./config/samples/contaierized/sample_application_config.yaml

  ...
      traits:
        - trait:
            apiVersion: core.oam.dev/v1alpha2
            kind: PodDisruptionBudgetTrait
            metadata:
              name: example-pdb-trait
            spec:
              minAvailable: 1 # or 30%
              # maxUnavailable: 1 or 30%
  • Verify PodDisruptionBudgetTrait you should see a deployment created by ContainerizedWorkload
kubectl get deployment
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
example-component   1/1     1            1           3s
  • And a PodDisruptionBudgetTrait created
kubectl get pdbtrait
NAME                MINAVAILABLE   MAXUNAVAILABLE   SYNCED   APPLICATIONCONFIGURATION   PODDISRUPTIONBUDGET   AGE
example-pdb-trait   1                               True     example-appconfig          example-pdb-trait     3s
  • And a PodDisruptionBudget automatically created by PodDisruptionBudgetTrait controller
kubectl get pdb
NAME                MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
example-pdb-trait   1               N/A               0                     3s

How it work?

Essentially, the PodDisruptionBudgetTrait controller will generate PodDisruptionBudget based on the workload spec.

In detail:

  • If the workload type is ContainerizedWorkload which has two child resources (Deployment and Service), PodDisruptionBudgetTrait can help to create corresponding PodDisruptionBudget.
  • If the workload type is K8S native resources (StatefulSet or Deployment), PodDisruptionBudgetTrait can help to create a PodDisruptionBudget.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha2
Package v1alpha2 contains API Schema definitions for the core v1alpha2 API group +kubebuilder:object:generate=true +groupName=core.oam.dev
Package v1alpha2 contains API Schema definitions for the core v1alpha2 API group +kubebuilder:object:generate=true +groupName=core.oam.dev

Jump to

Keyboard shortcuts

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