Git Product home page Git Product logo

kube-annotate's People

Contributors

akhy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kube-annotate's Issues

Update proposal (still maintained?)

Hello.

I'm looking for something like this project to annotate arbitrary objects, using label selectors and jsonpath matchers.

My first use-case is to add some annotations to Ingress objects only if they match a specific host.
I believe the config would be something like this:

# config.yaml
- apiVersion: networking.k8s.io/v1
  kind: Ingress
  namespaceSelector:
    team: web
  selector:
    app: frontend
  annotations:
    haproxy.router.openshift.io/response-header.X-Robots-Tag: "noindex, nofollow"
  matches:
  - '$.spec.rules[?(@.host=="www.example.com")]'
- ...

Is it something you are willing to accept a PR? If not, please let me known and I'll fork it to (try) to implement it myself (not a golang programer though).

Best,
Mateus

error MutatingWebhookConfiguration

I trying to add a annotation when a pod is created to allow cluster autoscaler delete an instance manager, but looks like I'm missing something.

webhook:

apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  name: kube-annotate
  labels:
    app: kube-annotate
webhooks:
  - name: kube-annotate.example.com
    clientConfig:
      service:
        name: kube-annotate
        namespace: kube-annotate # NOTE: replace this with namespace where you deploy `kube-annotate`
        path: "/mutate"
      caBundle: <removed>
    rules:
      - operations: [ "CREATE" ]
        apiGroups: [""]
        apiVersions: ["v1"]
        resources: ["pods"]
    namespaceSelector:
      matchLabels:
        kube-annotate: 'enabled'

deployment:

`      - name: kube-annotate         
        image: docker.io/chickenzord/kube-annotate:latest
        imagePullPolicy: Always
        env:
        - name: TLS_ENABLED
          value: 'true'
        - name: TLS_CRT
          value: /var/run/secrets/tls/tlscert
        - name: TLS_KEY
          value: /var/run/secrets/tls/tlskey
        - name: RULES_FILE
          value: /etc/kube-annotate/rules.yaml
        - name: LOG_FORMAT
          value: json
        - name: LOG_LEVEL
          value: debug
`

config map:

`cat configmap.yaml 
apiVersion: v1
data:
  rules.yaml: |
    - selector:
        longhorn.io/component: instance-manager
      annotations:
        cluster-autoscaler.kubernetes.io/safe-to-evict: true
kind: ConfigMap
metadata:
  labels:
    app: kube-annotate
  name: kube-annotate-config
  namespace: kube-annotate
`

Error:

`kubectl logs -lapp=kube-annotate -n kube-annotate  -f
github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni.middleware.ServeHTTP(0xe0bd80, 0xc00024ac60, 0xc0002554e0, 0x7fbed03e2020, 0xc00014e058, 0xc000332600)
        /go/src/github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni/negroni.go:38 +0x9c
github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni.(*Negroni).ServeHTTP(0xc00024da10, 0xe18ea0, 0xc00031c380, 0xc000332600)
        /go/src/github.com/chickenzord/kube-annotate/vendor/github.com/urfave/negroni/negroni.go:96 +0xee
net/http.serverHandler.ServeHTTP(0xc00026ab60, 0xe18ea0, 0xc00031c380, 0xc000332600)
        /usr/local/go/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc00032c140, 0xe19ba0, 0xc000262680)
        /usr/local/go/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2851 +0x2f5
{"level":"info","msg":"starting kube-annotate version 0.3.4 (7291937)","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"loaded 1 rule(s) from /etc/kube-annotate/rules.yaml","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"internal server is listening on :8081","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"API server is listening on :8443","time":"2021-04-09T18:42:48Z"}
{"level":"debug","msg":"API server TLS is enabled","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"starting kube-annotate version 0.3.4 (7291937)","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"loaded 1 rule(s) from /etc/kube-annotate/rules.yaml","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"internal server is listening on :8081","time":"2021-04-09T18:42:48Z"}
{"level":"info","msg":"API server is listening on :8443","time":"2021-04-09T18:42:48Z"}
{"level":"debug","msg":"API server TLS is enabled","time":"2021-04-09T18:42:48Z"}
`

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.