@@ -17,6 +17,8 @@ limitations under the License.
17
17
package v1alpha1
18
18
19
19
import (
20
+ cmv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
21
+ cmmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1"
20
22
appsv1 "k8s.io/api/apps/v1"
21
23
corev1 "k8s.io/api/core/v1"
22
24
"knative.dev/pkg/apis"
@@ -35,6 +37,12 @@ const (
35
37
// IntegrationSinkConditionEventPoliciesReady has status True when all the applying EventPolicies for this
36
38
// IntegrationSink are ready.
37
39
IntegrationSinkConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady"
40
+
41
+ // IntegrationSinkConditionCertificateReady has status True when the IntegrationSink's certificate is ready.
42
+ IntegrationSinkConditionCertificateReady apis.ConditionType = "CertificateReady"
43
+
44
+ // Certificate related condition reasons
45
+ IntegrationSinkCertificateNotReady string = "CertificateNotReady"
38
46
)
39
47
40
48
var IntegrationSinkCondSet = apis .NewLivingConditionSet (
@@ -112,6 +120,37 @@ func (s *IntegrationSinkStatus) PropagateDeploymentStatus(d *appsv1.DeploymentSt
112
120
}
113
121
}
114
122
123
+ func (s * IntegrationSinkStatus ) PropagateCertificateStatus (cs cmv1.CertificateStatus ) bool {
124
+ var topLevel * cmv1.CertificateCondition
125
+ for _ , cond := range cs .Conditions {
126
+ if cond .Type == cmv1 .CertificateConditionReady {
127
+ topLevel = & cond
128
+ break
129
+ }
130
+ }
131
+
132
+ if topLevel == nil {
133
+ IntegrationSinkCondSet .Manage (s ).MarkUnknown (IntegrationSinkConditionCertificateReady ,
134
+ IntegrationSinkCertificateNotReady , "Certificate is progressing" )
135
+ return false
136
+ }
137
+
138
+ if topLevel .Status == cmmeta .ConditionUnknown {
139
+ IntegrationSinkCondSet .Manage (s ).MarkUnknown (IntegrationSinkConditionCertificateReady ,
140
+ IntegrationSinkCertificateNotReady , "Certificate is progressing, " + topLevel .Reason + " Message: " + topLevel .Message )
141
+ return false
142
+ }
143
+
144
+ if topLevel .Status == cmmeta .ConditionFalse {
145
+ IntegrationSinkCondSet .Manage (s ).MarkFalse (IntegrationSinkConditionCertificateReady ,
146
+ IntegrationSinkCertificateNotReady , "Certificate is not ready, " + topLevel .Reason + " Message: " + topLevel .Message )
147
+ return false
148
+ }
149
+
150
+ IntegrationSinkCondSet .Manage (s ).MarkTrue (IntegrationSinkConditionCertificateReady )
151
+ return true
152
+ }
153
+
115
154
func (s * IntegrationSinkStatus ) SetAddress (address * duckv1.Addressable ) {
116
155
s .Address = address
117
156
if address == nil || address .URL .IsEmpty () {
0 commit comments