generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #13 from kndpio/integrate-function-poll-with-backs…
…tage Integrate function poll with backstage
- Loading branch information
Showing
21 changed files
with
1,427 additions
and
237 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,56 @@ | ||
name: Builder | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-and-pack: | ||
name: Build and pack | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: CR authentication | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Get Short GitHub SHA and Save in Environment Variable | ||
run: echo "SHORT_GITHUB_SHA=$(git rev-parse --short=5 HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Setup the Crossplane CLI | ||
run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh" | ||
|
||
- name: Build and push slack-collector | ||
run: docker build -f internal/slack-collector/Dockerfile . -t ${REGISTRY}/${{ github.repository }}/slack-collector:${SHORT_GITHUB_SHA} && docker push ${REGISTRY}/${{ github.repository }}/slack-collector:${SHORT_GITHUB_SHA} | ||
|
||
- name: Build and push slack-notify | ||
run: docker build -f internal/slack-notify/Dockerfile . -t ${REGISTRY}/${{ github.repository }}/slack-notify:${SHORT_GITHUB_SHA} && docker push ${REGISTRY}/${{ github.repository }}/slack-notify:${SHORT_GITHUB_SHA} | ||
|
||
- name: Build function image | ||
run: docker build . -t ${REGISTRY}/${{ github.repository }}:${SHORT_GITHUB_SHA} | ||
|
||
- name: Build ans push Package | ||
run: ./crossplane xpkg build --package-file=function-poll.xpkg --package-root=package/ --embed-runtime-image=${REGISTRY}/${{ github.repository }}:${SHORT_GITHUB_SHA} && ./crossplane xpkg push -f function-poll.xpkg ${REGISTRY}/${{ github.repository }}:${SHORT_GITHUB_SHA} | ||
|
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: function-template-go | ||
name: poll-composition | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: example.crossplane.io/v1 | ||
kind: XR | ||
apiVersion: kndp.io/v1alpha1 | ||
kind: Poll | ||
mode: Pipeline | ||
pipeline: | ||
- step: run-the-template | ||
functionRef: | ||
name: function-template-go | ||
input: | ||
slackAPIToken: "" | ||
slackNotifyMessage: "" | ||
slackChanelID: "" | ||
providerConfigRef: "" | ||
deploymentName: "" | ||
deploymentServiceAccount: "" | ||
deploymentImage: "" | ||
configMap: "" | ||
apiVersion: kndp.io/v1alpha1 | ||
kind: Poll | ||
providerConfigRef: "kndp-kubernetes-provider-config" | ||
deploymentImage: "ghcr.io/kndpio/function-poll/slack-collector:d7a4b" | ||
cronJobImage: "ghcr.io/kndpio/function-poll/slack-notify:d7a4b" | ||
deploymentName: "slack-collector" | ||
serviceAccountName: "slack-collector" |
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,20 @@ | ||
apiVersion: pkg.crossplane.io/v1beta1 | ||
kind: DeploymentRuntimeConfig | ||
metadata: | ||
name: poll-function-runtime | ||
spec: | ||
deploymentTemplate: | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: poll-app | ||
template: | ||
metadata: | ||
labels: | ||
app: poll-app | ||
spec: | ||
containers: | ||
- name: package-runtime | ||
envFrom: | ||
- secretRef: | ||
name: poll-secret |
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 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: poll-cluster-role | ||
rules: | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
verbs: ["*"] | ||
- apiGroups: ["batch"] | ||
resources: ["cronjobs"] | ||
verbs: ["*"] | ||
- apiGroups: ["networking.k8s.io"] | ||
resources: ["ingresses"] | ||
verbs: ["*"] | ||
- apiGroups: ["kndp.io"] | ||
resources: ["polls"] | ||
verbs: ["*"] | ||
- apiGroups: ["kndp.io"] | ||
resources: ["polls/status"] | ||
verbs: ["*"] | ||
- apiGroups: ["v1"] | ||
resources: ["services"] | ||
verbs: ["*"] | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: slack-collector | ||
|
||
--- | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: poll-cluster-role-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: slack-collector | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: poll-cluster-role | ||
apiGroup: rbac.authorization.k8s.io |
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,14 +1,15 @@ | ||
apiVersion: kndp.io/v1alpha1 | ||
kind: Meal | ||
kind: Poll | ||
metadata: | ||
name: meal | ||
annotations: | ||
"poll.fn.kndp.io/last-sent-time": "" | ||
spec: | ||
deliveryTime: "" | ||
dueOrderTime: "" | ||
dueTakeTime: "" | ||
employeeRefs: [] | ||
status: "" | ||
title: "" | ||
|
||
deliveryTime: 0 | ||
dueOrderTime: 15 | ||
dueTakeTime: 0 | ||
voters: [] | ||
title: "meal" | ||
schedule: "0 * * * *" | ||
messages: | ||
question: "how are you?" | ||
response: "thank you for response." | ||
result: "here are the voting results:" |
Oops, something went wrong.