Skip to content

feat(infra): bootstrap scoped DuckFleet development CI - #1083

Merged
athvin merged 1 commit into
mainfrom
feat/duckfleet-ci-bootstrap
Nov 10, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/duckfleet-ci-bootstrap

Conversation

@athvin

@athvin athvin commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #1082

What

Bootstrap a separate DuckFleet deployment identity and restricted development namespace on er-dev. The platform owns worker IAM/Pod Identity, namespace security, quotas and RBAC; DuckFleet CI can deploy only its application and manage its own bucket, images and state.

Why

DuckFleet cannot use ER's repository-bound OIDC roles. This supplies a reviewed CI deployment path without granting it IAM/EKS writes, ER state access, or permissions in ER namespaces.

Proof

Terraform dev stack validates; mocked IAM/trust tests pass. Six bootstrap objects pass kubeconform. Positive/negative RBAC tests, infra detector fixtures and actionlint pass. Shared skills/workflow/static-credential gates pass. The CI plan adds 6 dev identity resources, with zero changes/deletions and no core/prod changes. Live convergence must be verified after merge; no AWS writes were performed locally.

Risk & rollback

Adds a main-only identity for a separate trusted development product in the shared account. The namespace is not a customer SQL sandbox. Revert stops future convergence; removing live identities/resources requires an explicit retention/cleanup decision. No existing resource is intentionally changed or destroyed.

Post-merge ledger

Closed by: Codex · session 01a1c2cf-3c1c-7850-96f1-501a0189fca1 on Mac-100.lan · 2026-11-10T21:56:54.982903+00:00

  • main is green with this change on it — fcf0a1f55e5c6f6ca3f55c3295b92471cab2fe6c; Rust, infra, frontend and devcontainer all succeeded on that SHA.
  • images — workflow succeeded; product image inputs did not change and its image jobs correctly skipped.
  • deploy converged — dev and prod deployment succeeded. Both running API previews returned /readyz -> 200 and web previews /api/healthz -> 200; production public readiness stayed healthy through the three-minute cutover window.
  • push-only surface — Terraform applies and cluster-objects both succeeded. Unchanged nightly probes owe no new configuration-specific run.
  • board card — Bootstrap namespace-scoped DuckFleet CI on the shared dev cluster #1082 closed through this PR and Product Roadmap status reads Done automatically.
  • follow-ups — n/a — bootstrap is fully applied. Application validation continues in DuckFleet #5.
  • learning recorded — ownership/trust/RBAC design in infrastructure.md; applied evidence and CI links in this ledger.

Specific to this change

  • Dev Terraform created the dedicated CI/worker identities, EKS access entry and Pod Identity association. Read-only inspection confirmed the exact immutable main subject, duckfleet:deploy group and duckfleet-dev/duckfleet-worker association.
  • Dev cluster-objects applied the namespace with restricted Pod Security, 8 CPU/10 GiB limits and the dedicated binding. The script's dev-only surface excludes DuckFleet from prod; both apply legs passed.
  • DuckFleet CI proved effective permissions: scripts/aws/check-access.sh succeeded in run 42908611160, including denied ER secret/RBAC/quota access, before any application apply.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

terraform plan

4f3da2f · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 0
dev 6 0 0
prod 0 0 0

Planned with -refresh=false, so this is the config-versus-state diff and
not out-of-band drift. That is a security choice, not a speed one: a refreshing
plan reads secret values, and the plan role is assumable from any PR branch —
which can edit the workflow it runs under. Drift is caught at apply time, which
refreshes fully.

dev — 6 to add, 0 to change
data.aws_iam_policy_document.efs_csi_trust: Reading...
data.aws_caller_identity.current: Reading...
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.er_api_pod_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso: Read complete after 0s [id=1725605485]
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_region.current: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_region.current: Read complete after 0s [id=us-east-2]
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
module.network.data.aws_region.current: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
module.eks.data.aws_iam_policy_document.node_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=4006586444]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=3111493560]
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=2205495074]
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=2921565705]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.bedrock_invoke: Reading...
data.aws_iam_policy_document.bedrock_invoke: Read complete after 0s [id=3601248236]
data.aws_rds_engine_version.aurora_pg: Read complete after 1s [id=17.9]
module.network.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
data.aws_iam_policy_document.ci_deploy_dev: Reading...
data.aws_iam_policy_document.ci_deploy_dev: Read complete after 0s [id=1754478413]
data.aws_iam_openid_connect_provider.github: Read complete after 1s [id=arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com]
data.aws_iam_policy_document.ci_deploy_dev_trust: Reading...
data.aws_iam_policy_document.ci_deploy_dev_trust: Read complete after 0s [id=4060172364]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.duckfleet_ci.aws_eks_access_entry.ci will be created
  + resource "aws_eks_access_entry" "ci" {
      + access_entry_arn  = (known after apply)
      + cluster_name      = "er-dev"
      + created_at        = (known after apply)
      + id                = (known after apply)
      + kubernetes_groups = [
          + "duckfleet:deploy",
        ]
      + modified_at       = (known after apply)
      + principal_arn     = (known after apply)
      + region            = "us-east-2"
      + tags              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + tags_all          = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + type              = "STANDARD"
      + user_name         = (known after apply)
    }

  # module.duckfleet_ci.aws_eks_pod_identity_association.worker will be created
  + resource "aws_eks_pod_identity_association" "worker" {
      + association_arn      = (known after apply)
      + association_id       = (known after apply)
      + cluster_name         = "er-dev"
      + disable_session_tags = false
      + external_id          = (known after apply)
      + id                   = (known after apply)
      + namespace            = "duckfleet-dev"
      + region               = "us-east-2"
      + role_arn             = (known after apply)
      + service_account      = "duckfleet-worker"
      + tags                 = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + tags_all             = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
    }

  # module.duckfleet_ci.aws_iam_role.ci will be created
  + resource "aws_iam_role" "ci" {
      + arn                   = (known after apply)
      + assume_role_policy    = jsonencode(
            {
              + Statement = [
                  + {
                      + Action    = "sts:AssumeRoleWithWebIdentity"
                      + Condition = {
                          + StringEquals = {
                              + "token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
                              + "token.actions.githubusercontent.com:sub" = "repo:athvin@273880343/duck-fleet@1452020329:ref:refs/heads/main"
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Federated = "arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com"
                        }
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + create_date           = (known after apply)
      + force_detach_policies = false
      + id                    = (known after apply)
      + managed_policy_arns   = (known after apply)
      + max_session_duration  = 7200
      + name                  = "duckfleet-ci-dev"
      + name_prefix           = (known after apply)
      + path                  = "/"
      + tags                  = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + tags_all              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + unique_id             = (known after apply)

      + inline_policy (known after apply)
    }

  # module.duckfleet_ci.aws_iam_role.worker will be created
  + resource "aws_iam_role" "worker" {
      + arn                   = (known after apply)
      + assume_role_policy    = jsonencode(
            {
              + Statement = [
                  + {
                      + Action    = [
                          + "sts:AssumeRole",
                          + "sts:TagSession",
                        ]
                      + Condition = {
                          + StringEquals = {
                              + "aws:RequestTag/eks-cluster-arn"            = "arn:aws:eks:us-east-2:797781631727:cluster/er-dev"
                              + "aws:RequestTag/kubernetes-namespace"       = "duckfleet-dev"
                              + "aws:RequestTag/kubernetes-service-account" = "duckfleet-worker"
                            }
                        }
                      + Effect    = "Allow"
                      + Principal = {
                          + Service = "pods.eks.amazonaws.com"
                        }
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + create_date           = (known after apply)
      + force_detach_policies = false
      + id                    = (known after apply)
      + managed_policy_arns   = (known after apply)
      + max_session_duration  = 3600
      + name                  = "duckfleet-dev-worker"
      + name_prefix           = (known after apply)
      + path                  = "/"
      + tags                  = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + tags_all              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "duckfleet"
        }
      + unique_id             = (known after apply)

      + inline_policy (known after apply)
    }

  # module.duckfleet_ci.aws_iam_role_policy.ci will be created
  + resource "aws_iam_role_policy" "ci" {
      + id          = (known after apply)
      + name        = "duckfleet-dev-deploy"
      + name_prefix = (known after apply)
      + policy      = jsonencode(
            {
              + Statement = [
                  + {
                      + Action   = [
                          + "eks:DescribeCluster",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:eks:us-east-2:797781631727:cluster/er-dev",
                        ]
                      + Sid      = "DiscoverDev"
                    },
                  + {
                      + Action    = [
                          + "s3:ListBucket",
                        ]
                      + Condition = {
                          + StringLike = {
                              + "s3:prefix" = [
                                  + "duckfleet/*",
                                ]
                            }
                        }
                      + Effect    = "Allow"
                      + Resource  = [
                          + "arn:aws:s3:::er-terraform-state-797781631727",
                        ]
                      + Sid       = "ListOwnState"
                    },
                  + {
                      + Action   = [
                          + "s3:GetObject",
                          + "s3:PutObject",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::er-terraform-state-797781631727/duckfleet/dev.tfstate",
                          + "arn:aws:s3:::er-terraform-state-797781631727/duckfleet/dev.tfstate.tflock",
                        ]
                      + Sid      = "OwnState"
                    },
                  + {
                      + Action   = [
                          + "s3:DeleteObject",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::er-terraform-state-797781631727/duckfleet/dev.tfstate.tflock",
                        ]
                      + Sid      = "ReleaseOwnLock"
                    },
                  + {
                      + Action   = [
                          + "s3:CreateBucket",
                          + "s3:ListBucket",
                          + "s3:GetBucket*",
                          + "s3:GetEncryptionConfiguration",
                          + "s3:GetLifecycleConfiguration",
                          + "s3:GetReplicationConfiguration",
                          + "s3:GetAccelerateConfiguration",
                          + "s3:GetObjectLockConfiguration",
                          + "s3:PutBucketTagging",
                          + "s3:PutBucketPublicAccessBlock",
                          + "s3:PutBucketOwnershipControls",
                          + "s3:PutEncryptionConfiguration",
                          + "s3:PutBucketVersioning",
                          + "s3:PutBucketPolicy",
                          + "s3:PutLifecycleConfiguration",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::duckfleet-dev-797781631727-us-east-2",
                        ]
                      + Sid      = "OwnBucket"
                    },
                  + {
                      + Action   = [
                          + "ecr:GetAuthorizationToken",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "*",
                        ]
                      + Sid      = "RegistryLogin"
                    },
                  + {
                      + Action   = [
                          + "ecr:CreateRepository",
                          + "ecr:DescribeRepositories",
                          + "ecr:ListTagsForResource",
                          + "ecr:TagResource",
                          + "ecr:UntagResource",
                          + "ecr:PutImageTagMutability",
                          + "ecr:PutImageScanningConfiguration",
                          + "ecr:DescribeImages",
                          + "ecr:ListImages",
                          + "ecr:BatchCheckLayerAvailability",
                          + "ecr:BatchGetImage",
                          + "ecr:GetDownloadUrlForLayer",
                          + "ecr:InitiateLayerUpload",
                          + "ecr:UploadLayerPart",
                          + "ecr:CompleteLayerUpload",
                          + "ecr:PutImage",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:ecr:us-east-2:797781631727:repository/duckfleet-dev/worker",
                          + "arn:aws:ecr:us-east-2:797781631727:repository/duckfleet-dev/dbt",
                        ]
                      + Sid      = "OwnImages"
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + role        = (known after apply)
    }

  # module.duckfleet_ci.aws_iam_role_policy.lake will be created
  + resource "aws_iam_role_policy" "lake" {
      + id          = (known after apply)
      + name        = "duckfleet-lake-only"
      + name_prefix = (known after apply)
      + policy      = jsonencode(
            {
              + Statement = [
                  + {
                      + Action   = [
                          + "s3:GetObject",
                          + "s3:PutObject",
                          + "s3:DeleteObject",
                          + "s3:AbortMultipartUpload",
                          + "s3:ListMultipartUploadParts",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::duckfleet-dev-797781631727-us-east-2/lake/*",
                        ]
                    },
                  + {
                      + Action    = [
                          + "s3:ListBucket",
                        ]
                      + Condition = {
                          + StringLike = {
                              + "s3:prefix" = [
                                  + "lake/*",
                                ]
                            }
                        }
                      + Effect    = "Allow"
                      + Resource  = [
                          + "arn:aws:s3:::duckfleet-dev-797781631727-us-east-2",
                        ]
                    },
                  + {
                      + Action   = [
                          + "s3:GetBucketLocation",
                        ]
                      + Effect   = "Allow"
                      + Resource = [
                          + "arn:aws:s3:::duckfleet-dev-797781631727-us-east-2",
                        ]
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + role        = (known after apply)
    }

Plan: 6 to add, 0 to change, 0 to destroy.

@athvin
athvin force-pushed the feat/duckfleet-ci-bootstrap branch from 1116f7c to 0cc8cad Compare November 10, 2026 21:38
@athvin
athvin merged commit fcf0a1f into main Nov 10, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bootstrap namespace-scoped DuckFleet CI on the shared dev cluster

2 participants