...

Source file src/edge-infra.dev/pkg/k8s/certmanager/apis/meta/conditions.go

Documentation: edge-infra.dev/pkg/k8s/certmanager/apis/meta

     1  package meta
     2  
     3  import (
     4  	certmgr "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
     5  	certmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1"
     6  )
     7  
     8  // IsIssuerCondition generically determines if the provided conditions contains
     9  // a condition of the provided type with the provided status
    10  func IsIssuerCondition(conditions []certmgr.IssuerCondition, cType string, cStatus certmeta.ConditionStatus) (bool, string) {
    11  	reason := ""
    12  	for _, condition := range conditions {
    13  		if string(condition.Type) == cType {
    14  			return condition.Status == cStatus, condition.Reason
    15  		}
    16  	}
    17  	return false, reason
    18  }
    19  
    20  // IsCertificateCondition generically determines if the provided conditions contains
    21  // a condition of the provided type with the provided status
    22  func IsCertificateCondition(conditions []certmgr.CertificateCondition, cType string, cStatus certmeta.ConditionStatus) (bool, string) {
    23  	reason := ""
    24  	for _, condition := range conditions {
    25  		if string(condition.Type) == cType {
    26  			return condition.Status == cStatus, condition.Reason
    27  		}
    28  	}
    29  	return false, reason
    30  }
    31  

View as plain text