Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retries for Barbican #289

Merged
merged 4 commits into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions octavia_f5/utils/cert_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
# under the License.

import hashlib
import tenacity

from oslo_config import cfg
from oslo_context import context as oslo_context
from stevedore import driver as stevedore_driver

from octavia.common import exceptions as octavia_exc
from octavia.common.tls_utils import cert_parser
from octavia_f5.common import constants
from octavia_f5.restclient.as3objects import certificate as m_cert

CONF = cfg.CONF
RETRY_ATTEMPTS = 15
RETRY_INITIAL_DELAY = 1
RETRY_BACKOFF = 1
RETRY_MAX = 5


class CertManagerWrapper(object):
Expand All @@ -33,6 +39,12 @@ def __init__(self):
invoke_on_load=True,
).driver

@tenacity.retry(
retry=tenacity.retry_if_exception_type(
octavia_exc.CertificateRetrievalException),
wait=tenacity.wait_incrementing(
RETRY_INITIAL_DELAY, RETRY_BACKOFF, RETRY_MAX),
stop=tenacity.stop_after_attempt(RETRY_ATTEMPTS))
def get_certificates(self, obj, context=None):
"""Fetches certificates and creates dict out of octavia objects

Expand Down Expand Up @@ -68,6 +80,12 @@ def get_certificates(self, obj, context=None):

return certificates

@tenacity.retry(
retry=tenacity.retry_if_exception_type(
octavia_exc.CertificateRetrievalException),
wait=tenacity.wait_incrementing(
RETRY_INITIAL_DELAY, RETRY_BACKOFF, RETRY_MAX),
stop=tenacity.stop_after_attempt(RETRY_ATTEMPTS))
def load_secret(self, project_id, secret_ref):
"""Loads secrets from secret store

Expand Down
Loading