Skip to content

Commit

Permalink
Merge pull request #162 from aandryashin/master
Browse files Browse the repository at this point in the history
Implemented license secrets.
  • Loading branch information
vania-pooh authored Jul 5, 2022
2 parents f06a1dc + 0198b11 commit cc74a7f
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README-license-ops.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Installation from chart:
```
helm upgrade --install -n moon license-ops aerokube/license-ops
```

Installation from sources:
```
helm upgrade --install -n moon license-ops license-ops
```
1 change: 1 addition & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mkdir -p "$output_dir"
helm package moon --destination "$output_dir"
helm package moon2 --destination "$output_dir" --version "$version"
helm package browser-ops --destination "$output_dir" --version "$version"
helm package license-ops --destination "$output_dir" --version "$version"
cd "$output_dir"
wget "$CHARTS_REPO/index.yaml" || true
helm repo index . --url "$CHARTS_REPO" --merge index.yaml
1 change: 1 addition & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
helm lint moon
helm lint moon2
helm lint browser-ops
helm lint license-ops
6 changes: 6 additions & 0 deletions license-ops/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
name: license-ops
version: 1.0.0
appVersion: 1.0.0
description: License Operations chart
icon: https://aerokube.com/img/aerokube_logo.svg
14 changes: 14 additions & 0 deletions license-ops/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
14 changes: 14 additions & 0 deletions license-ops/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- moon.aerokube.com
resources:
- licenses
verbs:
- get
- patch
21 changes: 21 additions & 0 deletions license-ops/templates/cron-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
schedule: {{ .Values.schedule | quote }}
concurrencyPolicy: Forbid
jobTemplate:
spec:
ttlSecondsAfterFinished: 0
template:
spec:
serviceAccountName: {{ .Release.Name }}
containers:
- name: license-ops
image: bitnami/kubectl:{{ .Values.version }}
command: ["/bin/bash", "-c"]
args: ["kubectl patch license {{ .Values.licenseName }} --type='json' -p=\"[{\\\"op\\\": \\\"replace\\\", \\\"path\\\": \\\"/spec/data\\\", \\\"value\\\":\\\"$(kubectl get secret {{ .Values.secretName }} -n {{ .Release.Namespace }} -o yaml -o=jsonpath='{.data.license\\.key}' | base64 -d)\\\"}]\""]
restartPolicy: Never
14 changes: 14 additions & 0 deletions license-ops/templates/role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ .Release.Name }}
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
13 changes: 13 additions & 0 deletions license-ops/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
7 changes: 7 additions & 0 deletions license-ops/templates/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}

20 changes: 20 additions & 0 deletions license-ops/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
##
## License name.
##
licenseName: moon

##
## Secret name.
##
secretName: licensekey

##
## Schedule
##
schedule: "* * * * *"

##
## Kubernetes version
##
version: 1.23

0 comments on commit cc74a7f

Please sign in to comment.