-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from gmlexx/main
Add promxy-operator
- Loading branch information
Showing
67 changed files
with
3,442 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: promxy-operator-build | ||
on: | ||
pull_request_target: | ||
types: | ||
- labeled | ||
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- main | ||
- release-* | ||
paths: | ||
- "promxy-operator/**" | ||
- "!**.md" | ||
push: | ||
tags: | ||
- "*" | ||
|
||
env: | ||
GO_VERSION: "1.22" | ||
|
||
jobs: | ||
build: | ||
concurrency: | ||
group: build-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
name: Build and Unit Test | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.vars.outputs.version }} | ||
pr: ${{ steps.pr.outputs.result }} | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Get PR ref | ||
uses: actions/github-script@v7 | ||
id: pr | ||
with: | ||
script: | | ||
const { data: pullRequest } = await github.rest.pulls.get({ | ||
...context.repo, | ||
pull_number: context.payload.pull_request.number, | ||
}); | ||
return pullRequest | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}} | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache: false | ||
- name: Unit tests | ||
working-directory: ./promxy-operator | ||
run: | | ||
make test | ||
- name: Set up Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GHCR | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get outputs | ||
id: vars | ||
run: | | ||
GIT_VERSION=$(git describe --tags --always) | ||
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT | ||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
if: github.repository == 'k0rdent/kof' | ||
with: | ||
build-args: | | ||
LD_FLAGS=-s -w | ||
context: "{{defaultContext}}:promxy-operator" | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/k0rdent/kof/promxy-operator-controller:${{ steps.vars.outputs.version }} | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
charts/kof-mothership/crds/kof.k0rdent.mirantis.com_promxyservergroups.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../promxy-operator/config/crd/bases/kof.k0rdent.mirantis.com_promxyservergroups.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
{{- if .Values.grafana.security.create_secret }} | ||
{{- $secret := (lookup "v1" "Secret" .Release.Namespace .Values.grafana.security.credentials_secret_name) }} | ||
{{- if not $secret }} | ||
{{- $username := randAlpha (.Values.global.random_username_length | int) }} | ||
{{- $password := randAlpha (.Values.global.random_password_length | int) }} | ||
{{- if $secret }} | ||
{{- $username = index $secret.data "GF_SECURITY_ADMIN_USER" | b64dec }} | ||
{{- $password = index $secret.data "GF_SECURITY_ADMIN_PASSWORD" | b64dec }} | ||
{{- end }} | ||
--- | ||
kind: Secret | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ .Values.grafana.security.credentials_secret_name }} | ||
namespace: {{ .Release.Namespace }} | ||
stringData: | ||
GF_SECURITY_ADMIN_USER: {{ randAlpha (.Values.global.random_username_length | int) | quote }} # Grafana username | ||
GF_SECURITY_ADMIN_PASSWORD: {{ randAlpha (.Values.global.random_password_length | int) | quote }} # Grafana password | ||
GF_SECURITY_ADMIN_USER: {{ $username | quote }} # Grafana username | ||
GF_SECURITY_ADMIN_PASSWORD: {{ $password | quote }} # Grafana password | ||
type: Opaque | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{- range $profile, $values := .Values.kcm.kof.clusterProfiles }} | ||
{{- if $values.create_secrets }} | ||
{{- range $values.secrets }} | ||
{{- /* Checking that the secret isn't created yet to avoid credentials regeneration */}} | ||
{{- $secret := (lookup "v1" "Secret" $.Release.Namespace . ) }} | ||
{{- $username := randAlpha ($.Values.global.random_username_length | int) }} | ||
{{- $password := randAlpha ($.Values.global.random_password_length | int) }} | ||
{{- if $secret }} | ||
{{- $username = index $secret.data "username" | b64dec }} | ||
{{- $password = index $secret.data "password" | b64dec }} | ||
{{- end }} | ||
--- | ||
kind: Secret | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ . }} | ||
namespace: {{ $.Release.Namespace }} | ||
stringData: | ||
username: {{ $username | quote }} | ||
password: {{ $password | quote }} | ||
type: Opaque | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{- if .Values.promxy.operator.rbac.create -}} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "chart.fullname" . }}-operator | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- kof.k0rdent.mirantis.com | ||
resources: | ||
- promxyservergroups | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- kof.k0rdent.mirantis.com | ||
resources: | ||
- promxyservergroups/finalizers | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- kof.k0rdent.mirantis.com | ||
resources: | ||
- promxyservergroups/status | ||
verbs: | ||
- get | ||
- patch | ||
- update | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- if .Values.promxy.operator.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: promxy-operator | ||
name: {{ include "chart.fullname" . }}-operator | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "chart.fullname" . }}-operator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "chart.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} |
Oops, something went wrong.