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

Enhance registerExisting SG/SSHKey feature #1019

Conversation

jihoon-seo
Copy link
Member

@jihoon-seo jihoon-seo commented Jan 24, 2022

[Request for registering existing SG]

curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NSID/resources/securityGroup?option=register -H 'Content-Type: application/json' -d @- <<EOF
{
	"name": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
	"connectionName": "${CONN_CONFIG[$INDEX,$REGION]}",
	"vNetId": "${CONN_CONFIG[$INDEX,$REGION]}-${POSTFIX}",
	"cspSecurityGroupId": "sg-06b67660aa959e005"
}

[Response]

❯ ./test-register-csp-securityGroup.sh -n jhseo -c aws -r 1
####################################################################
## 4. SecurityGroup: Register
####################################################################


- Register securityGroup in aws-ap-southeast-1
{
  "id": "aws-ap-southeast-1-jhseo",
  "name": "aws-ap-southeast-1-jhseo",
  "connectionName": "aws-ap-southeast-1",
  "vNetId": "ns01-aws-ap-southeast-1-jhseo",
  "description": "",
  "firewallRules": [
    {
      "FromPort": "22",
      "ToPort": "22",
      "IPProtocol": "tcp",
      "Direction": "inbound",
      "CIDR": "0.0.0.0/0"
    },
    {
      "FromPort": "",
      "ToPort": "",
      "IPProtocol": "-1",
      "Direction": "outbound",
      "CIDR": "0.0.0.0/0"
    }
  ],
  "cspSecurityGroupId": "sg-06b67660aa959e005",
  "cspSecurityGroupName": "aws-ap-southeast-1-jhseo",
  "keyValueList": [
    {
      "Key": "GroupName",
      "Value": "tb-test-jhseo"
    },
    {
      "Key": "VpcID",
      "Value": "vpc-018e42dc39078bb5d"
    },
    {
      "Key": "OwnerID",
      "Value": "635484366616"
    },
    {
      "Key": "Description",
      "Value": "registerExistingSG test"
    }
  ],
  "associatedObjectList": [],
  "isAutoGenerated": false,
  "systemLabel": "Registered from CSP resource"
}

[Request for registering existing SSH Key]
(참고: CSP 또는 SP에 이미 등록되어 있는 SSH Key는, Get 해도 Private key 등을 알 수 없음)

curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NSID/resources/sshKey?option=register -H 'Content-Type: application/json' -d \
'{ 
	"connectionName": "'${CONN_CONFIG[$INDEX,$REGION]}'", 
	"name": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'", 
	"cspSshKeyId": "jhseo-test",
	"fingerprint": "test-fingerprint",
	"username": "test-username",
	"publicKey": "test-public-key",
	"privateKey": "test-private-key"
}

[Response]

❯ ./test-register-csp-sshKey.sh -n jhseo -c aws -r 1
####################################################################
## 5. sshKey: Register
####################################################################


- Register sshKey in aws-ap-southeast-1
{
  "id": "aws-ap-southeast-1-jhseo",
  "name": "aws-ap-southeast-1-jhseo",
  "connectionName": "aws-ap-southeast-1",
  "description": "",
  "cspSshKeyId": "jhseo-test",
  "cspSshKeyName": "ns01-aws-ap-southeast-1-jhseo",
  "fingerprint": "b2:91:94:53:a2:85:4e:7c:3d:c9:b4:0b:71:94:88:e9:69:a9:39:a4",
  "username": "test-username",
  "verifiedUsername": "",
  "publicKey": "test-public-key",
  "privateKey": "test-private-key",
  "keyValueList": [],
  "associatedObjectList": [],
  "isAutoGenerated": false,
  "systemLabel": "Registered from CSP resource"
}

@jihoon-seo jihoon-seo requested a review from seokho-son January 24, 2022 09:12
@jihoon-seo jihoon-seo added the hold Need to hold merge label Jan 24, 2022
@jihoon-seo jihoon-seo force-pushed the 220124_Enhance_registerExistingSG-SSHKey_feature branch from 7aee01d to bf2ebef Compare January 25, 2022 01:59
@jihoon-seo jihoon-seo removed the hold Need to hold merge label Jan 25, 2022
Copy link
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jihoon-seo 감사합니다!

Name, ID 등의 관계가 복잡하여 혼동할 수 있을 것 같습니다.
리뷰 의견과 같이 간략하게 주석을 제공하면 어떨까요?

src/core/mcir/securitygroup.go Outdated Show resolved Hide resolved
src/core/mcir/sshkey.go Show resolved Hide resolved
src/core/mcir/sshkey.go Outdated Show resolved Hide resolved
@jihoon-seo jihoon-seo force-pushed the 220124_Enhance_registerExistingSG-SSHKey_feature branch from bf2ebef to 35829cc Compare January 25, 2022 06:30
@jihoon-seo
Copy link
Member Author

@seokho-son 리뷰 감사합니다. 모두 반영했습니다. 😊

@seokho-son
Copy link
Member

/approve

@seokho-son seokho-son merged commit 4be0655 into cloud-barista:main Jan 25, 2022
@jihoon-seo jihoon-seo deleted the 220124_Enhance_registerExistingSG-SSHKey_feature branch January 25, 2022 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants