Initial commit from kro/examples/aws/eks-cluster-mgmt
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,24 @@
|
||||
apiVersion: v2
|
||||
name: kro-pi-instance
|
||||
description: A Helm chart for Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.16.0"
|
||||
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.labels" -}}
|
||||
helm.sh/chart: {{ include "kro-pi-instance.chart" . }}
|
||||
{{ include "kro-pi-instance.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "kro-pi-instance.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "kro-pi-instance.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "kro-pi-instance.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,63 @@
|
||||
{{- $cluster := .Values.clusterName -}}
|
||||
{{- $namespace := .Values.piNamespace -}}
|
||||
{{- $name := .Values.name -}}
|
||||
{{- $root := . -}}
|
||||
{{- $serviceAccounts := .Values.serviceAccounts -}}
|
||||
{{- $policyDocument := .Values.policyDocument -}}
|
||||
{{- range $serviceAccounts }}
|
||||
apiVersion: kro.run/v1alpha1
|
||||
kind: PodIdentity
|
||||
metadata:
|
||||
name: "{{ include "kro-pi-instance.name" $root }}-{{ . }}"
|
||||
annotations:
|
||||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
|
||||
argocd.argoproj.io/sync-wave: "-5"
|
||||
spec:
|
||||
name: {{$name}}
|
||||
values:
|
||||
aws:
|
||||
clusterName: {{ $cluster }}
|
||||
policy:
|
||||
policyDocument: |
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{{- range $index, $policy := $policyDocument }}
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
{{- range $i, $action := $policy.actions }}
|
||||
"{{ $action }}"{{ if not (eq (add $i 1) (len $policy.actions)) }},{{ end }}
|
||||
{{- end }}
|
||||
],
|
||||
"Resource": [
|
||||
{{- if $policy.customArn }}
|
||||
"{{ $policy.customArn }}"
|
||||
{{- else if eq $policy.resourceName "*" }}
|
||||
"*"
|
||||
{{- else }}
|
||||
"arn:aws:{{ $policy.resourceType }}:{{ $.Values.region }}:{{ $.Values.accountId }}:{{ $policy.resourceName }}"
|
||||
{{- end }}
|
||||
]
|
||||
{{- if $policy.conditions }}
|
||||
,"Condition": {
|
||||
{{- range $j, $condition := $policy.conditions }}
|
||||
"{{ $condition.test }}": {
|
||||
"{{ $condition.variable }}": [
|
||||
{{- range $k, $value := $condition.values }}
|
||||
"{{ $value }}"{{ if not (eq (add $k 1) (len $condition.values)) }},{{ end }}
|
||||
{{- end }}
|
||||
]
|
||||
}
|
||||
{{- end }}
|
||||
}
|
||||
{{- end }}
|
||||
}{{ if not (eq (add $index 1) (len $.Values.policyDocument)) }},{{ end }}
|
||||
{{- end }}
|
||||
]
|
||||
}
|
||||
piAssociation:
|
||||
serviceAccount: {{ . }}
|
||||
piNamespace: {{ $namespace }}
|
||||
---
|
||||
{{- end}}
|
||||
@@ -0,0 +1,12 @@
|
||||
# region: eu-west-2
|
||||
# name: myname
|
||||
# serviceAccounts:
|
||||
# - "test"
|
||||
# - "test2"
|
||||
# piNamespace: "default"
|
||||
# clusterName: "spoke-workload2"
|
||||
# policyDocument:
|
||||
# - resourceType: ssm
|
||||
# resourceName: "*"
|
||||
# actions:
|
||||
# - "ssm:DescribeParameters"
|
||||
Reference in New Issue
Block a user