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

CertLoader.UpdateCertifcate() refactor #119

Open
2 tasks
mlajkim opened this issue Mar 29, 2024 · 1 comment
Open
2 tasks

CertLoader.UpdateCertifcate() refactor #119

mlajkim opened this issue Mar 29, 2024 · 1 comment
Labels
refactor Changes without functional changes, or api changes)

Comments

@mlajkim
Copy link
Contributor

mlajkim commented Mar 29, 2024

Background

Before the pr #111, there was not enough check and cert loader panicked.
The changes however has three different uploading part.
image

It will be great to bring it as one as the following instead:
image

TODOs

  • Refactor it
  • Make sure to thoroughly test the flow as it might bring potential bugs
@mlajkim mlajkim added the refactor Changes without functional changes, or api changes) label Mar 29, 2024
@mlajkim mlajkim changed the title CertLoader CertLoader.UpdateCertifcate() refactor Mar 29, 2024
@mlajkim
Copy link
Contributor Author

mlajkim commented Mar 29, 2024

plantuml code used here:

@startuml

title Run() SIA v3.2

note right
  1. Run() runs once a day, if every step is successful
  2. If anyone of them fails, it restarts from the beginning
    (Specifically defined failures won't restart the process)

end note

start
  repeat
    if (idConfig.ProviderService != ""?) then (not empty)
        #lightblue:IdentityProvisioning();
      (not given) elseif (CERT_FILE & KEY_FILE both given?) then (given)
        #red:Attempts to read instance cert on local directory;
      else (not given)
        :Write a debug
        "Skipping to request/load x509 certificate";
      endif
    if (Successfully Prepared Instance Cert?) then (no)
        if (IS BACKUP_MODE "read" or "read+write" && idConfig.ProviderService != ""?) then (yes)
          #lightblue:Attempts to read from k8s secret;
        else (no)
          :Write a debug
          "Skipping to load backup from k8s secret";
        endif
    else (yes)
    endif
  repeat while (Successfully prepared instance cert?)  is (failed to prepare)
  if (Is K8s Backup Secret used?) then (no)
  else (yes)
    #lightblue:IdentityProvisioning() with FORCE_INIT;
    note right
      It is just an attempt.
      If it fails, it does not restart the flow,
      as the instance cert is already prepared.
    end note
  endif
  note right
    Saves instance certificate into the cert reloader
  end note
  :CertReloader.UpdateCertificate();
  :RoleCertProvisioningRequest();
  :WriteFile();
  note right
    Color #lightblue: WriteFile() Should WRITE InstanceCert
    Color #red: WriteFile() Should NOT write InstanceCert
  end note
stop
@enduml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Changes without functional changes, or api changes)
Projects
None yet
Development

No branches or pull requests

1 participant