Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agnosticv operator v1 #1074

Merged
merged 6 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agnosticv-operator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.odo/env
.odo/odo-file-index.json
agnosticvrepo.yaml
agnosticvrepo*.yaml
id_rsa
id_rsa.pub
test-helm-values.yaml
4 changes: 4 additions & 0 deletions agnosticv-operator/helm/crds/agnosticvcomponents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ spec:
description: >-
Component path within AgnosticV repositiory.
type: string
pullRequestNumber:
description: >-
Pull request number if component is managed by a pull request.
type: integer
required:
- agnosticvRepo
- definition
Expand Down
25 changes: 24 additions & 1 deletion agnosticv-operator/helm/crds/agnosticvrepos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,34 @@ spec:
- always
- missing
- never
gitHub:
description: >-
GitHub integration configuration.
type: object
properties:
preloadPullRequests:
description: >-
Configuration to load configuration from open pull requests before merge.
This feature is intended for use for integration testing before pull request merge.
type: object
required:
- mode
properties:
mode:
description: >-
Pull request pre-load style.
In the "override" mode the most recent pull request configuration overrides tho applied component configuration.
type: string
enum:
- override
tokenSecret:
description: >-
Name of secret with GitHub token as `token` in secret data.
type: string
pollingInterval:
description: >-
Polling interval for checking for AgnosticV Repo Updates
type: string
default: 1m
ref:
description: >-
Git reference. Ex: branch, commit, or tag
Expand Down
29 changes: 29 additions & 0 deletions agnosticv-operator/helm/templates/agnosticvrepos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,37 @@ spec:
{{- (dict $k $v) | toYaml | indent 2 }}
{{- end }}
{{ end }}
{{ with $.Values.anarchy.collections }}
babylonAnarchyCollections:
{{- $.Values.anarchy.collections | toYaml | indent 4 }}
{{ end }}
{{ with $.Values.anarchy.roles }}
babylonAnarchyRoles:
{{- $.Values.anarchy.roles | toYaml | indent 4 }}
{{ end }}
{{ with $agnosticvRepo.sshKey }}
sshKey: {{ $agnosticvRepo.name }}-sshkey
{{ end }}
{{ with $agnosticvRepo.gitHub }}
gitHub:
tokenSecret: {{ $agnosticvRepo.name }}-github
{{ range $k, $v := $agnosticvRepo }}
{{ if and (ne $k "name") (ne $k "token") }}
{{ (dict $k $v) | toYaml | indent 4 }}
{{ end }}
{{ end }}
{{ end }}
{{ with $agnosticvRepo.gitHub.token }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $agnosticvRepo.name }}-github
namespace: {{ include "babylonAgnosticVOperator.namespaceName" $ }}
data:
token: {{ . | b64enc }}
{{ end }}
{{ with $agnosticvRepo.sshKey }}
---
apiVersion: v1
kind: Secret
Expand Down
8 changes: 7 additions & 1 deletion agnosticv-operator/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ namespace:
# ref: master
# sshKey: agnosticv-sshkey
# url: [email protected]:rhpds/agnosticv.git
# ...
# gitHub:
# preloadPullRequests:
# mode: override
# token: ... github access token ...

agnosticv:
apiGroup: gpte.redhat.com
Expand All @@ -19,6 +22,9 @@ agnosticv:
anarchy:
apiGroup: anarchy.gpte.redhat.com
version: v1
# Roles and collections may be passed values with anarchy or through the agnosticvRepos
#collections: []
#roles: []

catalog:
apiGroup: babylon.gpte.redhat.com
Expand Down
4 changes: 4 additions & 0 deletions agnosticv-operator/operator/agnosticvcomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ def linked_components(self):
def path(self):
return self.spec['path']

@property
def pull_request_number(self):
return self.spec.get('pullRequestNumber')

@property
def resource_provider_ref(self):
return {
Expand Down
Loading