@@ -101,6 +101,10 @@ func (i *TestInstaller) CheckInstalled(s install.Strategy) (bool, error) {
101101 return true , nil
102102}
103103
104+ func (i * TestInstaller ) ShouldRotateCerts (s install.Strategy ) (bool , error ) {
105+ return false , nil
106+ }
107+
104108func (i * TestInstaller ) CertsRotateAt () time.Time {
105109 return time.Time {}
106110}
@@ -1956,26 +1960,26 @@ func TestTransitionCSV(t *testing.T) {
19561960 },
19571961 clientObjs : []runtime.Object {defaultOperatorGroup },
19581962 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 )),
19601964 },
19611965 objs : []runtime.Object {
19621966 deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
19631967 install .OLMCAHashAnnotationKey : expiredCAHash ,
19641968 })),
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 {
19661970 install .OLMCAHashAnnotationKey : expiredCAHash ,
19671971 }),
1968- service ("v1- a1" , namespace , "a1" , 80 ),
1972+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
19691973 serviceAccount ("sa" , namespace ),
1970- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
1974+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
19711975 {
19721976 Verbs : []string {"get" },
19731977 APIGroups : []string {"" },
19741978 Resources : []string {"secrets" },
1975- ResourceNames : []string {"v1.a1-cert" },
1979+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
19761980 },
19771981 }),
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 ),
19791983 role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
19801984 {
19811985 Verbs : []string {"get" },
@@ -1984,7 +1988,7 @@ func TestTransitionCSV(t *testing.T) {
19841988 ResourceNames : []string {"extension-apiserver-authentication" },
19851989 },
19861990 }),
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 ),
19881992 clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
19891993 {
19901994 Verbs : []string {"create" },
@@ -1997,15 +2001,15 @@ func TestTransitionCSV(t *testing.T) {
19972001 Resources : []string {"subjectaccessreviews" },
19982002 },
19992003 }),
2000- clusterRoleBinding ("v1.a1-system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
2004+ clusterRoleBinding (install . AuthDelegatorClusterRoleBindingName ( install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
20012005 },
20022006 crds : []runtime.Object {
20032007 crd ("c1" , "v1" , "g1" ),
20042008 },
20052009 },
20062010 expected : expected {
20072011 csvStates : map [string ]csvState {
2008- "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonAPIServiceResourceIssue },
2012+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhaseFailed , reason : v1alpha1 .CSVReasonNeedsCertRotation },
20092013 },
20102014 },
20112015 },
@@ -2025,26 +2029,26 @@ func TestTransitionCSV(t *testing.T) {
20252029 },
20262030 clientObjs : []runtime.Object {defaultOperatorGroup },
20272031 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 )),
20292033 },
20302034 objs : []runtime.Object {
20312035 deployment ("a1" , namespace , "sa" , addAnnotations (defaultTemplateAnnotations , map [string ]string {
20322036 install .OLMCAHashAnnotationKey : expiredCAHash ,
20332037 })),
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 {
20352039 install .OLMCAHashAnnotationKey : expiredCAHash ,
20362040 }),
2037- service ("v1- a1" , namespace , "a1" , 80 ),
2041+ service (install . ServiceName ( " a1") , namespace , "a1" , 80 ),
20382042 serviceAccount ("sa" , namespace ),
2039- role ("v1.a1-cert" , namespace , []rbacv1.PolicyRule {
2043+ role (install . SecretName ( install . ServiceName ( "a1" )) , namespace , []rbacv1.PolicyRule {
20402044 {
20412045 Verbs : []string {"get" },
20422046 APIGroups : []string {"" },
20432047 Resources : []string {"secrets" },
2044- ResourceNames : []string {"v1.a1-cert" },
2048+ ResourceNames : []string {install . SecretName ( install . ServiceName ( "a1" )) },
20452049 },
20462050 }),
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 ),
20482052 role ("extension-apiserver-authentication-reader" , "kube-system" , []rbacv1.PolicyRule {
20492053 {
20502054 Verbs : []string {"get" },
@@ -2053,7 +2057,7 @@ func TestTransitionCSV(t *testing.T) {
20532057 ResourceNames : []string {"extension-apiserver-authentication" },
20542058 },
20552059 }),
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 ),
20572061 clusterRole ("system:auth-delegator" , []rbacv1.PolicyRule {
20582062 {
20592063 Verbs : []string {"create" },
@@ -2066,15 +2070,15 @@ func TestTransitionCSV(t *testing.T) {
20662070 Resources : []string {"subjectaccessreviews" },
20672071 },
20682072 }),
2069- clusterRoleBinding ("v1.a1-system:auth-delegator" , "system:auth-delegator" , "sa" , namespace ),
2073+ clusterRoleBinding (install . AuthDelegatorClusterRoleBindingName ( install . ServiceName ( "a1" )) , "system:auth-delegator" , "sa" , namespace ),
20702074 },
20712075 crds : []runtime.Object {
20722076 crd ("c1" , "v1" , "g1" ),
20732077 },
20742078 },
20752079 expected : expected {
20762080 csvStates : map [string ]csvState {
2077- "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonAPIServiceResourcesNeedReinstall },
2081+ "csv1" : {exists : true , phase : v1alpha1 .CSVPhasePending , reason : v1alpha1 .CSVReasonNeedsCertRotation },
20782082 },
20792083 },
20802084 },
0 commit comments