Socket
Book a DemoInstallSign in
Socket

knop

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knop

Kubernetes operators made easy

0.2.0
latest
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Knop, Kubernetes Nodejs OPerators made easy

Getting started

# install cli
npm install -g knop-cli

# or using knop-cli with npx
npx -p knop-cli knop

# create an operator projet into my-operator directory (package name)
npx -p knop-cli knop new operator --name MyOperator

# add a controlled crd (api)
npx -p knop-cli knop new api --api-version svc.docaposte.cloud/v1alpha1 --kind Elasticsearch

# add the corresponding crd controller (api)
npx -p knop-cli knop new crd-controller --api-version svc.docaposte.cloud/v1alpha1 --kind Elasticsearch

# run operator in dev mode
npm run dev

Development

Scripts

  • npm run dev : start operator locally (uses ~/.kube/config for connecting to cluster)
  • npm run dk:build : Build docker operator image
  • npm run clean : remove artifacts (coverage, tmp, compiled files)
  • npm run test : run tests (jest)
  • npm run test:watch : run tests with watching
  • npm run lint : check code with eslint
  • npm run build : build (compile) operator sources files
  • npm run build:watch : build with watching

Generators

Operator

Generate a new node project for an operator

knop new operator --name "MyOperator"

only name is required.

parametervalue
nameHumanized operator name, (underscore + dash for package name)
orgNameHumanized Organization name
orgnpm organization
repogit repository
dockerRepodocker repository

Api (CRD)

Generate a new CRD (yaml files & types)

knop new api --api-version svc.docaposte.cloud/v1alpha1 --kind Elasticsearch

api-version & kind are required

parametervalue
api-versionkubernetes api version with group (ex svc.docaposte.cloud/v1alpha1)
kindkubernetes kind

CRD Controller

Generate a new CRD Controller, handle CR create/update/delete with deduplication (dosent fire if CR doesn't change)

knop new crd-controller --api-version svc.docaposte.cloud/v1alpha1 --kind Elasticsearch

api-version & kind are required (refers to managed CRD)

parametervalue
api-versionkubernetes api version with group (ex svc.docaposte.cloud/v1alpha1)
kindkubernetes kind

Deployment

# In a generated application (with at least an API)
# Register CRDs first
kubectl apply -f ./deploy/crds/*_crd.yaml

# Deploy operator (need docker image)
kubectl apply -f ./deploy/*.yaml

Operator runtime Env options

VariableDefaultInfo
NODE_ENVnull
LOGGER_LEVELinfosee pino level
LAST_CONFIG_ANNOTATIONknop.skimia.org/last-applied-configurationannotation used in resource for storing changes
WATCH_NAMESPACEnullWhen deployed it take the namespace of pod
REGISTER_CRD0Unused now, create CRD in kubernetes at startup (update if exists)

FAQs

Package last updated on 05 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.