mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #42266 from wojtek-t/fix_secret_tests_in_large_clusters
Automatic merge from submit-queue (batch tested with PRs 41306, 42187, 41666, 42275, 42266) Bump test timeouts to make secret tests work in large clusters
This commit is contained in:
commit
a2c7eb2754
@ -172,13 +172,24 @@ var _ = framework.KubeDescribe("Projected", func() {
|
|||||||
|
|
||||||
It("optional updates should be reflected in volume [Conformance] [Volume]", func() {
|
It("optional updates should be reflected in volume [Conformance] [Volume]", func() {
|
||||||
|
|
||||||
// We may have to wait or a full sync period to elapse before the
|
// With SecretManager, we may have to wait up to full sync period + TTL of
|
||||||
// Kubelet projects the update into the volume and the container picks
|
// a secret to elapse before the Kubelet projects the update into the volume
|
||||||
// it up. This timeout is based on the default Kubelet sync period (1
|
// and the container picks it ip.
|
||||||
// minute) plus additional time for fudge factor.
|
// This timeout is based on default Kubelet sync period (1 minute) plus
|
||||||
const podLogTimeout = 300 * time.Second
|
// maximum secret TTL (based on cluster size) plus additional time for fudge
|
||||||
trueVal := true
|
// factor.
|
||||||
|
nodes, err := f.ClientSet.Core().Nodes().List(metav1.ListOptions{})
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
// Since TTL the kubelet is using are stored in node object, for the timeout
|
||||||
|
// purpose we take it from a first node (all of them should be the same).
|
||||||
|
// We take the TTL from the first node.
|
||||||
|
secretTTL, exists := framework.GetTTLAnnotationFromNode(&nodes.Items[0])
|
||||||
|
if !exists {
|
||||||
|
framework.Logf("Couldn't get ttl annotation from: %#v", nodes.Items[0])
|
||||||
|
}
|
||||||
|
podLogTimeout := 240*time.Second + secretTTL
|
||||||
|
|
||||||
|
trueVal := true
|
||||||
volumeMountPath := "/etc/projected-secret-volumes"
|
volumeMountPath := "/etc/projected-secret-volumes"
|
||||||
|
|
||||||
deleteName := "s-test-opt-del-" + string(uuid.NewUUID())
|
deleteName := "s-test-opt-del-" + string(uuid.NewUUID())
|
||||||
@ -221,7 +232,6 @@ var _ = framework.KubeDescribe("Projected", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
|
By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
|
||||||
var err error
|
|
||||||
if deleteSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
|
if deleteSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
|
||||||
framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
|
framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
|
||||||
}
|
}
|
||||||
|
@ -155,13 +155,24 @@ var _ = framework.KubeDescribe("Secrets", func() {
|
|||||||
|
|
||||||
It("optional updates should be reflected in volume [Conformance] [Volume]", func() {
|
It("optional updates should be reflected in volume [Conformance] [Volume]", func() {
|
||||||
|
|
||||||
// We may have to wait or a full sync period to elapse before the
|
// With SecretManager, we may have to wait up to full sync period + TTL of
|
||||||
// Kubelet projects the update into the volume and the container picks
|
// a secret to elapse before the Kubelet projects the update into the volume
|
||||||
// it up. This timeout is based on the default Kubelet sync period (1
|
// and the container picks it ip.
|
||||||
// minute) plus additional time for fudge factor.
|
// This timeout is based on default Kubelet sync period (1 minute) plus
|
||||||
const podLogTimeout = 300 * time.Second
|
// maximum secret TTL (based on cluster size) plus additional time for fudge
|
||||||
trueVal := true
|
// factor.
|
||||||
|
nodes, err := f.ClientSet.Core().Nodes().List(metav1.ListOptions{})
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
// Since TTL the kubelet is using are stored in node object, for the timeout
|
||||||
|
// purpose we take it from a first node (all of them should be the same).
|
||||||
|
// We take the TTL from the first node.
|
||||||
|
secretTTL, exists := framework.GetTTLAnnotationFromNode(&nodes.Items[0])
|
||||||
|
if !exists {
|
||||||
|
framework.Logf("Couldn't get ttl annotation from: %#v", nodes.Items[0])
|
||||||
|
}
|
||||||
|
podLogTimeout := 240*time.Second + secretTTL
|
||||||
|
|
||||||
|
trueVal := true
|
||||||
volumeMountPath := "/etc/secret-volumes"
|
volumeMountPath := "/etc/secret-volumes"
|
||||||
|
|
||||||
deleteName := "s-test-opt-del-" + string(uuid.NewUUID())
|
deleteName := "s-test-opt-del-" + string(uuid.NewUUID())
|
||||||
@ -204,7 +215,6 @@ var _ = framework.KubeDescribe("Secrets", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
|
By(fmt.Sprintf("Creating secret with name %s", deleteSecret.Name))
|
||||||
var err error
|
|
||||||
if deleteSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
|
if deleteSecret, err = f.ClientSet.Core().Secrets(f.Namespace.Name).Create(deleteSecret); err != nil {
|
||||||
framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
|
framework.Failf("unable to create test secret %s: %v", deleteSecret.Name, err)
|
||||||
}
|
}
|
||||||
|
@ -2527,6 +2527,22 @@ func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) er
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetTTLAnnotationFromNode(node *v1.Node) (time.Duration, bool) {
|
||||||
|
if node.Annotations == nil {
|
||||||
|
return time.Duration(0), false
|
||||||
|
}
|
||||||
|
value, ok := node.Annotations[v1.ObjectTTLAnnotationKey]
|
||||||
|
if !ok {
|
||||||
|
return time.Duration(0), false
|
||||||
|
}
|
||||||
|
intValue, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
Logf("Cannot convert TTL annotation from %#v to int", *node)
|
||||||
|
return time.Duration(0), false
|
||||||
|
}
|
||||||
|
return time.Duration(intValue) * time.Second, true
|
||||||
|
}
|
||||||
|
|
||||||
func AddOrUpdateLabelOnNode(c clientset.Interface, nodeName string, labelKey, labelValue string) {
|
func AddOrUpdateLabelOnNode(c clientset.Interface, nodeName string, labelKey, labelValue string) {
|
||||||
ExpectNoError(testutils.AddLabelsToNode(c, nodeName, map[string]string{labelKey: labelValue}))
|
ExpectNoError(testutils.AddLabelsToNode(c, nodeName, map[string]string{labelKey: labelValue}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user