Document and/or add warning for sidecar configs with the same name
Closed this issue · 0 comments
kasia-kujawa commented
Document and/or add warning for sidecar configs with the same name, related to #51 (comment)
Currently when 2 sidecar configs have the same name then the second config overwrites the first.
E.g.
TailingSidecar
apiVersion: tailing-sidecar.sumologic.com/v1
kind: TailingSidecar
metadata:
name: tailingsidecar-sample
spec:
configs:
sidecarconfig:
volume: varlogconfig
file: /varconfig/log/example1.log
sidecarconfig:
volume: varlogconfig
file: /varconfig/log/example2.log
Pod:
apiVersion: v1
kind: Pod
metadata:
name: pod-with-annotations
namespace: tailing-sidecar-system
annotations:
tailing-sidecar: sidecarconfig
labels:
app: pod-with-annotations
spec:
containers:
- name: count
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo "example0: $i $(date)" >> /var/log/example0.log;
echo "example1: $i $(date)" >> /var/log/example1.log;
echo "example2: $i $(date)" >> /varconfig/log/example2.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlogconfig
mountPath: /varconfig/log
volumes:
- name: varlog
emptyDir: {}
- name: varlogconfig
emptyDir: {}
Created Pod by operator:
$ kubectl describe pod pod-with-annotations -n tailing-sidecar-system
Name: pod-with-annotations
Namespace: tailing-sidecar-system
Priority: 0
Node: sumologic-tailing-sidecar/10.0.2.15
Start Time: Mon, 15 Mar 2021 14:32:31 +0000
Labels: app=pod-with-annotations
Annotations: cni.projectcalico.org/podIP: 10.1.37.83/32
cni.projectcalico.org/podIPs: 10.1.37.83/32
tailing-sidecar: sidecarconfig
Status: Running
IP: 10.1.37.83
IPs:
IP: 10.1.37.83
Containers:
count:
Container ID: containerd://1b56d9f4198a8f0ab365a2cda8454598301e1422b9a8c102edbc14bba6ba512e
Image: busybox
Image ID: docker.io/library/busybox@sha256:ce2360d5189a033012fbad1635e037be86f23b65cfd676b436d0931af390a2ac
Port: <none>
Host Port: <none>
Args:
/bin/sh
-c
i=0; while true; do
echo "example0: $i $(date)" >> /var/log/example0.log;
echo "example1: $i $(date)" >> /var/log/example1.log;
echo "example2: $i $(date)" >> /varconfig/log/example2.log;
i=$((i+1));
sleep 1;
done
State: Running
Started: Mon, 15 Mar 2021 14:32:33 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/log from varlog (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-smcv9 (ro)
/varconfig/log from varlogconfig (rw)
tailing-sidecar0:
Container ID: containerd://6ab75471db047be85bf86353a292ca51a2093fe654f1e6dd92aa6bcce7acad3f
Image: localhost:32000/sumologic/tailing-sidecar:demo
Image ID: localhost:32000/sumologic/tailing-sidecar@sha256:0ed3d789b7e9a23a61cba26d394af02505fc2d25a96fdd85f03cd4bf2b3ca53a
Port: <none>
Host Port: <none>
State: Running
Started: Mon, 15 Mar 2021 14:32:34 +0000
Ready: True
Restart Count: 0
Environment:
PATH_TO_TAIL: /varconfig/log/example2.log
TAILING_SIDECAR: true
Mounts:
/tailing-sidecar/var from volume-sidecar0 (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-smcv9 (ro)
/varconfig/log from varlogconfig (rw)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
varlog:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
varlogconfig:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
default-token-smcv9:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-smcv9
Optional: false
volume-sidecar0:
Type: HostPath (bare host directory volume)
Path: /var/log/tailing-sidecar-fluentbit/tailing-sidecar-system/pod-with-annotations/tailing-sidecar0
HostPathType: DirectoryOrCreate
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m15s default-scheduler Successfully assigned tailing-sidecar-system/pod-with-annotations to sumologic-tailing-sidecar
Normal Pulling 7m14s kubelet Pulling image "busybox"
Normal Pulled 7m13s kubelet Successfully pulled image "busybox" in 1.373490106s
Normal Created 7m13s kubelet Created container count
Normal Started 7m13s kubelet Started container count
Normal Pulled 7m13s kubelet Container image "localhost:32000/sumologic/tailing-sidecar:demo" already present on machine
Normal Created 7m13s kubelet Created container tailing-sidecar0
Normal Started 7m12s kubelet Started container tailing-sidecar0