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