Shell-operator and addon-operator progress: hooks like admission webhooks, Helm 3, OpenAPI, Go hooks and much more

Shell-operator addon-operator — Open Source- «» Kubernetes, 2019 . K8s-: ( Bash, Python ..) , Kubernetes API. (addon-operator) — « », — Helm- , shell-operator’.





shell-operator v1.0.0-beta.11 ( ), KubeCon EU’2020, , . ( , - , shell-operator , .)





shell-operator, addon-operator , .





shell-operator v1.0.0-rc1

shell-operator ValidatingWebhookConfiguration



admission webhook. .. Kubernetes , - . : « repo.example.com». 204-validating-webhook. Shell-operator Kubernetes 1.16.





, ( shell- ):





function __config__(){
    cat <<EOF
configVersion: v1
kubernetesValidating:
- name: private-repo-policy.example.com
  namespace:
    labelSelector:
      matchLabels:
        # helm adds a 'name' label to a namespace it creates
        name: example-204
  rules:
  - apiGroups:   ["stable.example.com"]
    apiVersions: ["v1"]
    operations:  ["CREATE", "UPDATE"]
    resources:   ["crontabs"]
    scope:       "Namespaced"
EOF
}
      
      



, action



:





{"group":"group_name_1", "action":"expire"}
      
      



, , . .





shell-operator :





1.

  • . API-, .





  • .





  • read-only- , .





  • (. shell_operator_hook_run_sys_cpu_seconds



    METRICS).





2.

  • flant/shell-operator



    — AMD64, ARM ARM64 ( Raspberry Pi!).





  • shell-operator



    Linux-.





  • flant/shell-operator



    Bash, kubectl jq Alpine. , , Dockerfile .





  • .git



    , .





  • : Alpine 3.12, kubectl 1.19.4, Go 1.15.





  • jq , libjq*, jq-1.6 (#206).





* , libjq-go — Open Source-, CGO bindings jq. shell-operator, — Xbus. enterprise-, NATS. , Open Source , .





3.

  • (+x).





  • CGO. shell-operator , jqFilter



    .





  • shell_lib.sh



    , shell framework . KubeCon.





addon-operator

addon-operator , - .





OpenAPI values. values, Helm, config values, ConfigMap .





, values (project



clusterName



), ( clusterHostname



discovery



):





# /global/openapi/config-values.yaml

type: object
additionalProperties: false
required:
  - project
  - clusterName
minProperties: 2
properties:
  project:
    type: string
  clusterName:
    type: string
  clusterHostname:
    type: string
  discovery:
    type: object
      
      



— . .





Go. addon-operator, . 700-go-hooks.





Go :





package global_hooks

import "github.com/flant/addon-operator/sdk"

var _ = sdk.Register(&GoHook{})

type GoHook struct {
	sdk.CommonGoHook
}

func (h *GoHook) Metadata() sdk.HookMetadata {
	return h.CommonMetadataFromRuntime()
}

func (h *GoHook) Config() *sdk.HookConfig {
	return h.CommonGoHook.Config(&sdk.HookConfig{
		YamlConfig: `
configVersion: v1
onStartup: 10
`,
		MainHandler: h.Main,
	})
}

func (h *GoHook) Main(input *sdk.BindingInput) (*sdk.BindingOutput, error) {
	input.LogEntry.Infof("Start Global Go hook")
	return nil, nil
}
      
      







SDK - , — , — Tg- @kubeoperator.





addon-operator :





  • Helm 3.





  • «» « » — . endpoint readiness-: Pod addon-operator’ Ready, , .. « » .





  • , ( enabled- ).





  • Synchronization Kubernetes- , .





  • shell-operator’: Alpine , , ..





  • METRICS.





addon-operator shell-operator, . OpenAPI, v1.0.0-rc1.





shell-operator

shell-operator , . :





  • Confluent Kafka DevOps. « production-, streaming-, Apache Kafka Confluent Cloud». Kubernetes, . , (Confluent Cloud Operator Kafka Connect Operator) shell-operator. , , Kafka DevOps.





  • edukates shell-operator, ( ).





  • Docker Captain DNS- pod’ Traefik. shell-operator .





  • Solution Architect Red Hat r53-operator — « », Ingress AWS Route 53.





shell-operator, GitHub Discussions : , . addon-operator — , .





Shell-operator addon-operator . , . shell-operator — conversion webhook « », .. kubectl , shell-operator (. #94, #239).





beta, rc1, shell-operator v1.0.0.





P.S. shell-operator 1000 GitHub, addon-operator — 250. , !





P.P.S.

:





  • «Go? Bash! shell-operator ( KubeCon EU'2020)»;





  • « Kubernetes- shell-operator: »;





  • « Kubernetes- ? addon-operator»;





  • « Kubernetes ( )»;





  • « shell-operator: Kubernetes »;












All Articles