aboutsummaryrefslogtreecommitdiffstats
path: root/src/dcm/pkg/module/apply.go
AgeCommit message (Collapse)AuthorFilesLines
2020-10-02Set name of resources correctly in appcontextIgor D.C1-36/+38
Previously the DCM K8s resources in appcontext were in the format: <logical cloud name>+<resource type> Now they are in the correct format: <resource name>+<ResourceType> Issue-ID: MULTICLOUD-1143 Change-Id: I271c70587244921cc2ffb7ad571ad8eb162cb10f Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-02Reimplement Terminate to be compatible with StatusIgor D.C1-43/+57
This also includes modifying Apply and Delete, since there are strict conditions that need to be met in each, to prevent Logical Clouds (LCs) from entering a bad state. Summary of what's being done here: - When applying: - set tag 'lccontext' in the LC to the context ID (was already done) - and let rsync know about the appcontext (grpc) (was already done) - if tag was already set, check current context /status - if context /status is actually Terminated, 'lccontext' is set to new context ID and previous AppContext deleted - When terminating: - lets rsync know about the termination request (grpc) - When deleting: - checks whether the current context /status is Terminated - if it is, then it will remove the latest LC context This particular commit disables the TestDeleteLogicalCloud test until a known issue behind the test is resolved. This commit does not leverage the full capacity of the Status framework, but is sufficient to support all operations. A future patch will entirely migrate DCM to the Status framework. Until then, a known issue exists where DCM will forget about context IDs previously associated to a particular Logical Cloud (only keeps last). Issue-ID: MULTICLOUD-1143 Change-Id: I7a6034eba543c2a27daa41b7fe6298cb2a85f9ce Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-01Subtle refactoring in a few functionsIgor D.C1-6/+8
In DCM. Essentially refactored two different areas: - rename apply/terminate functions in module to clarify what they do - split gets from getAlls in API code of the 5 DCM resource types And cleaned up here and there. Issue-ID: MULTICLOUD-1143 Change-Id: I9b72c77ba34a1febd5df4a339e87968ddc4a7891 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-29Use project name provided by API in DCMIgor D.C1-5/+3
DCM apply/terminate code was still using a hardcoded "test-project" string for the project name that logical clouds should associate to. This simple patch makes DCM use the project name provided by the API. It also checks that the project exists before creating a Logical Cloud. Issue-ID: MULTICLOUD-1143 Change-Id: I05c8a2309ed07a7c96da30bf2461c43abaccc9d5 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-28Request CSR approvals via /subresource levelIgor D.C1-1/+64
Make use of the new /subresource level (under a resource) to request rsync to process approvals (a K8s subresource) for CSRs. Generic usage of instructions (order, dependency) for consistency. This also introduces a 'subresources' package in 'appcontext' with the first member being the approval subresource. Since subresources aren't necessarily created with yaml, this package will allow developers to specify what should be the "interface" in appcontext for each type of subresource when the different services need to exchange this data (e.g. DCM and rsync). Issue-ID: MULTICLOUD-1143 Change-Id: I8c85b4ee8c5654036a1c7ebb39d111ba4518b468 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-28Merge "Implement rest of Apply operation in DCM"Ritu Sood1-23/+88
2020-09-28Merge "Implement Terminate operation in DCM"Ritu Sood1-0/+90
2020-09-28Fix special characters issue in quotas in DCMIgor D.C1-2/+4
Before this patch, any resource quotas, say, with a dot (like limits.cpu), would not be stored properly in the database and thus unusable and ignored by DCM logical cloud apply operation. Issue-ID: MULTICLOUD-1143 Change-Id: I178e66756bc9bb2798427233d15196d0e2559a99 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-26Implement rest of Apply operation in DCMIgor D.C1-23/+88
"Rest of" meaning the Apply operation now effectively instantiates logical cloud resources on K8s cluster. More specifically, this commit now enables: - DCM calling rsync over gRPC on apply - The following K8s resources are now being created per cluster: - namespace, csr, resourcequotas, roles, rolebindings - Tested-working for multiple clusters simultaneously - Generating and storing logical cloud user private key in MongoDB This commit doesn't include any logic to request or retrieve CSR approvals and signed user certificates. Issue-ID: MULTICLOUD-1143 Change-Id: I92c4270678d05a5cb531791cef199a7dd79403d3 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-25Implement Terminate operation in DCMIgor D.C1-0/+90
Also makes minor changes to non-terminate code as a side-effect of supporting the new Terminate operation (such as including tagContext in the LogicalCloudClient implementation of LogicalCloudManager interface). These changes are/will also be leveraged by other operations. Issue-ID: MULTICLOUD-1143 Change-Id: Idbd2ec9f6cf0e5584a0f51cf4c16144db56d9fa0 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-07-28DCM - fix code formatting via vscodeIgor D.C1-451/+424
Visual Studio Code automatic code formatting was performed on the 4 modified DCM files. Issue-ID: MULTICLOUD-1143 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com> Change-Id: I24d2b44181b5c0737df7cb4541f9eede0950211a
2020-04-20Implement Apply API for DCMItohan1-0/+451
This implents the Apply API. When the apply API is called, this reads from mongodb and creates resources in ETCD Issue-ID: MULTICLOUD-996 Signed-off-by: Itohan Ukponmwan <itohan.ukponmwan@intel.com> Change-Id: I5b9c8b44673e66296d1339b5b3f4afc5f4cae9cc