Skip to content

Commit 11fff08

Browse files
authored
Merge branch 'main' into add_ansible_sample
2 parents 8be089b + d25ff6d commit 11fff08

File tree

3 files changed

+45
-44
lines changed

3 files changed

+45
-44
lines changed

Management-Utilities/fsxn-rotate-secret/terraform/main.tf

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ resource "random_id" "id" {
1111
byte_length = 4
1212
}
1313
#
14-
# Create the assume role policy document for the Lambda function.
14+
# Create a local variable for the Lambda function name, so it can be used in two places without causing a cycle.
15+
locals {
16+
lambdaName = "fsxn_rotate_secret-${random_id.id.hex}"
17+
}
18+
#
19+
# Create the policy document for the assume role policy for the Lambda function role.
1520
data "aws_iam_policy_document" "assume_role" {
1621
statement {
1722
effect = "Allow"
@@ -25,8 +30,8 @@ data "aws_iam_policy_document" "assume_role" {
2530
}
2631
}
2732
#
28-
# Create the inline policy document for the Lambda function role.
29-
data "aws_iam_policy_document" "inline_permissions" {
33+
# Create a policy document for the policy for the Lambda function role.
34+
data "aws_iam_policy_document" "lambda_permissions" {
3035
#
3136
# The frist two statements are required for the lambda function to write logs to CloudWatch.
3237
# While not required, are useful for debugging.
@@ -75,20 +80,18 @@ data "aws_iam_policy_document" "inline_permissions" {
7580
}
7681
}
7782
#
78-
# Create a local variable for the Lambda function name, so it can be used in two places without causing a cycle.
79-
locals {
80-
lambdaName = "fsxn_rotate_secret-${random_id.id.hex}"
81-
}
82-
#
8383
# Create the IAM role for the Lambda function.
84-
resource "aws_iam_role" "iam_for_lambda" {
85-
name = "iam_for_lambda-${random_id.id.hex}"
84+
resource "aws_iam_role" "role_for_lambda" {
85+
name = "rotate_fsxn_secret_role_${random_id.id.hex}"
8686
description = "IAM role for the Rotate FSxN Secret Lambda function."
8787
assume_role_policy = data.aws_iam_policy_document.assume_role.json
88-
inline_policy {
89-
name = "required_policy"
90-
policy = data.aws_iam_policy_document.inline_permissions.json
91-
}
88+
}
89+
#
90+
# Create the policy based on the policy document.
91+
resource "aws_iam_role_policy" "lambda_permissions" {
92+
name = "rotate_fsxn_secret_policy_${random_id.id.hex}"
93+
role = aws_iam_role.role_for_lambda.name
94+
policy = data.aws_iam_policy_document.lambda_permissions.json
9295
}
9396
#
9497
# Create the archive file for the Lambda function.
@@ -103,7 +106,7 @@ resource "aws_lambda_function" "rotateLambdaFunction" {
103106
provider = aws.secrets_provider
104107
function_name = local.lambdaName
105108
description = var.svm_id != "" ? "Lambda function to rotate the secret for SVM (${var.svm_id})." : "Lambda function to rotate the secret for FSxN File System (${var.fsx_id})."
106-
role = aws_iam_role.iam_for_lambda.arn
109+
role = aws_iam_role.role_for_lambda.arn
107110
runtime = "python3.12"
108111
handler = "fsxn_rotate_secret.lambda_handler"
109112
filename = "fsxn_rotate_secret.zip"

Management-Utilities/fsxn-rotate-secret/terraform/output.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ output "lambda_name" {
2020

2121
output "role_arn" {
2222
description = "The ARN of the role that was created that allows the Lambda function to rotate the secret."
23-
value = aws_iam_role.iam_for_lambda.arn
23+
value = aws_iam_role.role_for_lambda.arn
2424
}
2525

2626
output "role_name" {
2727
description = "The name of the role that was created that allows the Lambda function to rotate the secret."
28-
value = aws_iam_role.iam_for_lambda.name
28+
value = aws_iam_role.role_for_lambda.name
2929
}

Solutions/EKS-logs-to-ELK/README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,25 @@
33

44
A multi log solution using NetApp FSxN and Trident for collecting non-stdout logs from applications.
55

6-
7-
8-
96
## The problem
10-
* Lets say you have your default application stream but you also want to maintain an access log and an audit log, each log has its own foramt, its own wirte frequesncy and even different permissions.
11-
* There is a need to save each type in a different file but the same goal of collecting these logs and pushing them to log aggreagtion engines/storage.
12-
* The chalange is that these file are located on the disposible Pod storage and cannot be accessed or streamed same as std out/std error logs.
7+
* Lets say you have your default application stream but you also want to maintain an access log and an audit log, each log has its own format, its own write frequency and even different permissions.
8+
* There is a need to save each type in a different file but the same goal of collecting these logs and pushing them to log aggregation engines/storage.
9+
* The challenge is that these file are located on the disposable Pod storage and cannot be accessed or streamed same as std out/std error logs.
1310
* A more advance but still common scenario is when a container has more than one log stream / file.
1411

15-
16-
17-
1812
## Collecting logs using FSxN Trident persistent storage
1913

20-
With FSxN and Trident, you can create a shared namespace persistent storage platform and collect non-stdout logs into one location (ElasticSearch, Loki, S3, etc..), overcoming the common obstacles faced when implementing multilog solutions.
14+
With FSxN and Trident, you can create a shared namespace persistent storage platform and collect non-stdout logs into one location (ElasticSearch, Loki, S3, etc..), overcoming the common obstacles faced when implementing multi log solutions.
2115

22-
23-
24-
25-
26-
### Solution Architecture Example
2716
## Getting Started
2817

29-
The following sections provide quickstart instructions for multiple logs shippers. All of these assume that you have cloned this repository locally and are using a CLI thats current directory is the root of the code repository.
18+
The following section provide quick start instructions for multiple logs shippers. All of these assume that you have cloned this repository locally and you are using a CLI with its current directory set to the root of the code repository.
3019

3120
### Prerequisites
3221

33-
* `Helm` - for reources installation.
22+
* `Helm` - for resource installation.
3423
* `Kubectl` – for interacting with the EKS cluster.
35-
* NetApp FSxN running on the same EKS vpc.
24+
* NetApp FSxN running on the same EKS VPC.
3625
* TCP NFS ports should be open between the EKS nodes and the FSxN:
3726
`111`,
3827
`2049`,
@@ -41,13 +30,17 @@ The following sections provide quickstart instructions for multiple logs shipper
4130
`4046`,
4231
`4049` - [Check NetAppKB instructions](https://kb.netapp.com/onprem/ontap/da/NAS/Which_Network_File_System_NFS_TCP_and_NFS_UDP_ports_are_used_on_the_storage_system)
4332
* Kubernetes Snapshot Custom Resources (CRD) and Snapshot Controller installed on EKS cluster:
44-
Learn more about the snapshot requirements for your cluster in the ["How to Deploy Volume Snapshots”](https://kubernetes.io/blog/2020/12/10/kubernetes-1.20-volume-snapshot-moves-to-ga/#how-to-deploy-volume-snapshots) Kuberbetes blog.
33+
Learn more about the snapshot requirements for your cluster in the ["How to Deploy Volume Snapshots”](https://kubernetes.io/blog/2020/12/10/kubernetes-1.20-volume-snapshot-moves-to-ga/#how-to-deploy-volume-snapshots) Kubernetes blog.
4534
* NetApp Trident operator CSI should be installed on EKS. [Check Trident installation guide using Helm](https://docs.netapp.com/us-en/trident/trident-get-started/kubernetes-deploy-helm.html#deploy-the-trident-operator-and-install-astra-trident-using-helm).
4635

4736
### Installation
4837

4938
* Configure Trident CSI backend to connect to the FSxN file system. Create the backend configuration for the trident driver. Create secret on trident namespace and fill the FSxN password:
50-
```kubectl create secret generic fsx-secret --from-literal=username=fsxadmin --from-literal=password=<your FSxN password> -n trident --create-namespace```
39+
40+
```
41+
kubectl create secret generic fsx-secret --from-literal=username=fsxadmin --from-literal=password=<your FSxN password> -n trident --create-namespace
42+
```
43+
5144
* Install trident-resources helm chart from this GitHub repository.
5245
The custom Helm chart includes:
5346
- `backend-tbc-ontap-nas.yaml` - backend configuration for using NFS on EKS
@@ -58,17 +51,21 @@ The following sections provide quickstart instructions for multiple logs shipper
5851

5952
The following variables should be filled on the Values.yaml or run the following by using `--set` Helm command.
6053

61-
* `namespace` - namespace of the Trident operator
54+
* `namespace` - namespace of the Trident operator. Typically 'trident'.
6255
* `fsx.managment_lif` - FSxN ip address
6356
* `fsx.svm_name` - FSxN SVM name
6457
* `configuration.storageclass_nas` - NAS storage class name
6558
* `configuration.storageclass_san` - SAN (ISCSI) storage class name
6659

6760
Then use helm to deploy the package:
68-
```helm install trident-resources ./trident-resources -n trident```
61+
```
62+
helm install trident-resources ./trident-resources -n trident
63+
```
6964

7065
Verify that FSxN has been successfully connected to the backend:
71-
```kubectl get TridentBackendConfig -n trident```
66+
```
67+
kubectl get TridentBackendConfig -n trident
68+
```
7269

7370
### Implementing a sample application for collecting logs
7471

@@ -91,7 +88,7 @@ spec:
9188
storage: 100Gi
9289
storageClassName: trident-csi
9390
```
94-
* `trident.netapp.io/shareFromPVC:` The primary PersistentVolumeClaim you have created previously.
91+
* `trident.netapp.io/shareFromPVC:` The primary PersistentVolumeClaim you have created previously.
9592
* `storage` - volume size
9693

9794
##### **volume-reference-fsx.yaml**:
@@ -136,7 +133,9 @@ spec:
136133

137134
Installing an example application by helm:
138135

139-
```helm upgrade --install example-app ./examples/example-app -n rpc --create-namespace```
136+
```
137+
helm upgrade --install example-app ./examples/example-app -n rpc --create-namespace
138+
```
140139

141140
When the application is deployed, you should be able to see the PVC as a mount at /log.
142141

@@ -151,7 +150,6 @@ Install Vector.dev agent as DeamonSet from [Helm chart](https://vector.dev/docs/
151150
1. Clone vector GitHub repository:
152151
```
153152
git clone https://github.com/vectordotdev/helm-charts.git
154-
155153
```
156154

157155
2. Adding override values:
@@ -363,4 +361,4 @@ Unless required by applicable law or agreed to in writing, software distributed
363361

364362
See the License for the specific language governing permissions and limitations under the License.
365363

366-
© 2024 NetApp, Inc. All Rights Reserved.
364+
© 2024 NetApp, Inc. All Rights Reserved.

0 commit comments

Comments
 (0)