Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daemonset dependency not working. #15

Closed
PiotrProkop opened this issue Jan 9, 2017 · 3 comments
Closed

Daemonset dependency not working. #15

PiotrProkop opened this issue Jan 9, 2017 · 3 comments
Labels

Comments

@PiotrProkop
Copy link
Collaborator

When running kubernetes-entrypoint in init-container daemoset dependency is returning nil *Daemonset pointer error.

@PiotrProkop PiotrProkop added the bug label Jan 9, 2017
@intlabs
Copy link

intlabs commented Jan 12, 2017

@PiotrProkop It would be really great to get this fixed, as several projects I'm involved in would like to be able to use this functionality. Have you managed to make any progress on this?

@mzylowski
Copy link
Contributor

mzylowski commented Jan 13, 2017

@intlabs
I tried to reproduce this problem and for us it work well.
Are you sure the 'POD_NAME' env is set correctly?

I wrote some simple pod manifests to test your problem:
Redis with init-container

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: redis
spec:
  template:
    metadata:
      labels:
        app: redis
      annotations:
        pod.beta.kubernetes.io/init-containers: '[
          {
            "name": "init",
            "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0",
            "imagePullPolicy": "IfNotPresent",
            "env": [
              {
                "name": "NAMESPACE",
                "value": "default"
              },
              {
                "name": "DEPENDENCY_DAEMONSET",
                "value": "ds2"
              },
              {
                "name": "POD_NAME",
                "value": "another-app-on-my-node"
              },
              {
                "name": "COMMAND",
                "value": "echo it_works"
              }              
            ]
          }
        ]'
    spec:
      containers:
        - name: redis
          image: redis
          imagePullPolicy: IfNotPresent

Simple daemon set for testing:

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: ds2
spec:
  template:
    metadata:
      name: ds2
      labels:
        daemon: prom-node-exp-d2
    spec:
      containers:
      - name: c
        image: prom/prometheus
        ports:
        - containerPort: 9090
          hostPort: 2020
          name: serverport

When I start my deployment with redis everything works fine and redis is waiting for ds2 daemonset. After running my ds2 all dependencies are resolved and my redis is started.

If we remove

               {
                "name": "POD_NAME",
                "value": "another-app-on-my-node"
              },

part from redis manifest, and start redis again:

kubectl logs -f redis-693104266-xnpzw -c init                                                                                                                                      
Entrypoint Error: 2017/01/13 11:26:15 daemonset.go:25: Cannot initialize daemonset: Env POD_NAME not set

goroutine 71 [running]:
panic(0x127b240, 0xc42040c000)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/stackanetes/kubernetes-entrypoint/dependencies/daemonset.(*Daemonset).GetName(0x0, 0x147b318, 0xc42048a010)
        <autogenerated>:2 +0xa4
github.com/stackanetes/kubernetes-entrypoint/entrypoint.Entrypoint.Resolve.func1(0xc42048a010, 0x1bd2f00, 0xc4200cff20, 0xc42000e0aa, 0x7, 0x1bc7b00, 0x0)
        /home/pprokop/gopath/src/github.com/stackanetes/kubernetes-entrypoint/entrypoint/entrypoint.go:61 +0x8b
created by github.com/stackanetes/kubernetes-entrypoint/entrypoint.Entrypoint.Resolve
        /home/pprokop/gopath/src/github.com/stackanetes/kubernetes-entrypoint/entrypoint/entrypoint.go:72 +0x102

I will prepare PR with README update and exception related with wrong POD_NAME.

@intlabs
Copy link

intlabs commented Jan 13, 2017

@mzylowski Thanks for this! We were not using POD_NAME in our charts for either Kolla-K8s or OpenStack-Helm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants