> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fastfoundation.nimble.la/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Manifest Files

> Configure Kubernetes manifest files for your application deployment using ArgoCD

## Prerequisites

* Access to the Fast Foundation manifest repository
* Output values from the AWS Resources step
* Basic understanding of Kubernetes concepts

***

## Step-by-Step Process

### 1. Add Application to Cluster Configuration

Navigate to your manifest repository and open the file `clusters/<cluster_name>/ruling-app/<environment>/values.yaml`.

Add your application configuration under the `application:` field.\
Make sure you have the [output values from the AWS Resources step](/application-creation/2-create-aws-resources#example-output) ready, since you'll need them to replace placeholders in the YAML config.

<CodeGroup>
  ```yaml Cluster Configuration theme={null}
    your-app-name:
      # appType: standard-application
      ingressRule: Host(`your-app.dev.your-domain.com`)
      port: 3000
      replicas: 1
      nodePoolTier: application
      image:
        registry: "1110987654321.dkr.ecr.us-east-1.amazonaws.com"  # From ecr_repository output
        repository: "development/application/your-app-name"       # Rest of ecr_repository
      env:
        awsSecretId: "environment/your-app-name/env-cDkfzs"       # From static_secret output
        mountPath: "/mnt"
      mainContainer:
        resources: 
          limits:
            cpu: 250m
            memory: 512Mi
          requests:
            cpu: 250m
            memory: 512Mi
        # Configure health check probes according to your application's requirements
        # startupProbe: Gives your app time to start up (especially for slow-starting apps)
        # livenessProbe: Detects if your app is still running (restarts container if failing)
        # readinessProbe: Determines if your app is ready to receive traffic
        startupProbe:
          httpGet:
            port: 3000
            path: "/api/healthz" 
          failureThreshold: 30
          periodSeconds: 5
        
        livenessProbe:
          httpGet:
            port: 3000
            path: "/api/healthz"
          failureThreshold: 4
          periodSeconds: 20
          timeoutSeconds: 2
        
        readinessProbe:
          httpGet:
            port: 3000
            path: "/api/healthz"
  ```
</CodeGroup>

***

### 2. Configure Environment-Specific Values

Replace these values with your AWS Resources output:

| Field              | Description                           | Source                                         |
| ------------------ | ------------------------------------- | ---------------------------------------------- |
| `env.awsSecretId`  | Secret name for environment variables | Everything after `:secret:` in `static_secret` |
| `image.registry`   | ECR registry URL                      | First part of `ecr_repository`                 |
| `image.repository` | Image repository path                 | Remaining part of `ecr_repository`             |

***

### 3. Create Application Directory Structure

```

environments/
└── <environment>/
    └── apps/
        └── <app_name>/
            ├── values.yaml
            └── Chart.yaml
```

***

### 4. Create values.yaml

Create `environments/<environment>/apps/<app_name>/values.yaml`:

<CodeGroup>
  ```yaml values.yaml theme={null}
  standard-application:
    image:
      tag: default-12kmkjas9
  ```
</CodeGroup>

<Note>
  The image tag can be any placeholder like `default-12kmkjas9` or `development-application-deployment-6b0f2da7` until a real image is built.
</Note>

***

### 5. Create Chart.yaml

Create `environments/<environment>/apps/<app_name>/Chart.yaml`:

<CodeGroup>
  ```yaml Chart.yaml theme={null}
  apiVersion: v2
  name: standard-application
  description: application helm chart

  version: 0.1.0
  appVersion: "1.0"

  dependencies:
  - name: standard-application
    version: 0.1.0
    repository: file://../../charts/standard-application
  ```
</CodeGroup>

***

### 6. Configure Dockerfile and Entrypoint

Since a secret is automatically mounted at `/mnt/.env`, configure your app to load environment variables from that file.

#### Entrypoint Script (Node.js Example)

<CodeGroup>
  ```bash entrypoint.sh theme={null}
  #!/bin/bash

  # Load environment variables from mounted secret
  if [ -f /mnt/.env ]; then
      export $(cat /mnt/.env | grep -v '^#' | xargs)
  fi

  exec "$@"
  ```
</CodeGroup>

#### Dockerfile Example (Node.js)

<CodeGroup>
  ```dockerfile Dockerfile theme={null}
  FROM node:18-alpine

  WORKDIR /app
  COPY . /app

  RUN npm install

  COPY entrypoint.sh /entrypoint.sh
  RUN chmod +x /entrypoint.sh

  EXPOSE 3000
  ENTRYPOINT ["/entrypoint.sh"]
  CMD ["npm", "start"]
  ```
</CodeGroup>

***

### 7. Deploy to ArgoCD

Push your changes to the main branch:

```bash theme={null}
git add .
git commit -m "Add application manifest files"
git push origin main
```

ArgoCD will automatically detect the changes and deploy your application.

***

### 8. Verify Deployment

1. Go to your ArgoCD dashboard
2. Find your application in the list
3. Check the sync status
4. Review logs if there are issues

***

## Manifest Fields Reference

### Environment Configuration

| Field              | Description                     | Example                                     |
| ------------------ | ------------------------------- | ------------------------------------------- |
| `env.secretid`     | AWS Secrets Manager secret name | `development/app_name/env-ABC123`           |
| `image.registry`   | Container registry URL          | `123456789.dkr.ecr.us-east-1.amazonaws.com` |
| `image.repository` | Image repository path           | `development/application/app_name`          |
| `image.tag`        | Image tag                       | `latest`, `v1.0.0`, `test-6b0f2da7`         |

### Resource Configuration

| Field                       | Description             | Recommended |
| --------------------------- | ----------------------- | ----------- |
| `resources.requests.memory` | Minimum memory required | `256Mi`     |
| `resources.requests.cpu`    | Minimum CPU required    | `100m`      |
| `resources.limits.memory`   | Maximum memory allowed  | `512Mi`     |
| `resources.limits.cpu`      | Maximum CPU allowed     | `500m`      |

***

## Next Steps

Once manifests are created and ArgoCD has synced them, continue to [Configure CI/CD](/application-creation/4-configure-cicd).

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Application Not Appearing in ArgoCD">
    * Check that you pushed to the `main` branch
    * Verify the directory structure is correct
    * Check ArgoCD logs for sync errors
  </Accordion>

  <Accordion title="Secret Not Found Error">
    * Verify the secret ID matches AWS output
    * Confirm the secret exists in AWS Secrets Manager
    * Ensure the IAM role can read the secret
  </Accordion>

  <Accordion title="Image Pull Errors">
    * Verify the ECR repository URL is correct
    * Check the image tag exists in the repository
    * Ensure the service account has ECR pull permissions
  </Accordion>
</AccordionGroup>
