@@ -100,6 +100,10 @@ func (i *TestInstaller) CheckInstalled(s install.Strategy) (bool, error) {
100
100
return true , nil
101
101
}
102
102
103
+ func (i * TestInstaller ) ShouldRotateCerts (s install.Strategy ) (bool , error ) {
104
+ return false , nil
105
+ }
106
+
103
107
func (i * TestInstaller ) CertsRotateAt () time.Time {
104
108
return time.Time {}
105
109
}
@@ -528,6 +532,7 @@ func tlsSecret(name, namespace string, certPEM, privPEM []byte) *corev1.Secret {
528
532
}
529
533
secret .SetName (name )
530
534
secret .SetNamespace (namespace )
535
+ secret .SetLabels (map [string ]string {install .OLMManagedLabelKey : install .OLMManagedLabelValue })
531
536
532
537
return secret
533
538
}
@@ -1919,26 +1924,26 @@ func TestTransitionCSV(t *testing.T) {
1919
1924
},
1920
1925
clientObjs : []runtime.Object {defaultOperatorGroup },
1921
1926
apis : []runtime.Object {
1922
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1927
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1923
1928
},
1924
1929
objs : []runtime.Object {
1925
1930
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
1926
1931
install .OLMCAHashAnnotationKey : expiredCAHash ,
1927
1932
})),
1928
- 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 {
1933
+ 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 {
1929
1934
install .OLMCAHashAnnotationKey : expiredCAHash ,
1930
1935
}),
1931
- service ("v1- a1" , namespace , "a1" , 80 ),
1936
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
1932
1937
serviceAccount ("sa" , namespace ),
1933
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
1938
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
1934
1939
{
1935
1940
Verbs : []string {"get" },
1936
1941
APIGroups : []string {"" },
1937
1942
Resources : []string {"secrets" },
1938
- ResourceNames : []string {"v1.a1-cert" },
1943
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
1939
1944
},
1940
1945
}),
1941
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
1946
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
1942
1947
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
1943
1948
{
1944
1949
Verbs : []string {"get" },
@@ -1947,7 +1952,7 @@ func TestTransitionCSV(t *testing.T) {
1947
1952
ResourceNames : []string {"extension-apiserver-authentication" },
1948
1953
},
1949
1954
}),
1950
- roleBinding ("v1.a1 -auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1955
+ roleBinding (fmt . Sprintf ( "%s -auth-reader", install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1951
1956
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
1952
1957
{
1953
1958
Verbs : []string {"create" },
@@ -1960,15 +1965,15 @@ func TestTransitionCSV(t *testing.T) {
1960
1965
Resources : []string {"subjectaccessreviews" },
1961
1966
},
1962
1967
}),
1963
- clusterRoleBinding ("v1.a1 -system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
1968
+ clusterRoleBinding (fmt . Sprintf ( "%s -system:auth-delegator", install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
1964
1969
},
1965
1970
crds : []runtime.Object {
1966
1971
crd ("c1" , "v1" , "g1" ),
1967
1972
},
1968
1973
},
1969
1974
expected : expected {
1970
1975
csvStates : map [string ]csvState {
1971
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonAPIServiceResourceIssue },
1976
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonNeedsCertRotation },
1972
1977
},
1973
1978
},
1974
1979
},
@@ -1988,26 +1993,26 @@ func TestTransitionCSV(t *testing.T) {
1988
1993
},
1989
1994
clientObjs : []runtime.Object {defaultOperatorGroup },
1990
1995
apis : []runtime.Object {
1991
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1996
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1992
1997
},
1993
1998
objs : []runtime.Object {
1994
1999
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
1995
2000
install .OLMCAHashAnnotationKey : expiredCAHash ,
1996
2001
})),
1997
- 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 {
2002
+ 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 {
1998
2003
install .OLMCAHashAnnotationKey : expiredCAHash ,
1999
2004
}),
2000
- service ("v1- a1" , namespace , "a1" , 80 ),
2005
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
2001
2006
serviceAccount ("sa" , namespace ),
2002
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
2007
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
2003
2008
{
2004
2009
Verbs : []string {"get" },
2005
2010
APIGroups : []string {"" },
2006
2011
Resources : []string {"secrets" },
2007
- ResourceNames : []string {"v1.a1-cert" },
2012
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
2008
2013
},
2009
2014
}),
2010
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
2015
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
2011
2016
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
2012
2017
{
2013
2018
Verbs : []string {"get" },
@@ -2016,7 +2021,7 @@ func TestTransitionCSV(t *testing.T) {
2016
2021
ResourceNames : []string {"extension-apiserver-authentication" },
2017
2022
},
2018
2023
}),
2019
- roleBinding ("v1.a1 -auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
2024
+ roleBinding (fmt . Sprintf ( "%s -auth-reader", install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
2020
2025
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
2021
2026
{
2022
2027
Verbs : []string {"create" },
@@ -2029,15 +2034,15 @@ func TestTransitionCSV(t *testing.T) {
2029
2034
Resources : []string {"subjectaccessreviews" },
2030
2035
},
2031
2036
}),
2032
- clusterRoleBinding ("v1.a1 -system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
2037
+ clusterRoleBinding (fmt . Sprintf ( "%s -system:auth-delegator", install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
2033
2038
},
2034
2039
crds : []runtime.Object {
2035
2040
crd ("c1" , "v1" , "g1" ),
2036
2041
},
2037
2042
},
2038
2043
expected : expected {
2039
2044
csvStates : map [string ]csvState {
2040
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonAPIServiceResourcesNeedReinstall },
2045
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonNeedsCertRotation },
2041
2046
},
2042
2047
},
2043
2048
},
0 commit comments