Skip to content

Commit

Permalink
feat: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoL96 committed Oct 8, 2024
0 parents commit 32700aa
Show file tree
Hide file tree
Showing 15 changed files with 616 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release-pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release-pullrequest

on:
pull_request:
branches:
- main

jobs:
package:
runs-on: ubuntu-latest

steps:
- name: Extract latest App Version
uses: tdemin/find-latest-tag@v1
id: app_version
with:
repo: https://${{ secrets.HELM_CHARTS_BOT }}@github.com/krateoplatformops/finops-operator-exporter.git

- name: Print latest App Version
run: echo ${{ steps.app_version.outputs.tag }}

- name: Checkout
uses: actions/checkout@v3

- name: Replace Version in Chart.yaml
run: sed -i 's/CHART_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Replace App Version in Chart.yaml
run: sed -i 's/APP_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Set up Helm
uses: azure/[email protected]

- name: Helm lint
run: helm lint ./chart
47 changes: 47 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release-tag

on:
push:
tags: ["[0-9]+.[0-9]+.[0-9]+"]

jobs:
package:
runs-on: ubuntu-latest

steps:
- name: Extract latest App Version
uses: tdemin/find-latest-tag@v1
id: app_version
with:
repo: https://${{ secrets.HELM_CHARTS_BOT }}@github.com/krateoplatformops/finops-operator-exporter.git

- name: Checkout
uses: actions/checkout@v3

- name: Extract Version
id: tagger
uses: battila7/get-version-action@v2

- name: Print Version
run: |
echo ${{steps.tagger.outputs.version}}
echo ${{steps.tagger.outputs.version-without-v}}
- name: Replace Version in Chart.yaml
run: sed -i 's/CHART_VERSION/${{ steps.tagger.outputs.version-without-v }}/g' ./chart/Chart.yaml

- name: Print latest App Version
run: echo ${{ steps.app_version.outputs.tag }}

- name: Replace App Version in Chart.yaml
run: sed -i 's/APP_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml

- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.HELM_CHARTS_BOT }}
charts_dir: ./
charts_url: https://charts.krateo.io
owner: krateoplatformops
repository: helm-charts
branch: gh-pages
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chart/templates/clusterrole.yaml
chart/templates/clusterrolebinding.yaml
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Krateo Composition Watcher Operator

This is a [Helm Chart](https://helm.sh/docs/topics/charts/) for [Krateo Composition Watcher](https://github.com/krateoplatformops/composition-watcher).

## How to install

```sh
$ helm repo add krateo https://charts.krateo.io
$ helm repo update krateo
$ helm install composition-watcher krateo/composition-watcher
```
23 changes: 23 additions & 0 deletions chart/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
21 changes: 21 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: composition-watcher
description: Krateo Composition Watcher
# 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: CHART_VERSION
# 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: APP_VERSION
84 changes: 84 additions & 0 deletions chart/crds/resourcetrees.krateo.io_compositionreferences.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: compositionreferences.resourcetrees.krateo.io
spec:
group: resourcetrees.krateo.io
names:
kind: CompositionReference
listKind: CompositionReferenceList
plural: compositionreferences
singular: compositionreference
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
properties:
filters:
properties:
exclude:
items:
properties:
apiVersion:
type: string
name:
type: string
resource:
type: string
required:
- apiVersion
type: object
type: array
required:
- exclude
type: object
reference:
properties:
apiVersion:
type: string
name:
type: string
namespace:
type: string
resource:
type: string
required:
- apiVersion
- name
- namespace
- resource
type: object
required:
- filters
- reference
type: object
status:
type: object
type: object
served: true
storage: true
subresources:
status: {}
62 changes: 62 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.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 "chart.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 "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "chart.labels" -}}
helm.sh/chart: {{ include "chart.chart" . }}
{{ include "chart.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "chart.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "chart.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "chart.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit 32700aa

Please sign in to comment.