@@ -1609,6 +1609,82 @@ var _ = Describe("ClusterServiceVersion", func() {
1609
1609
Expect (err ).ShouldNot (HaveOccurred (), "error updating APIService" )
1610
1610
<- deleted
1611
1611
})
1612
+ It ("CSV annotations overwrite pod template annotations defined in a StrategyDetailsDeployment" , func () {
1613
+ // Create a StrategyDetailsDeployment that defines the `foo1` and `foo2` annotations on a pod template
1614
+ nginxName := genName ("nginx-" )
1615
+ strategy := v1alpha1.StrategyDetailsDeployment {
1616
+ DeploymentSpecs : []v1alpha1.StrategyDeploymentSpec {
1617
+ {
1618
+ Name : genName ("dep-" ),
1619
+ Spec : newNginxDeployment (nginxName ),
1620
+ },
1621
+ },
1622
+ }
1623
+ strategy .DeploymentSpecs [0 ].Spec .Template .Annotations = map [string ]string {
1624
+ "foo1" : "notBar1" ,
1625
+ "foo2" : "bar2" ,
1626
+ }
1627
+
1628
+ // Create a CSV that defines the `foo1` and `foo3` annotations
1629
+ csv := v1alpha1.ClusterServiceVersion {
1630
+ TypeMeta : metav1.TypeMeta {
1631
+ Kind : v1alpha1 .ClusterServiceVersionKind ,
1632
+ APIVersion : v1alpha1 .ClusterServiceVersionAPIVersion ,
1633
+ },
1634
+ ObjectMeta : metav1.ObjectMeta {
1635
+ Name : genName ("csv" ),
1636
+ Annotations : map [string ]string {
1637
+ "foo1" : "bar1" ,
1638
+ "foo3" : "bar3" ,
1639
+ },
1640
+ },
1641
+ Spec : v1alpha1.ClusterServiceVersionSpec {
1642
+ MinKubeVersion : "0.0.0" ,
1643
+ InstallModes : []v1alpha1.InstallMode {
1644
+ {
1645
+ Type : v1alpha1 .InstallModeTypeOwnNamespace ,
1646
+ Supported : true ,
1647
+ },
1648
+ {
1649
+ Type : v1alpha1 .InstallModeTypeSingleNamespace ,
1650
+ Supported : true ,
1651
+ },
1652
+ {
1653
+ Type : v1alpha1 .InstallModeTypeMultiNamespace ,
1654
+ Supported : true ,
1655
+ },
1656
+ {
1657
+ Type : v1alpha1 .InstallModeTypeAllNamespaces ,
1658
+ Supported : true ,
1659
+ },
1660
+ },
1661
+ InstallStrategy : v1alpha1.NamedInstallStrategy {
1662
+ StrategyName : v1alpha1 .InstallStrategyNameDeployment ,
1663
+ StrategySpec : strategy ,
1664
+ },
1665
+ },
1666
+ }
1667
+
1668
+ // Create the CSV and make sure to clean it up
1669
+ cleanupCSV , err := createCSV (c , crc , csv , testNamespace , false , false )
1670
+ Expect (err ).ShouldNot (HaveOccurred ())
1671
+ defer cleanupCSV ()
1672
+
1673
+ // Wait for current CSV to succeed
1674
+ _ , err = fetchCSV (crc , csv .Name , testNamespace , csvSucceededChecker )
1675
+ Expect (err ).ShouldNot (HaveOccurred ())
1676
+
1677
+ // Should have created deployment
1678
+ dep , err := c .GetDeployment (testNamespace , strategy .DeploymentSpecs [0 ].Name )
1679
+ Expect (err ).ShouldNot (HaveOccurred ())
1680
+ Expect (dep ).ShouldNot (BeNil ())
1681
+
1682
+ // Make sure that the pods annotations are correct
1683
+ annotations := dep .Spec .Template .Annotations
1684
+ Expect (annotations ["foo1" ]).Should (Equal ("bar1" ))
1685
+ Expect (annotations ["foo2" ]).Should (Equal ("bar2" ))
1686
+ Expect (annotations ["foo3" ]).Should (Equal ("bar3" ))
1687
+ })
1612
1688
It ("update same deployment name" , func () {
1613
1689
1614
1690
// Create dependency first (CRD)
0 commit comments