Skip to content

Commit

Permalink
Starts scripting, but the API call gets 403 for anonymous user
Browse files Browse the repository at this point in the history
  • Loading branch information
solsson committed Aug 1, 2017
1 parent b7f95d2 commit e919456
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 10broker-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ data:
export KAFKA_BROKER_ID=${HOSTNAME##*-}
sed -i "s/\${KAFKA_BROKER_ID}/$KAFKA_BROKER_ID/" /etc/kafka/server.properties
PODNAME=$HOSTNAME
NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
# todo add curl to kafka image, switch to a curl image for init or write the whole lookup in java
hash curl 2>/dev/null || { apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install curl -y --no-install-recommends; }
API=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api
AUTH="--cacert /run/secrets/kubernetes.io/serviceaccount/ca.crt --header \"Authorization: Bearer $(cat /run/secrets/kubernetes.io/serviceaccount/token)\""
curl -s $AUTH $API/namespaces/kafka/pods/$PODNAME -I --fail-early || {
echo "Access problems. Could be RBAC."
}
server.properties: |-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand Down

0 comments on commit e919456

Please sign in to comment.