@@ -97,6 +97,10 @@ func (i *TestInstaller) CheckInstalled(s install.Strategy) (bool, error) {
97
97
return true , nil
98
98
}
99
99
100
+ func (i * TestInstaller ) ShouldRotateCerts (s install.Strategy ) (bool , error ) {
101
+ return false , nil
102
+ }
103
+
100
104
func (i * TestInstaller ) CertsRotateAt () time.Time {
101
105
return time.Time {}
102
106
}
@@ -489,6 +493,7 @@ func tlsSecret(name, namespace string, certPEM, privPEM []byte) *corev1.Secret {
489
493
}
490
494
secret .SetName (name )
491
495
secret .SetNamespace (namespace )
496
+ secret .SetLabels (map [string ]string {install .OLMManagedLabelKey : install .OLMManagedLabelValue })
492
497
493
498
return secret
494
499
}
@@ -1880,26 +1885,26 @@ func TestTransitionCSV(t *testing.T) {
1880
1885
},
1881
1886
clientObjs : []runtime.Object {defaultOperatorGroup },
1882
1887
apis : []runtime.Object {
1883
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1888
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1884
1889
},
1885
1890
objs : []runtime.Object {
1886
1891
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
1887
1892
install .OLMCAHashAnnotationKey : expiredCAHash ,
1888
1893
})),
1889
- withAnnotations (keyPairToTLSSecret ("v1.a1-cert" , namespace , signedServingPair (time .Now ().Add (24 * time .Hour ), expiredCA , [] string { "v1-a1.ns" , "v1-a1.ns.svc" } )), map [string ]string {
1894
+ withAnnotations (keyPairToTLSSecret (install . SecretName ( install . ServiceName ( "a1" )) , namespace , signedServingPair (time .Now ().Add (24 * time .Hour ), expiredCA , install . HostnamesForService ( install . ServiceName ( "a1" ) , "ns" ) )), map [string ]string {
1890
1895
install .OLMCAHashAnnotationKey : expiredCAHash ,
1891
1896
}),
1892
- service ("v1- a1" , namespace , "a1" , 80 ),
1897
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
1893
1898
serviceAccount ("sa" , namespace ),
1894
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
1899
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
1895
1900
{
1896
1901
Verbs : []string {"get" },
1897
1902
APIGroups : []string {"" },
1898
1903
Resources : []string {"secrets" },
1899
- ResourceNames : []string {"v1.a1-cert" },
1904
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
1900
1905
},
1901
1906
}),
1902
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
1907
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
1903
1908
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
1904
1909
{
1905
1910
Verbs : []string {"get" },
@@ -1908,7 +1913,7 @@ func TestTransitionCSV(t *testing.T) {
1908
1913
ResourceNames : []string {"extension-apiserver-authentication" },
1909
1914
},
1910
1915
}),
1911
- roleBinding ("v1.a1 -auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1916
+ roleBinding (fmt . Sprintf ( "%s -auth-reader", install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1912
1917
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
1913
1918
{
1914
1919
Verbs : []string {"create" },
@@ -1921,15 +1926,15 @@ func TestTransitionCSV(t *testing.T) {
1921
1926
Resources : []string {"subjectaccessreviews" },
1922
1927
},
1923
1928
}),
1924
- clusterRoleBinding ("v1.a1 -system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
1929
+ clusterRoleBinding (fmt . Sprintf ( "%s -system:auth-delegator", install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
1925
1930
},
1926
1931
crds : []runtime.Object {
1927
1932
crd ("c1" , "v1" , "g1" ),
1928
1933
},
1929
1934
},
1930
1935
expected : expected {
1931
1936
csvStates : map [string ]csvState {
1932
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonAPIServiceResourceIssue },
1937
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonNeedsCertRotation },
1933
1938
},
1934
1939
},
1935
1940
},
@@ -1949,26 +1954,26 @@ func TestTransitionCSV(t *testing.T) {
1949
1954
},
1950
1955
clientObjs : []runtime.Object {defaultOperatorGroup },
1951
1956
apis : []runtime.Object {
1952
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1957
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1953
1958
},
1954
1959
objs : []runtime.Object {
1955
1960
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
1956
1961
install .OLMCAHashAnnotationKey : expiredCAHash ,
1957
1962
})),
1958
- withAnnotations (keyPairToTLSSecret ("v1.a1-cert" , namespace , signedServingPair (time .Now ().Add (24 * time .Hour ), expiredCA , [] string { "v1-a1.ns" , "v1-a1.ns.svc" } )), map [string ]string {
1963
+ withAnnotations (keyPairToTLSSecret (install . SecretName ( install . ServiceName ( "a1" )) , namespace , signedServingPair (time .Now ().Add (24 * time .Hour ), expiredCA , install . HostnamesForService ( install . ServiceName ( "a1" ) , "ns" ) )), map [string ]string {
1959
1964
install .OLMCAHashAnnotationKey : expiredCAHash ,
1960
1965
}),
1961
- service ("v1- a1" , namespace , "a1" , 80 ),
1966
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
1962
1967
serviceAccount ("sa" , namespace ),
1963
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
1968
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
1964
1969
{
1965
1970
Verbs : []string {"get" },
1966
1971
APIGroups : []string {"" },
1967
1972
Resources : []string {"secrets" },
1968
- ResourceNames : []string {"v1.a1-cert" },
1973
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
1969
1974
},
1970
1975
}),
1971
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
1976
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
1972
1977
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
1973
1978
{
1974
1979
Verbs : []string {"get" },
@@ -1977,7 +1982,7 @@ func TestTransitionCSV(t *testing.T) {
1977
1982
ResourceNames : []string {"extension-apiserver-authentication" },
1978
1983
},
1979
1984
}),
1980
- roleBinding ("v1.a1 -auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1985
+ roleBinding (fmt . Sprintf ( "%s -auth-reader", install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1981
1986
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
1982
1987
{
1983
1988
Verbs : []string {"create" },
@@ -1990,15 +1995,15 @@ func TestTransitionCSV(t *testing.T) {
1990
1995
Resources : []string {"subjectaccessreviews" },
1991
1996
},
1992
1997
}),
1993
- clusterRoleBinding ("v1.a1 -system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
1998
+ clusterRoleBinding (fmt . Sprintf ( "%s -system:auth-delegator", install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
1994
1999
},
1995
2000
crds : []runtime.Object {
1996
2001
crd ("c1" , "v1" , "g1" ),
1997
2002
},
1998
2003
},
1999
2004
expected : expected {
2000
2005
csvStates : map [string ]csvState {
2001
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonAPIServiceResourcesNeedReinstall },
2006
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonNeedsCertRotation },
2002
2007
},
2003
2008
},
2004
2009
},
0 commit comments