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

Bugfix and update API handling #128

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

yunkon-kim
Copy link
Member

  • Add a middleware to check if Tumblebug is initialized (temporarily)
  • Bugfix @ID missing in API annotations

About the middleware

Before Tumblebug is initialized

Logs:

cb-tumblebug       | 11:42AM ERR src/api/rest/server/middlewares/zerologger.go:72 > request error error="code=404, message=Not valid namespace" URI=/tumblebug/ns/system/resources/image bytes_in= bytes_out=34 client_ip=172.25.0.5 id=1726746145103384911 latency_human="861.3µs" method=GET status=404
cm-beetle          | 11:42AM WRN pkg/api/rest/middlewares/tumblebug-init-checker.go:52 > Tumblebug needs to be initialized. error="[Error from: http://cb-tumblebug:1323/tumblebug/ns/system/resources/image] Status code: 404 Not Found, Message: {\"message\":\"Not valid namespace\"}\n"
cm-beetle          | 11:42AM INF pkg/api/rest/middlewares/zerologger.go:56 > request URI=/beetle/recommendation/mci bytes_in=1199 bytes_out=174 id=1726746145101904211 latency_human=3.1424ms method=POST remote_ip=172.25.0.1 status=503

Response:

{
  "message": "Tumblebug needs to be initialized. See https://github.com/cloud-barista/cb-tumblebug?tab=readme-ov-file#3-initialize-cb-tumblebug-to-configure-multi-cloud-info"
}

After Tumblebug is initialized

Logs:

cb-tumblebug       | 11:52AM DBG src/core/resource/common.go:471 > [Get] image list
cb-tumblebug       | 11:52AM DBG src/core/resource/common.go:473 > /ns/system/resources/image
cb-tumblebug       | 11:52AM INF src/api/rest/server/middlewares/zerologger.go:57 > request URI=/tumblebug/ns/system/resources/image bytes_in= bytes_out=13 client_ip=172.25.0.5 id=1726746740108686987 latency_human=1.6298ms method=GET status=200
cm-beetle          | 11:52AM DBG pkg/core/recommendation/recommendation.go:162 > Source computing infrastructure info coreLowerLimit=9 coreUpperLimit=36 memoryLowerLimit (GiB)=1 memoryUpperLimit (GiB)=0 osNameWithVersion="ubuntu 22.04.3 lts (jammy jellyfish)" providerName=aws regionName=ap-northeast-2

...

cm-beetle          | 11:52AM DBG pkg/core/recommendation/recommendation.go:285 > the recommended infra info: {Status: Description: TargetInfra:{Name: InstallMonAgent:no Label:rehosted-mci SystemLabel: Description:A cloud infra recommended by CM-Beetle Vm:[{Name:rehosted-string SubGroupSize: Label:rehosted-vm Description:a recommended virtual machine CommonSpec:aws+ap-northeast-2+i3.8xlarge CommonImage:aws+ap-northeast-2+ubuntu22.04 RootDiskType: RootDiskSize: VmUserPassword: ConnectionName:}]}}
cm-beetle          | 11:52AM INF pkg/api/rest/middlewares/zerologger.go:56 > request URI=/beetle/recommendation/mci bytes_in=1199 bytes_out=423 id=1726746740107439587 latency_human=60.748ms method=POST remote_ip=172.25.0.1 status=200

Response:

{
  "status": "ok",
  "description": "Target infra is recommended.",
  "targetInfra": {
    "name": "mmci01",
    "installMonAgent": "no",
    "label": "rehosted-mci",
    "systemLabel": "",
    "description": "A cloud infra recommended by CM-Beetle",
    "vm": [
      {
        "name": "rehosted-string",
        "subGroupSize": "",
        "label": "rehosted-vm",
        "description": "a recommended virtual machine",
        "commonSpec": "aws+ap-northeast-2+i3.8xlarge",
        "commonImage": "aws+ap-northeast-2+ubuntu22.04"
      }
    ]
  }
}

Close #126
Also, related to #119

* Add @id at API annotations
* Update the general API annotations
@yunkon-kim
Copy link
Member Author

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Sep 19, 2024
@cb-github-robot cb-github-robot merged commit de45312 into cloud-barista:main Sep 19, 2024
2 checks passed
@yunkon-kim yunkon-kim deleted the 240919-19 branch October 24, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved and will be merged soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check if Tumblebug is initialized or not
2 participants