@@ -101,6 +101,10 @@ func (i *TestInstaller) CheckInstalled(s install.Strategy) (bool, error) {
101
101
return true , nil
102
102
}
103
103
104
+ func (i * TestInstaller ) ShouldRotateCerts (s install.Strategy ) (bool , error ) {
105
+ return false , nil
106
+ }
107
+
104
108
func (i * TestInstaller ) CertsRotateAt () time.Time {
105
109
return time.Time {}
106
110
}
@@ -1956,26 +1960,26 @@ func TestTransitionCSV(t *testing.T) {
1956
1960
},
1957
1961
clientObjs : []runtime.Object {defaultOperatorGroup },
1958
1962
apis : []runtime.Object {
1959
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1963
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
1960
1964
},
1961
1965
objs : []runtime.Object {
1962
1966
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
1963
1967
install .OLMCAHashAnnotationKey : expiredCAHash ,
1964
1968
})),
1965
- 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 {
1969
+ 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 {
1966
1970
install .OLMCAHashAnnotationKey : expiredCAHash ,
1967
1971
}),
1968
- service ("v1- a1" , namespace , "a1" , 80 ),
1972
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
1969
1973
serviceAccount ("sa" , namespace ),
1970
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
1974
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
1971
1975
{
1972
1976
Verbs : []string {"get" },
1973
1977
APIGroups : []string {"" },
1974
1978
Resources : []string {"secrets" },
1975
- ResourceNames : []string {"v1.a1-cert" },
1979
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
1976
1980
},
1977
1981
}),
1978
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
1982
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
1979
1983
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
1980
1984
{
1981
1985
Verbs : []string {"get" },
@@ -1984,7 +1988,7 @@ func TestTransitionCSV(t *testing.T) {
1984
1988
ResourceNames : []string {"extension-apiserver-authentication" },
1985
1989
},
1986
1990
}),
1987
- roleBinding ("v1.a1-auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1991
+ roleBinding (install . AuthReaderRoleBindingName ( install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
1988
1992
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
1989
1993
{
1990
1994
Verbs : []string {"create" },
@@ -1997,15 +2001,15 @@ func TestTransitionCSV(t *testing.T) {
1997
2001
Resources : []string {"subjectaccessreviews" },
1998
2002
},
1999
2003
}),
2000
- clusterRoleBinding ("v1.a1-system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
2004
+ clusterRoleBinding (install . AuthDelegatorClusterRoleBindingName ( install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
2001
2005
},
2002
2006
crds : []runtime.Object {
2003
2007
crd ("c1" , "v1" , "g1" ),
2004
2008
},
2005
2009
},
2006
2010
expected : expected {
2007
2011
csvStates : map [string ]csvState {
2008
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonAPIServiceResourceIssue },
2012
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonNeedsCertRotation },
2009
2013
},
2010
2014
},
2011
2015
},
@@ -2025,26 +2029,26 @@ func TestTransitionCSV(t *testing.T) {
2025
2029
},
2026
2030
clientObjs : []runtime.Object {defaultOperatorGroup },
2027
2031
apis : []runtime.Object {
2028
- apiService ("a1" , "v1" , "v1- a1" , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
2032
+ apiService ("a1" , "v1" , install . ServiceName ( " a1") , namespace , "a1" , expiredCAPEM , apiregistrationv1 .ConditionTrue , ownerLabelFromCSV ("csv1" , namespace )),
2029
2033
},
2030
2034
objs : []runtime.Object {
2031
2035
deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
2032
2036
install .OLMCAHashAnnotationKey : expiredCAHash ,
2033
2037
})),
2034
- 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 {
2038
+ 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 {
2035
2039
install .OLMCAHashAnnotationKey : expiredCAHash ,
2036
2040
}),
2037
- service ("v1- a1" , namespace , "a1" , 80 ),
2041
+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
2038
2042
serviceAccount ("sa" , namespace ),
2039
- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
2043
+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
2040
2044
{
2041
2045
Verbs : []string {"get" },
2042
2046
APIGroups : []string {"" },
2043
2047
Resources : []string {"secrets" },
2044
- ResourceNames : []string {"v1.a1-cert" },
2048
+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
2045
2049
},
2046
2050
}),
2047
- roleBinding ("v1.a1-cert" , namespace , "v1.a1-cert" , "sa" , namespace ),
2051
+ roleBinding (install . SecretName ( install . ServiceName ( "a1" )) , namespace , install . SecretName ( install . ServiceName ( "a1" )) , "sa" , namespace ),
2048
2052
role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
2049
2053
{
2050
2054
Verbs : []string {"get" },
@@ -2053,7 +2057,7 @@ func TestTransitionCSV(t *testing.T) {
2053
2057
ResourceNames : []string {"extension-apiserver-authentication" },
2054
2058
},
2055
2059
}),
2056
- roleBinding ("v1.a1-auth-reader" , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
2060
+ roleBinding (install . AuthReaderRoleBindingName ( install . ServiceName ( "a1" )) , "kube-system" , "extension-apiserver-authentication-reader" , "sa" , namespace ),
2057
2061
clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
2058
2062
{
2059
2063
Verbs : []string {"create" },
@@ -2066,15 +2070,15 @@ func TestTransitionCSV(t *testing.T) {
2066
2070
Resources : []string {"subjectaccessreviews" },
2067
2071
},
2068
2072
}),
2069
- clusterRoleBinding ("v1.a1-system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
2073
+ clusterRoleBinding (install . AuthDelegatorClusterRoleBindingName ( install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
2070
2074
},
2071
2075
crds : []runtime.Object {
2072
2076
crd ("c1" , "v1" , "g1" ),
2073
2077
},
2074
2078
},
2075
2079
expected : expected {
2076
2080
csvStates : map [string ]csvState {
2077
- "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonAPIServiceResourcesNeedReinstall },
2081
+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonNeedsCertRotation },
2078
2082
},
2079
2083
},
2080
2084
},
0 commit comments