Skip to content

Commit f7842fa

Browse files
authored
Merge pull request #1 from harsh97/feature-store
Feature store
2 parents 64b530f + f635246 commit f7842fa

File tree

17 files changed

+5019
-0
lines changed

17 files changed

+5019
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.hcl
2+
.terraform
3+
*.tfvars
4+
fs_apigw_terraform.zip
5+
*.tfstate.*
6+
*.tfstate
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this
6+
software, associated documentation and/or data (collectively the "Software"), free of charge and under any and
7+
all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor
8+
hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or
9+
(ii) the Larger Works (as defined below), to deal in both
10+
11+
(a) the Software, and
12+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software
13+
(each a “Larger Work” to which the Software is contributed by such licensors),
14+
15+
without restriction, including without limitation the rights to copy, create derivative works of, display,
16+
perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have
17+
sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms.
18+
19+
This license is subject to the following condition:
20+
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must
21+
be included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
24+
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27+
IN THE SOFTWARE.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: terraform.zip
2+
terraform.zip:
3+
zip -r fs_apigw_terraform.zip main.tf variables.tf modules
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
This module handles opinionated Feature Store AuthN/AuthZ configuration using API Gateway on Oracle Cloud Infrastructure ([OCI][oci]). This stack is designed to be used with the [OCI Resource Manager][oci_rm] to enhance Feature store experience with AuthN/AuthZ in a single step. The stack can also be used with the [OCI Terraform Provider][oci_tf_provider] to deploy using local or CloudShell Terraform cli.
2+
3+
## Deploy Using Oracle Resource Manager
4+
5+
> ___NOTE:___ If you aren't already signed in, when prompted, enter the compartment <compartment_name> and user credentials. Review and accept the terms and conditions.
6+
7+
1. Click to download the [terraform bundle][https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://raw.githubusercontent.com/harsh97/oci-data-science-ai-samples/feature-store/feature_store/fs_apigw_terraform.zip]
8+
9+
1. Create a stack in OCI resource manager with the downloaded bundle
10+
11+
1. Follow the on-screen prompts and instructions to create the stack.
12+
13+
1. After creating the stack, click Terraform Actions, and select Plan.
14+
15+
1. Wait for the job to be completed, and review the plan.
16+
17+
1. To make any changes, return to the Stack Details page, click Edit Stack, and make the required changes. Then, run the Plan action again.
18+
19+
1. If no further changes are necessary, return to the Stack Details page, click Terraform Actions, and select Apply.
20+
21+
1. After the stack application is complete attach the auto-provisioned security rules to the respective service and node subnets of the OKE cluster.
22+
23+
### Prerequisites
24+
#### Required permissions:
25+
allow group <user_group> to manage orm-stacks in compartment <compartment_name>
26+
allow group <user_group> to manage orm-jobs in compartment <compartment_name>
27+
allow group <user_group> to read network-load-balancers in compartment <compartment_name>
28+
allow group <user_group> to read instances in compartment <compartment_name>
29+
allow group <user_group> to manage groups in compartment <compartment_name>
30+
allow group <user_group> to manage dynamic-groups in compartment <compartment_name>
31+
allow group <user_group> to manage functions-family in compartment <compartment_name>
32+
allow group <user_group> to manage virtual-network-family in compartment <compartment_name>
33+
allow group <user_group> to manage policies in tenancy
34+
35+
36+
### Running Terraform
37+
38+
After specifying the required variables you can run the stack using the following commands:
39+
40+
```bash
41+
terraform init
42+
```
43+
44+
```bash
45+
terraform plan -var-file=<path-to-variable-file>
46+
```
47+
48+
```bash
49+
terraform apply -var-file=<path-to-variable-file>
50+
```
51+
52+
```bash
53+
terraform destroy -refresh=false
54+
```
55+
56+
57+
## License
58+
59+
Copyright (c) 2021, 2024 Oracle and/or its affiliates.
60+
Released under the Universal Permissive License (UPL), Version 1.0.
61+
See [LICENSE](./LICENSE) for more details.
62+
63+
[oci]: https://cloud.oracle.com/en_US/cloud-infrastructure
64+
[oci_rm]: https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm
65+
[stack]: https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://raw.githubusercontent.com/harsh97/oci-data-science-ai-samples/feature-store/feature_store/fs_apigw_terraform.zip
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
provider "oci" {
2+
disable_auto_retries = "true"
3+
region = var.region
4+
}
5+
resource "random_string" "suffix" {
6+
length = 4
7+
special = false
8+
}
9+
10+
locals {
11+
compartment_id = var.use_nlb_compartment?data.oci_network_load_balancer_network_load_balancer.nlb.compartment_id:var.compartment_id
12+
}
13+
14+
data oci_network_load_balancer_network_load_balancer nlb {
15+
network_load_balancer_id = var.nlb_id
16+
}
17+
18+
module "feature_store_networking" {
19+
source = "./modules/feature_store_networking"
20+
kubernetes_nlb_id = var.nlb_id
21+
compartment_id = local.compartment_id
22+
subnet_name = "fs-gw-subnet"
23+
existing_subnet_id = var.api_gw_subnet_id
24+
use_existing_subnet = !var.automatically_provision_apigw_subnet
25+
create_security_rules = var.create_security_rules
26+
}
27+
28+
module "function" {
29+
source = "./modules/function"
30+
authorized_groups = var.authorized_user_groups
31+
compartment_id = local.compartment_id
32+
ocir_path = var.function_img_ocir_url
33+
subnet_id = module.feature_store_networking.subnet_id
34+
name_suffix = random_string.suffix.id
35+
}
36+
37+
module "api_gw" {
38+
source = "./modules/api_gw"
39+
compartment_id = local.compartment_id
40+
function_id = module.function.fn_id
41+
nlb_id = var.nlb_id
42+
subnet_id = module.feature_store_networking.subnet_id
43+
}
44+
45+
resource oci_identity_policy feature_store_policies {
46+
description = "FEATURE STORE: Policy allowing feature store to authenticate and authorize"
47+
name = "feature_store_gw_${random_string.suffix.id}"
48+
compartment_id = var.tenancy_ocid
49+
statements = concat(module.api_gw.policies, module.function.policies)
50+
lifecycle {
51+
ignore_changes = [defined_tags["Oracle-Tags.CreatedBy"], defined_tags["Oracle-Tags.CreatedOn"]]
52+
}
53+
}
54+
55+
56+

0 commit comments

Comments
 (0)