Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: migrate grafana to irsa #1344

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions cfn/eks-nodes-bottlerocket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ Resources:
- "sqs:ReceiveMessage"
Resource: "*"
PolicyName: "spot-asg-termination-queue"
- PolicyDocument:
Statement:
- Effect: "Allow"
Action:
- "cloudwatch:GetMetricData"
- "cloudwatch:ListMetrics"
Resource: "*"
PolicyName: "grafana-get-metrics"
- PolicyDocument:
Statement:
- Effect: "Allow"
Expand Down
52 changes: 52 additions & 0 deletions cfn/irsa-grafana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
AWSTemplateFormatVersion: "2010-09-09"
Description: IAM Role & Policy for serviceaccount "monitoring/grafana"
Parameters:
ClusterOIDCURL:
Type: String
Description: The OpenID Connect URL without protocol (the "https://" prefix)
Environment:
Type: String
Default: dev
AllowedValues:
- dev
- prd
Resources:
Role:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument: !Sub |
{
"Statement": [
{
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"${ClusterOIDCURL}:aud": "sts.amazonaws.com",
"${ClusterOIDCURL}:sub": "system:serviceaccount:monitoring:grafana"
}
},
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::${AWS::AccountId}:oidc-provider/${ClusterOIDCURL}"
}
}
],
"Version": "2012-10-17"
}
Policy:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- "cloudwatch:GetMetricData"
- "cloudwatch:ListMetrics"
Effect: Allow
Resource: '*'
Version: "2012-10-17"
PolicyName: !Sub "grafana-${Environment}"
Roles:
- !Ref Role
Outputs:
Role:
Value: !GetAtt Role.Arn
3 changes: 3 additions & 0 deletions manifests/argocd-apps/dev/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,9 @@ spec:
api_url: https://dreamkast.us.auth0.com/userinfo
role_attribute_strict: true
role_attribute_path: contains("https://cloudnativedays.jp/roles", 'O11Y2022-Admin') && 'Admin'
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::607167088920:role/grafana-dev-irsa-Role-DMHFXAVVPUED
parameters:
- name: image.tag
value: "8.3.3"
Expand Down