summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2020-11-18Improve early-detection of empty templateKonrad Bańka7-13/+104
Previous empty template detection pattern matched only against templates resolved to empty-or-whitespace-only files. This change makes it handle other case of empty yaml correctly, namely, yaml containing comments only. Issue-ID: MULTICLOUD-1252 Signed-off-by: Konrad Bańka <k.banka@samsung.com> Change-Id: I9132e167ec607c8a4a4ca5584141ed043c6ddd4f
2020-10-16Merge "Restore commented unit test TestDeleteLogicalCloud"Eric Multanen5-39/+48
2020-10-16Merge "delete should return 404 error for invalid name"Eric Multanen1-1/+6
2020-10-10Restore commented unit test TestDeleteLogicalCloudIgor D.C5-39/+48
Restore the previously commented-out unit test TestDeleteLogicalCloud. That test was disabled due to a failure introduced by interacting with AppContext for the first time in module/logicalcloud.go and it not being ready to do so. This commit restores it and modifies code so dependent mocks can plug in correctly. This was done in order to keep testing the code that was previously being tested, not so much to add additional coverage. Although it would be a significant undertaking, the different types and interfaces in pkg/module should be redesigned to achieve better decoupling and thus make unit testing more straightforward. Issue-ID: MULTICLOUD-1143 Change-Id: I1e6b7bb9111fc6883f0c9cee887329a9e0b27fbd Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-08Fix mispelled key name in kubeconfigIgor D.C1-1/+1
Fixes the mispelled "currentcontext" with the right key name "current-context" which was introduced as a regression with or before the latest version of the kubeconfig code (probably a bad search/replace). This 1-character long bug was preventing the generated kubeconfigs from being correctly interpreted by kubectl. Thus, kubectl couldn't set any context of the kubeconfig as the current context. Observable output before this fix: $ kubectl get pods The connection to the server localhost:8080 was refused - did you specify the right host or port? Issue-ID: MULTICLOUD-1143 Change-Id: I617d1e20b7be2567729b84d3746b22e4ceaf8b9d Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-08Reduce duplication around DeleteCompositeApp callsIgor D.C1-124/+36
DCM's apply function had a lot of error handling code that cleans up the AppContext if something goes wrong while adding to AppContext. Most of that handling was using multiline duplicate code with the only change being in the log/error strings. This commit attempts to reuse all that error handling code and make it easier to follow main code. Issue-ID: MULTICLOUD-1143 Change-Id: I3a35387b1ed46279c1b973dbd852352276ff5cc8 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-05Merge "Remove unused mongo db methods from emco code"Ritu Sood4-634/+0
2020-10-05Merge "Ovnaction and vfw updates for deploy api change"Ritu Sood18-455/+320
2020-10-05Merge "Modify GenericPlacement APIs to include DepIntGrp"Ritu Sood12-88/+204
2020-10-02Ovnaction and vfw updates for deploy api changeEric Multanen18-455/+320
Update the ovnaction controller APIs to support the api change of including the deployment intent group in the URL. Also fixup: - vfw and other test cases to support the change - updates to emcoctl tool and examples Issue-ID: MULTICLOUD-1218 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Icadacb5ec6d7c238bb3bf8a44a39c30692ecebee
2020-10-02Modify GenericPlacement APIs to include DepIntGrpRajamohan Raj12-88/+204
Modify the genericPlacementIntent API such that deploymentIntentGroup becomes a mandatory parameter. Issue-ID: MULTICLOUD-1218 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com> Change-Id: I33d2eeac5b60228e9c08921c9347b1b6aa3f8d28
2020-10-02DCM E2E testing fixesIgor D.C3-5/+8
A set of small fixes after discovery during DCM's end-to-end testing: - properly detect that a cert hasn't been issued yet (don't crash) - in Monitor, don't pass namespace when querying for CSRs - fixed incorrect /kubeconfig file encoding from yaml to json Issue-ID: MULTICLOUD-1143 Change-Id: Ie813e377070b0751f0bfdabac8da50e3288090de Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-02Merge "Set name of resources correctly in appcontext"Ritu Sood1-36/+38
2020-10-02Merge "Reimplement Terminate to be compatible with Status"Ritu Sood4-63/+133
2020-10-02Remove unused mongo db methods from emco codeEric Multanen4-634/+0
Remove the set of unused (legacy from v1) mongo db methods so that they are not used in the emco code base. Issue-ID: MULTICLOUD-1227 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Ibe94892e5b1d0f33192be7ea3db5c55b3f8cbf60
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.C4-63/+133
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-02Adding CSR Approval functionalityRitu Sood5-8/+220
Update rsync to be able to approve CSR Issue-ID: MULTICLOUD-1143 Signed-off-by: Ritu Sood <ritu.sood@intel.com> Change-Id: I0b2bec3475a3453a2d8fc9c2e87cfc4531b0e2f3
2020-10-02Improve DCM test script: apply, term, kubeconfigIgor D.C1-30/+39
Adds apply and terminate operations, while decoupling them in two different script branches. Add kubeconfig test into a third script branch. Also, $cluster_2_name wasn't defined, so this fixes that. Issue-ID: MULTICLOUD-1143 Change-Id: I574934078644ec83224bcac74b5b17783330aaaa Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-10-02Merge "Fix rsync retry logic for unreachable cluster"Ritu Sood1-1/+1
2020-10-01Fix rsync retry logic for unreachable clusterEric Multanen1-1/+1
Fix rsync to only retry reaching clusters until the timeout occurs. Issue-ID: MULTICLOUD-1226 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: I5e8202358cfd8cdd15c9feb4fcbefe2683b7139a
2020-10-01Subtle refactoring in a few functionsIgor D.C7-99/+186
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-10-01Fix arg mismatch in GetLogicalCloudContextIgor D.C1-1/+1
The previous commits were merged in the wrong order, which caused a bad 3-way merge resulting in the arg mismatch as witnessed below: k8s/src/dcm/pkg/modulepkg/module/cluster.go:263:57: not enough arguments in call to lcClient.GetLogicalCloudContext have (string) want (string, string) Makefile:13: recipe for target 'all' failed make: *** [all] Error 2 The CI merge job doesn't run tests before merging, so this slipped in. Issue-ID: MULTICLOUD-1143 Change-Id: I0168345af6bac7886cba32d958f241687ab24a81 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-30Merge "Implement Kubeconfig endpoint in DCM"Ritu Sood6-14/+267
2020-09-30Merge "Update ResourceBundleState CRD and monitor-deploy"Eric Multanen1-0/+5
2020-09-30Merge "Fix Status API to actually provide instance status"Eric Multanen6-313/+188
2020-09-30Update ResourceBundleState CRD and monitor-deployIgor D.C1-0/+5
Update ResourceBundleState CRD and monitor-deploy.yaml with csrStatuses. This was missing from the previous patch implementing CSR support in Monitor. Depending on how the environment was brought up, attempting to read the CSR would result in forbidden access. Issue-ID: MULTICLOUD-1143 Change-Id: I86ffb8df8faa045e57fd553e5784d308e1900ee4 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-30Merge "Add DCM to K8s deployment file"Ritu Sood1-10/+2
2020-09-30delete should return 404 error for invalid nameAditya Sharoff1-1/+6
Issue-ID: MULTICLOUD-1150 Change-Id: I04c9584e35672b6b40047a67be4d2026002204e1 Signed-off-by: Aditya Sharoff <aditya.sharoff@intel.com>
2020-09-30Add DCM to K8s deployment fileIgor D.C1-10/+2
Issue-ID: MULTICLOUD-1143 Change-Id: Iaca9bd6cb3614e0ae825d9231476524ce09db550 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-30Fix Status API to actually provide instance statusKonrad Bańka6-313/+188
Provide information about instance resources and Pods inside status response. Issue-ID: MULTICLOUD-1177 Signed-off-by: Konrad Bańka <k.banka@samsung.com> Change-Id: Iee6fd56120d091dddfa6b6d0e4aa7eb36d40e888
2020-09-29Use project name provided by API in DCMIgor D.C4-12/+21
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-29Implement Kubeconfig endpoint in DCMIgor D.C6-14/+267
The /kubeconfig API path allows a client to retrieve a kubeconfig file for a specified cluster reference of a logical cloud. - includes CA cert, address, user private key and signed cert. This commit includes the "lazy-loading" implementation of certificate retrieval per cluster from Rsync (which happens when clients call). The certificate is read from the cluster status in appcontext. Thus, Monitor and Rsync need to be configured and running. Issue-ID: MULTICLOUD-1143 Change-Id: Ie94cd128e14c8a944861eced2bdc886d95fab6ed Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-28Merge "Add a couple of sanity checks in DCM"Ritu Sood3-1/+21
2020-09-28Request CSR approvals via /subresource levelIgor D.C3-1/+93
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 Sood5-7/+179
2020-09-28Fix special characters issue in quotas in DCMIgor D.C2-4/+8
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-26Add a couple of sanity checks in DCMIgor D.C3-1/+21
When applying, check whether logical cloud is already applied. When deleting logical cloud, check if it exists. Issue-ID: MULTICLOUD-1143 Change-Id: I6aa11d8921db76e3d9e9632f915b55fe7ab8efab Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-25Implement Terminate operation in DCMIgor D.C5-7/+179
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-09-25Introduce Monitor support for CSR resourceIgor D.C7-11/+288
These changes allow the Monitor to also track CSR (CertificateSigningResource) resources which will make it possible to know when a certificate has been issued by the K8s cluster signer. In turn, DCM will be able to read, store and use that certificate to generate kubeconfigs. Out-of-tree actions required: - publish monitor's docker image built from this source onto emcov2/monitor:latest Issue-ID: MULTICLOUD-1143 Change-Id: I7facd27bbfe08891151bb3b6a9a19948435e24e4 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-25Merge "Enhance error handling and HTTP codes in DCM"Ritu Sood10-19/+74
2020-09-25If getAppContextStatus fails, cancel waitForDoneIgor D.C1-1/+7
And log error appropriately. Essentially, add basic error handling and return from waitForDone. It is possible to trigger this error easily by having an rsync client wipe out etcd right after issuing an InvokeUninstallApp, as demonstrated by DCM (before it was adapted to use the new asynchronous rsync). Issue-ID: MULTICLOUD-1143 Change-Id: Id5c0d8da928738cb3cdc862eaefdb91db2eadf5f Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-25Enhance error handling and HTTP codes in DCMIgor D.C10-19/+74
This improves error handling between DCM and the database resources and adds/corrects a lot more HTTP return codes in the API, respectively. Issue-ID: MULTICLOUD-1143 Change-Id: I3abc8025660e042f4c946f8bbfd280e1eb4c9583 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-25Merge "Let instructions exist under /subresource level"Ritu Sood1-1/+1
2020-09-24Add default/template config.json for DCMIgor D.C1-0/+14
DCM listening on port 9077 as default. The IP addresses for MongoDB and etcd are what we get by default on docker installations of those using emco deployments. Issue-ID: MULTICLOUD-1143 Change-Id: I9b30b278e3cf4fdb428665986e05c6916000b4e7 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
2020-09-24Let instructions exist under /subresource levelIgor D.C1-1/+1
Instructions (order/dependency) can now belong to an app, a resource or a subresource. Issue-ID: MULTICLOUD-1143 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com> Change-Id: Iee55c2bbb569de242e66f5a5456ac52025a00f0e
2020-09-24Cleanup tmp resources after instantiationRajamohan Raj2-10/+65
In this patch,we clean up the tmp files and directories generated during the process of instantiation. They include the tmp dirs with prefix : /tmp/helm-tmpl and /tmp/k8s-ext Issue-ID: MULTICLOUD-1206 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com> Change-Id: I02d11bb2f8d920e35aae7343f041a53b1cd3f057
2020-09-24initial commit of emcoui web appvikaskumar73-0/+24198
Signed-off-by: vikaskumar <vkumar@aarnanetworks.com> Change-Id: I78b2f9f4ec3aa0b7a660a21e2ee2d61a3cddadc6 Issue-ID: MULTICLOUD-1225