ifitzpat / ob-kubectl

Org babel extension to apply kubectl to org babel source blocks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ob-kubectl

Org babel extension to apply kubectl to org babel source blocks.

Getting Started

Prerequisites

  • kubectl

Please refer to this page for more information on installing kubectl.

Installation

Recommended install via use-package and quelpa.

(use-package ob-kubectl
  :ensure-system-package kubectl
  :ensure t
  :defer t
  :quelpa ((ob-kubectl :fetcher github :repo "ifitzpat/ob-kubectl") :upgrade t)
  :config
  (add-to-list 'org-babel-load-languages '(kubectl . t))
  (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
)

Usage

Calling C-c C-c on kubectl source blocks calls kubectl apply -f on that block. To call delete instead use :action delete as a header arg. To specify a particular context use :context your-context.

#+begin_src kubectl :action delete :context microk8s
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: autoscale-go
  namespace: default
spec:
  template:
    metadata:
      annotations:
        # Knative concurrency-based autoscaling (default).
        autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
        autoscaling.knative.dev/metric: concurrency
        # Target 10 requests in-flight per pod.
        autoscaling.knative.dev/target: "10"
        # Disable scale to zero with a minScale of 1.
        autoscaling.knative.dev/minScale: "1"
        # Limit scaling to 100 pods.
        autoscaling.knative.dev/maxScale: "100"
    spec:
      containers:
        - image: gcr.io/knative-samples/autoscale-go:0.1
 #+end_src

Example derived from: https://knative.dev/docs/serving/samples/autoscale-go/index.html

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are extremely appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m ‘Add some AmazingFeature’)
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPLv3. See LICENSE for more information.

Contact

Dr. Ian FitzPatrick - @ifitzpat - ian@ianfitzpatrick.eu

Project Link: https://github.com/fitzpat/ob-kubectl

Acknowledgements

About

Org babel extension to apply kubectl to org babel source blocks.

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%