Adding rancher-csp-adapter chart

pull/1918/head
Michael Bolot 2022-05-31 14:04:02 -05:00
parent 389a06f64c
commit f5a2ac8056
10 changed files with 277 additions and 0 deletions

View File

@ -0,0 +1,17 @@
annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/display-name: Rancher CSP Adapter
catalog.cattle.io/hidden: "true"
catalog.cattle.io/kube-version: '>= 1.22.0-0 < 1.25.0-0'
catalog.cattle.io/namespace: cattle-csp-adapter-system
catalog.cattle.io/os: linux
catalog.cattle.io/permits-os: linux
catalog.cattle.io/rancher-version: '>= 2.6.6-0 < 2.7.0-0'
catalog.cattle.io/release-name: rancher-csp-adapter
catalog.cattle.io/scope: management
apiVersion: v2
appVersion: 0.1.0-rc7
description: Cloud Service Provider Marketplace Adapter for Rancher. Monitors Rancher
entitlements against usage.
name: rancher-csp-adapter
version: 0.1.0+up0.1.0-rc7

View File

@ -0,0 +1,53 @@
{{- define "system_default_registry" -}}
{{- if .Values.global.cattle.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.cattle.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}
{{- define "csp-adapter.labels" -}}
app: rancher-csp-adapter
{{- end }}
{{- define "csp-adapter.outputConfigMap" -}}
csp-config
{{- end }}
{{- define "csp-adapter.outputNotification" -}}
csp-compliance
{{- end }}
{{- define "csp-adapter.cacheSecret" -}}
csp-adapter-cache
{{- end }}
{{- define "csp-adapter.hostnameSetting" -}}
server-url
{{- end }}
{{- define "csp-adapter.versionSetting" -}}
server-version
{{- end }}
{{- define "csp-adapter.csp" -}}
{{- if .Values.aws -}}
{{- if .Values.aws.enabled -}}
aws
{{- end -}}
{{- else -}}
""
{{- end -}}
{{- end }}
{{- define "csp-adapter.awsValuesSet" -}}
{{- if .Values.aws -}}
{{- if and .Values.aws.accountNumber .Values.aws.roleName -}}
true
{{- else -}}
false
{{- end -}}
{{- else -}}
false
{{- end -}}
{{- end }}

View File

@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
namespace: cattle-csp-adapter-system
spec:
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- env:
- name: CATTLE_DEBUG
value: {{ .Values.debug | quote }}
- name: K8S_OUTPUT_CONFIGMAP
value: '{{ template "csp-adapter.outputConfigMap" }}'
- name: K8S_OUTPUT_NOTIFICATION
value: '{{ template "csp-adapter.outputNotification" }}'
- name: K8S_CACHE_SECRET
value: '{{ template "csp-adapter.cacheSecret" }}'
- name: K8S_HOSTNAME_SETTING
value: '{{ template "csp-adapter.hostnameSetting" }}'
- name: K8S_RANCHER_VERSION_SETTING
value: '{{ template "csp-adapter.versionSetting" }}'
image: '{{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}'
name: {{ .Chart.Name }}
imagePullPolicy: "{{ .Values.image.imagePullPolicy }}"
serviceAccountName: {{ .Chart.Name }}

View File

@ -0,0 +1,114 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Chart.Name }}-cluster-role
rules:
- apiGroups:
- management.cattle.io
resources:
- ranchermetrics
verbs:
- get
- apiGroups:
- management.cattle.io
resources:
- rancherusernotifications
resourceNames:
- {{ template "csp-adapter.outputNotification" }}
verbs:
- "*"
- apiGroups:
- management.cattle.io
resources:
- rancherusernotifications
verbs:
- create
- apiGroups:
- management.cattle.io
resources:
- settings
resourceNames:
- {{ template "csp-adapter.hostnameSetting" }}
- {{ template "csp-adapter.versionSetting" }}
verbs:
- get
- list
- watch
- apiGroups:
- apiregistration.k8s.io
resources:
- apiservices
verbs:
- get
- list
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Chart.Name }}-crb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Chart.Name }}-cluster-role
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}
namespace: cattle-csp-adapter-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Chart.Name }}-role
namespace: cattle-csp-adapter-system
rules:
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- {{ template "csp-adapter.cacheSecret" }}
verbs:
- "*"
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- {{ template "csp-adapter.outputConfigMap" }}
verbs:
- "*"
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Chart.Name }}-binding
namespace: cattle-csp-adapter-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Chart.Name }}-role
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}
namespace: cattle-csp-adapter-system

View File

@ -0,0 +1,17 @@
{{- if eq (include "csp-adapter.csp" . ) "aws" -}}
{{- if eq (include "csp-adapter.awsValuesSet" .) "true" -}}
{{- else -}}
{{- fail "If the aws provider is enabled, account number and role name must be provided" -}}
{{- end -}}
{{- else -}}
{{- fail "One cloud provider must be enabled" -}}
{{- end -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Chart.Name }}
namespace: cattle-csp-adapter-system
{{- if eq (include "csp-adapter.csp" . ) "aws" }}
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::{{ .Values.aws.accountNumber }}:role/{{ .Values.aws.roleName }}
{{- end }}

View File

@ -0,0 +1,18 @@
debug: false
image:
repository: rancher/rancher-csp-adapter
tag: v0.1.0-rc7
imagePullPolicy: IfNotPresent
global:
cattle:
systemDefaultRegistry: ""
tolerations: []
# at least one csp must be enabled like below
aws:
enabled: false
accountNumber: ""
roleName: ""

View File

@ -2853,6 +2853,28 @@ entries:
urls:
- assets/rancher-cis-benchmark-crd/rancher-cis-benchmark-crd-1.0.100.tgz
version: 1.0.100
rancher-csp-adapter:
- annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/display-name: Rancher CSP Adapter
catalog.cattle.io/hidden: "true"
catalog.cattle.io/kube-version: '>= 1.22.0-0 < 1.25.0-0'
catalog.cattle.io/namespace: cattle-csp-adapter-system
catalog.cattle.io/os: linux
catalog.cattle.io/permits-os: linux
catalog.cattle.io/rancher-version: '>= 2.6.6-0 < 2.7.0-0'
catalog.cattle.io/release-name: rancher-csp-adapter
catalog.cattle.io/scope: management
apiVersion: v2
appVersion: 0.1.0-rc7
created: "2022-05-31T14:02:16.415103-05:00"
description: Cloud Service Provider Marketplace Adapter for Rancher. Monitors
Rancher entitlements against usage.
digest: a36775b20726f441fe65108016c0154b6fcab160071feeca1b5ff08793c7ff1b
name: rancher-csp-adapter
urls:
- assets/rancher-csp-adapter/rancher-csp-adapter-0.1.0+up0.1.0-rc7.tgz
version: 0.1.0+up0.1.0-rc7
rancher-eks-operator:
- annotations:
catalog.cattle.io/auto-install: rancher-eks-operator-crd=match

View File

@ -0,0 +1,2 @@
url: https://github.com/rancher/csp-adapter/releases/download/v0.1.0-rc7/rancher-csp-adapter-0.1.0-rc7.tgz
version: 0.1.0

View File

@ -12,3 +12,5 @@ rancher-gatekeeper:
- 100.1.1+up3.7.1
rancher-gatekeeper-crd:
- 100.1.1+up3.7.1
rancher-csp-adapter:
- 0.1.0+up0.1.0-rc7