@@ -25,6 +25,7 @@ import (
2525 . "github.com/onsi/gomega"
2626 corev1 "k8s.io/api/core/v1"
2727 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+ "k8s.io/utils/ptr"
2829 "sigs.k8s.io/mcs-api/pkg/apis/v1alpha1"
2930)
3031
@@ -179,6 +180,38 @@ func testClusterIPServiceImport() {
179180 })
180181 })
181182
183+ Context ("" , func () {
184+ BeforeEach (func () {
185+ t .helloService .Spec .InternalTrafficPolicy = ptr .To (corev1 .ServiceInternalTrafficPolicyCluster )
186+ })
187+ Specify ("The InternalTrafficPolicy for a ClusterSetIP ServiceImport should match the exported service's InternalTrafficPolicy" ,
188+ Label (RequiredLabel ), func () {
189+ AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#internal-traffic-policy" )
190+
191+ t .awaitServiceImport (& clients [0 ], helloServiceName , false , func (g Gomega , serviceImport * v1alpha1.ServiceImport ) {
192+ g .Expect (serviceImport .Spec .InternalTrafficPolicy ).To (Equal (t .helloService .Spec .InternalTrafficPolicy ), reportNonConformant (
193+ "The InternalTrafficPolicy of the ServiceImport does not match the exported Service's InternalTrafficPolicy" ))
194+ })
195+ },
196+ )
197+ })
198+
199+ Context ("" , func () {
200+ BeforeEach (func () {
201+ t .helloService .Spec .TrafficDistribution = ptr .To (corev1 .ServiceTrafficDistributionPreferClose )
202+ })
203+ Specify ("The TrafficDistribution for a ClusterSetIP ServiceImport should match the exported service's TrafficDistribution" ,
204+ Label (RequiredLabel ), func () {
205+ AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#traffic-distribution" )
206+
207+ t .awaitServiceImport (& clients [0 ], helloServiceName , false , func (g Gomega , serviceImport * v1alpha1.ServiceImport ) {
208+ g .Expect (serviceImport .Spec .TrafficDistribution ).To (Equal (t .helloService .Spec .TrafficDistribution ), reportNonConformant (
209+ "The TrafficDistribution of the ServiceImport does not match the exported Service's TrafficDistribution" ))
210+ })
211+ },
212+ )
213+ })
214+
182215 Specify ("An IP should be allocated for a ClusterSetIP ServiceImport" , Label (RequiredLabel ), func () {
183216 AddReportEntry (SpecRefReportEntry , "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#clustersetip" )
184217
0 commit comments