@@ -1886,5 +1886,123 @@ var _ = ginkgo.Describe("Provisioning with scheduling", ginkgo.Ordered, ginkgo.C
18861886 }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
18871887 })
18881888 })
1889+
1890+ ginkgo .It ("Should be successfully re-admitted on another flavor with a decimal memory request" , func () {
1891+ ginkgo .By ("Set up ClusterQueue and LocalQueue" , func () {
1892+ cq = utiltestingapi .MakeClusterQueue ("cluster-queue" ).
1893+ Preemption (kueue.ClusterQueuePreemption {
1894+ WithinClusterQueue : kueue .PreemptionPolicyLowerPriority ,
1895+ }).
1896+ ResourceGroup (
1897+ * utiltestingapi .MakeFlavorQuotas (rf1 .Name ).
1898+ Resource (corev1 .ResourceCPU , "0.75" ).
1899+ Resource (corev1 .ResourceMemory , "5G" ).
1900+ Obj (),
1901+ * utiltestingapi .MakeFlavorQuotas (rf2 .Name ).
1902+ Resource (corev1 .ResourceCPU , "0.5" ).
1903+ Resource (corev1 .ResourceMemory , "5G" ).
1904+ Obj (),
1905+ ).
1906+ AdmissionCheckStrategy (kueue.AdmissionCheckStrategyRule {
1907+ Name : ac1Ref ,
1908+ OnFlavors : []kueue.ResourceFlavorReference {flavor1Ref },
1909+ }).
1910+ Obj ()
1911+ util .MustCreate (ctx , k8sClient , cq )
1912+ util .ExpectClusterQueuesToBeActive (ctx , k8sClient , cq )
1913+
1914+ lq = utiltestingapi .MakeLocalQueue ("queue" , ns .Name ).ClusterQueue (cq .Name ).Obj ()
1915+ util .MustCreate (ctx , k8sClient , lq )
1916+ util .ExpectLocalQueuesToBeActive (ctx , k8sClient , lq )
1917+ })
1918+
1919+ ginkgo .By ("submit the Job" , func () {
1920+ job1 := testingjob .MakeJob ("job1" , ns .Name ).
1921+ Queue (kueue .LocalQueueName (lq .Name )).
1922+ Request (corev1 .ResourceCPU , "500m" ).
1923+ Request (corev1 .ResourceMemory , "220M" ).
1924+ Obj ()
1925+ util .MustCreate (ctx , k8sClient , job1 )
1926+ ginkgo .DeferCleanup (func () {
1927+ util .ExpectObjectToBeDeleted (ctx , k8sClient , job1 , true )
1928+ })
1929+ wl1Key = types.NamespacedName {Name : workloadjob .GetWorkloadNameForJob (job1 .Name , job1 .UID ), Namespace : ns .Name }
1930+ })
1931+
1932+ ginkgo .By ("await for wl1 to be created" , func () {
1933+ gomega .Eventually (func (g gomega.Gomega ) {
1934+ g .Expect (k8sClient .Get (ctx , wl1Key , & wlObj )).Should (gomega .Succeed ())
1935+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
1936+ })
1937+
1938+ ginkgo .By ("await for wl1 to have QuotaReserved on flavor-1" , func () {
1939+ gomega .Eventually (func (g gomega.Gomega ) {
1940+ gomega .Expect (k8sClient .Get (ctx , wl1Key , & wlObj )).Should (gomega .Succeed ())
1941+ g .Expect (workload .Status (& wlObj )).To (gomega .Equal (workload .StatusQuotaReserved ))
1942+ psa := wlObj .Status .Admission .PodSetAssignments
1943+ g .Expect (psa ).Should (gomega .HaveLen (1 ))
1944+ g .Expect (psa [0 ].Flavors ).To (gomega .Equal (map [corev1.ResourceName ]kueue.ResourceFlavorReference {
1945+ corev1 .ResourceCPU : flavor1Ref ,
1946+ corev1 .ResourceMemory : flavor1Ref ,
1947+ }))
1948+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
1949+ })
1950+
1951+ ginkgo .By ("await for the ProvisioningRequest on flavor-1 to be created" , func () {
1952+ provReqKey = types.NamespacedName {
1953+ Namespace : wl1Key .Namespace ,
1954+ Name : provisioning .ProvisioningRequestName (wl1Key .Name , ac1Ref , 1 ),
1955+ }
1956+
1957+ gomega .Eventually (func (g gomega.Gomega ) {
1958+ g .Expect (k8sClient .Get (ctx , provReqKey , & createdRequest )).Should (gomega .Succeed ())
1959+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
1960+ })
1961+
1962+ ginkgo .By ("set the ProvisioningRequest on flavor-1 as Provisioned" , func () {
1963+ gomega .Eventually (func (g gomega.Gomega ) {
1964+ g .Expect (k8sClient .Get (ctx , provReqKey , & createdRequest )).Should (gomega .Succeed ())
1965+ apimeta .SetStatusCondition (& createdRequest .Status .Conditions , metav1.Condition {
1966+ Type : autoscaling .Provisioned ,
1967+ Status : metav1 .ConditionTrue ,
1968+ Reason : autoscaling .Provisioned ,
1969+ })
1970+ g .Expect (k8sClient .Status ().Update (ctx , & createdRequest )).Should (gomega .Succeed ())
1971+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
1972+ })
1973+
1974+ ginkgo .By ("await for wl1 to be Admitted" , func () {
1975+ gomega .Eventually (func (g gomega.Gomega ) {
1976+ gomega .Expect (k8sClient .Get (ctx , wl1Key , & wlObj )).Should (gomega .Succeed ())
1977+ g .Expect (workload .Status (& wlObj )).To (gomega .Equal (workload .StatusAdmitted ))
1978+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
1979+ })
1980+
1981+ ginkgo .By ("submit a high-priority job2" , func () {
1982+ job2 := testingjob .MakeJob ("job2" , ns .Name ).
1983+ Queue (kueue .LocalQueueName (lq .Name )).
1984+ WorkloadPriorityClass (priorityClassName ).
1985+ Request (corev1 .ResourceCPU , "750m" ).
1986+ Obj ()
1987+ util .MustCreate (ctx , k8sClient , job2 )
1988+ ginkgo .DeferCleanup (func () {
1989+ util .ExpectObjectToBeDeleted (ctx , k8sClient , job2 , true )
1990+ })
1991+ wl2Key = types.NamespacedName {Name : workloadjob .GetWorkloadNameForJob (job2 .Name , job2 .UID ), Namespace : ns .Name }
1992+ })
1993+
1994+ ginkgo .By ("await for wl1 to be Admitted on flavor-2" , func () {
1995+ gomega .Eventually (func (g gomega.Gomega ) {
1996+ gomega .Expect (k8sClient .Get (ctx , wl1Key , & wlObj )).Should (gomega .Succeed ())
1997+ g .Expect (workload .Status (& wlObj )).To (gomega .Equal (workload .StatusAdmitted ))
1998+ psa := wlObj .Status .Admission .PodSetAssignments
1999+ g .Expect (psa ).Should (gomega .HaveLen (1 ))
2000+ g .Expect (psa [0 ].Flavors ).To (gomega .Equal (map [corev1.ResourceName ]kueue.ResourceFlavorReference {
2001+ corev1 .ResourceCPU : flavor2Ref ,
2002+ corev1 .ResourceMemory : flavor2Ref ,
2003+ }))
2004+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
2005+ })
2006+ })
18892007 })
18902008})
0 commit comments