func (j *TestJig) Scale(replicas int) error {
	rc := j.Name
	scale, err := j.Client.CoreV1().ReplicationControllers(j.Namespace).GetScale(context.TODO(), rc, metav1.GetOptions{})
	if err != nil {
		return fmt.Errorf("failed to get scale for RC %q: %v", rc, err)
	}

	scale.ResourceVersion = "" // indicate the scale update should be unconditional
	scale.Spec.Replicas = int32(replicas)
	_, err = j.Client.CoreV1().ReplicationControllers(j.Namespace).UpdateScale(context.TODO(), rc, scale, metav1.UpdateOptions{})
	if err != nil {
		return fmt.Errorf("failed to scale RC %q: %v", rc, err)
	}
	pods, err := j.waitForPodsCreated(replicas)
	if err != nil {
		return fmt.Errorf("failed waiting for pods: %v", err)
	}
	if err := j.waitForPodsReady(pods); err != nil {
		return fmt.Errorf("failed waiting for pods to be running: %v", err)
	}
	return nil
}
// Scale scales pods to the given replicas
Scale scales pods to the given replicas
// Scale scales pods to the given replicas
func (j *TestJig) Scale(replicas int) error {
	rc := j.Name
	scale, err := j.Client.CoreV1().ReplicationControllers(j.Namespace).GetScale(context.TODO(), rc, metav1.GetOptions{})
	if err != nil {
		return fmt.Errorf("failed to get scale for RC %q: %v", rc, err)
	}
	scale.ResourceVersion = "" 
	scale.Spec.Replicas = int32(replicas)
	_, err = j.Client.CoreV1().ReplicationControllers(j.Namespace).UpdateScale(context.TODO(), rc, scale, metav1.UpdateOptions{})
	if err != nil {
		return fmt.Errorf("failed to scale RC %q: %v", rc, err)
	}
	pods, err := j.waitForPodsCreated(replicas)
	if err != nil {
		return fmt.Errorf("failed waiting for pods: %v", err)
	}
	if err := j.waitForPodsReady(pods); err != nil {
		return fmt.Errorf("failed waiting for pods to be running: %v", err)
	}
	return nil
}
func ( j * TestJig ) Scale ( replicas int ) error { rc := j . Name scale , err := j . Client . CoreV1 ( ) . ReplicationControllers ( j . Namespace ) . GetScale ( context . TODO ( ) , rc , metav1 . GetOptions { } ) if err != nil { return fmt . Errorf ( " " , rc , err ) } scale . ResourceVersion = " " scale . Spec . Replicas = int32 ( replicas ) _ , err = j . Client . CoreV1 ( ) . ReplicationControllers ( j . Namespace ) . UpdateScale ( context . TODO ( ) , rc , scale , metav1 . UpdateOptions { } ) if err != nil { return fmt . Errorf ( " " , rc , err ) } pods , err := j . waitForPodsCreated ( replicas ) if err != nil { return fmt . Errorf ( " " , err ) } if err := j . waitForPodsReady ( pods ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
Scale scales pods to the given replicas
Scale scales pods to the given replicas
// indicate the scale update should be unconditional