mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-11 15:23:49 +00:00
⚡ Apply the same Kubernetes tolerations to all pods
This commit is contained in:
parent
01b187aaa3
commit
60cfa92efb
@ -281,17 +281,8 @@ func (provider *Provider) BuildHubPod(opts *PodOptions) (*core.Pod, error) {
|
|||||||
Containers: containers,
|
Containers: containers,
|
||||||
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
||||||
TerminationGracePeriodSeconds: new(int64),
|
TerminationGracePeriodSeconds: new(int64),
|
||||||
Tolerations: []core.Toleration{
|
Tolerations: provider.BuildTolerations(),
|
||||||
{
|
ImagePullSecrets: opts.ImagePullSecrets,
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoExecute,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoSchedule,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ImagePullSecrets: opts.ImagePullSecrets,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,17 +382,8 @@ func (provider *Provider) BuildFrontPod(opts *PodOptions, hubHost string, hubPor
|
|||||||
Volumes: volumes,
|
Volumes: volumes,
|
||||||
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
||||||
TerminationGracePeriodSeconds: new(int64),
|
TerminationGracePeriodSeconds: new(int64),
|
||||||
Tolerations: []core.Toleration{
|
Tolerations: provider.BuildTolerations(),
|
||||||
{
|
ImagePullSecrets: opts.ImagePullSecrets,
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoExecute,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoSchedule,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ImagePullSecrets: opts.ImagePullSecrets,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,20 +887,6 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tolerations
|
|
||||||
tolerations := []core.Toleration{
|
|
||||||
{
|
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoExecute,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if !config.Config.Tap.IgnoreTainted {
|
|
||||||
tolerations = append(tolerations, core.Toleration{
|
|
||||||
Operator: core.TolerationOpExists,
|
|
||||||
Effect: core.TaintEffectNoSchedule,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pod
|
// Pod
|
||||||
pod := DaemonSetPod{
|
pod := DaemonSetPod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -939,7 +907,7 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
|||||||
},
|
},
|
||||||
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
||||||
TerminationGracePeriodSeconds: new(int64),
|
TerminationGracePeriodSeconds: new(int64),
|
||||||
Tolerations: tolerations,
|
Tolerations: provider.BuildTolerations(),
|
||||||
ImagePullSecrets: imagePullSecrets,
|
ImagePullSecrets: imagePullSecrets,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -977,6 +945,24 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (provider *Provider) BuildTolerations() []core.Toleration {
|
||||||
|
tolerations := []core.Toleration{
|
||||||
|
{
|
||||||
|
Operator: core.TolerationOpExists,
|
||||||
|
Effect: core.TaintEffectNoExecute,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if !config.Config.Tap.IgnoreTainted {
|
||||||
|
tolerations = append(tolerations, core.Toleration{
|
||||||
|
Operator: core.TolerationOpExists,
|
||||||
|
Effect: core.TaintEffectNoSchedule,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return tolerations
|
||||||
|
}
|
||||||
|
|
||||||
func (provider *Provider) CreatePersistentVolumeClaim(ctx context.Context, namespace string, persistentVolumeClaim *core.PersistentVolumeClaim) (*core.PersistentVolumeClaim, error) {
|
func (provider *Provider) CreatePersistentVolumeClaim(ctx context.Context, namespace string, persistentVolumeClaim *core.PersistentVolumeClaim) (*core.PersistentVolumeClaim, error) {
|
||||||
return provider.clientSet.CoreV1().PersistentVolumeClaims(namespace).Create(ctx, persistentVolumeClaim, metav1.CreateOptions{})
|
return provider.clientSet.CoreV1().PersistentVolumeClaims(namespace).Create(ctx, persistentVolumeClaim, metav1.CreateOptions{})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user