Repository navigation
Create gcp deployer #3
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b208a27
PoC of marketplace deployer
Angelin01 af2ce36
Add test data
Angelin01 6be2fad
Add a key import for mpdev verify
Angelin01 6436c1a
Parametrize verify images
Angelin01 e2b5261
Drop useless components
Angelin01 0adddbf
Drop readme
Angelin01 b629415
Fix Application CRD selector labels
Angelin01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 @@ | ||
| * | ||
| !chart | ||
| !schema.yaml | ||
| !data-test | ||
This file contains hidden or 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,2 @@ | ||
| chart/*/charts/ | ||
| chart/*/Chart.lock |
This file contains hidden or 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,38 @@ | ||
| ARG MARKETPLACE_TOOLS_TAG=latest | ||
|
|
||
| FROM alpine:3 AS build | ||
|
|
||
| RUN apk add --no-cache yq tar gettext | ||
|
|
||
| WORKDIR /work | ||
| COPY chart/ccv-cell-mp ./chart | ||
| COPY schema.yaml ./schema.yaml | ||
| COPY data-test ./data-test | ||
|
|
||
| ARG REGISTRY | ||
| ARG TAG | ||
|
|
||
| # Application descriptor version must equal schema publishedVersion (the tag). | ||
| RUN sed -i "s/^appVersion:.*/appVersion: \"${TAG}\"/" chart/Chart.yaml | ||
|
|
||
| # Production chart tarball (mirrors what the helm onbuild base would have produced). | ||
| RUN tar -czf /chart.tar.gz chart | ||
|
|
||
| # Verify chart: deep-merge overlay values into the chart's values, add overlay templates, re-tar. | ||
| RUN mkdir -p /work/test \ | ||
| && cp -r chart /work/test/chart \ | ||
| && yq eval-all 'select(fi==0) * select(fi==1)' \ | ||
| chart/values.yaml data-test/chart-overlay/values.yaml > /work/test/chart/values.yaml \ | ||
| && cp data-test/chart-overlay/templates/* /work/test/chart/templates/ \ | ||
| && tar -czf /chart-test.tar.gz -C /work/test chart | ||
|
|
||
| # publishedVersion in both schemas is envsubst'd from $TAG (matches the helm onbuild behavior). | ||
| RUN env -i "REGISTRY=${REGISTRY}" "TAG=${TAG}" envsubst < schema.yaml > /schema.yaml \ | ||
| && env -i "REGISTRY=${REGISTRY}" "TAG=${TAG}" envsubst < data-test/schema.yaml > /schema-test.yaml | ||
|
|
||
| FROM gcr.io/cloud-marketplace-tools/k8s/deployer_helm:$MARKETPLACE_TOOLS_TAG | ||
|
|
||
| COPY --from=build /chart.tar.gz /data/chart/chart.tar.gz | ||
| COPY --from=build /schema.yaml /data/schema.yaml | ||
| COPY --from=build /chart-test.tar.gz /data-test/chart/chart.tar.gz | ||
| COPY --from=build /schema-test.yaml /data-test/schema.yaml |
This file contains hidden or 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,10 @@ | ||
| apiVersion: v2 | ||
| name: ccv-cell-mp | ||
| description: GCP Marketplace wrapper around the ccv-cell chart | ||
| type: application | ||
| version: 0.0.0 | ||
| appVersion: "0.0.0" | ||
| dependencies: | ||
| - name: ccv-cell | ||
| version: "*" | ||
| repository: file://../../../../charts/ccv-cell |
31 changes: 31 additions & 0 deletions
31
marketplace/gcp/chart/ccv-cell-mp/templates/application.yaml
This file contains hidden or 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,31 @@ | ||
| apiVersion: app.k8s.io/v1beta1 | ||
| kind: Application | ||
| metadata: | ||
| name: "{{ .Release.Name }}" | ||
| namespace: "{{ .Release.Namespace }}" | ||
| labels: | ||
| app.kubernetes.io/name: "{{ .Release.Name }}" | ||
| annotations: | ||
| # PLACEHOLDER: partner_id/product_id must match the Marketplace listing IDs. | ||
| marketplace.cloud.google.com/deploy-info: '{"partner_id": "chainlink", "product_id": "ccv-cell", "partner_name": "Chainlink"}' | ||
| spec: | ||
| descriptor: | ||
| type: CCV Cell | ||
| version: "{{ .Chart.AppVersion }}" | ||
| description: >- | ||
| A Chainlink CCV Cell: a committee verifier and its aggregator. | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: "{{ .Release.Name }}" | ||
|
Angelin01 marked this conversation as resolved.
Outdated
|
||
| addOwnerRef: true | ||
| componentKinds: | ||
| - group: v1 | ||
| kind: ConfigMap | ||
| - group: v1 | ||
| kind: Service | ||
| - group: apps/v1 | ||
| kind: StatefulSet | ||
| - group: gateway.networking.k8s.io | ||
| kind: GRPCRoute | ||
| - group: secrets-store.csi.x-k8s.io | ||
| kind: SecretProviderClass | ||
27 changes: 27 additions & 0 deletions
27
marketplace/gcp/chart/ccv-cell-mp/templates/grpcroute.yaml
This file contains hidden or 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,27 @@ | ||
| {{- if .Values.grpcRoute.enabled }} | ||
| {{- $sub := index .Subcharts "ccv-cell" }} | ||
| {{- $agg := $sub.Values.aggregator }} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: GRPCRoute | ||
| metadata: | ||
| name: {{ include "ccv-cell.aggregator.fullname" $sub }} | ||
| labels: | ||
| {{- include "ccv-cell.aggregator.labels" $sub | nindent 4 }} | ||
| spec: | ||
| parentRefs: | ||
| - group: gateway.networking.k8s.io | ||
| kind: Gateway | ||
| name: {{ required "grpcRoute.parentRefName is required" .Values.grpcRoute.parentRefName }} | ||
| {{- with .Values.grpcRoute.parentRefNamespace }} | ||
| namespace: {{ . }} | ||
| {{- end }} | ||
| {{- with .Values.grpcRoute.parentRefSectionName }} | ||
| sectionName: {{ . }} | ||
| {{- end }} | ||
| hostnames: | ||
| - {{ required "grpcRoute.hostname is required" .Values.grpcRoute.hostname | quote }} | ||
| rules: | ||
| - backendRefs: | ||
| - name: {{ include "ccv-cell.aggregator.fullname" $sub }} | ||
| port: {{ $agg.service.ports.grpc }} | ||
| {{- end }} |
This file contains hidden or 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,30 @@ | ||
| grpcRoute: | ||
| enabled: true | ||
| hostname: "" | ||
| parentRefName: "" | ||
| parentRefNamespace: "" | ||
| parentRefSectionName: "" | ||
|
Angelin01 marked this conversation as resolved.
|
||
|
|
||
| ccv-cell: | ||
| aggregator: | ||
| image: | ||
| # Marketplace parameterizes repository/tag, and the chart rejects tag and digest together. | ||
| digest: "" | ||
| # Marketplace forbids charts from creating service accounts, it creates them and passes the name. | ||
| serviceAccount: | ||
| create: false | ||
| secrets: | ||
| app: | ||
| type: gcpSecretStore | ||
|
|
||
| verifier: | ||
| image: | ||
| digest: "" | ||
| serviceAccount: | ||
| create: false | ||
| secrets: | ||
| app: | ||
| type: gcpSecretStore | ||
| bootstrap: | ||
| type: gcpSecretStore | ||
| keystoreBackend: kms | ||
7 changes: 7 additions & 0 deletions
7
marketplace/gcp/data-test/chart-overlay/templates/_images.tpl
This file contains hidden or 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,7 @@ | ||
| {{- define "ccv-cell-mp.image" -}} | ||
| {{- if .registry -}} | ||
| {{ .registry }}/{{ .repository }}:{{ .tag }} | ||
| {{- else -}} | ||
| {{ .repository }}:{{ .tag }} | ||
| {{- end -}} | ||
| {{- end -}} |
67 changes: 67 additions & 0 deletions
67
marketplace/gcp/data-test/chart-overlay/templates/verify-postgres.yaml
This file contains hidden or 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,67 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: verify-postgres-init | ||
| data: | ||
| init.sql: | | ||
| CREATE DATABASE aggregator; | ||
| CREATE DATABASE verifier; | ||
| CREATE DATABASE bootstrap; | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: StatefulSet | ||
| metadata: | ||
| name: verify-postgres | ||
| labels: | ||
| app.kubernetes.io/name: verify-postgres | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: verify-postgres | ||
|
Angelin01 marked this conversation as resolved.
|
||
| template: | ||
| metadata: | ||
| labels: | ||
| app.kubernetes.io/name: verify-postgres | ||
| spec: | ||
| containers: | ||
| - name: postgres | ||
| image: {{ include "ccv-cell-mp.image" .Values.verify.postgres.image | quote }} | ||
| env: | ||
| - name: POSTGRES_USER | ||
| value: ccv | ||
| - name: POSTGRES_PASSWORD | ||
| value: ccv | ||
| - name: PGDATA | ||
| value: /var/lib/postgresql/data/pgdata | ||
| ports: | ||
| - containerPort: 5432 | ||
| volumeMounts: | ||
| - name: initdb | ||
| mountPath: /docker-entrypoint-initdb.d | ||
| - name: data | ||
| mountPath: /var/lib/postgresql/data | ||
| readinessProbe: | ||
| exec: | ||
| command: ["pg_isready", "-U", "ccv"] | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 5 | ||
| volumes: | ||
| - name: initdb | ||
| configMap: | ||
| name: verify-postgres-init | ||
| - name: data | ||
| emptyDir: {} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: verify-postgres | ||
| labels: | ||
| app.kubernetes.io/name: verify-postgres | ||
| spec: | ||
| selector: | ||
| app.kubernetes.io/name: verify-postgres | ||
| ports: | ||
| - port: 5432 | ||
| targetPort: 5432 | ||
59 changes: 59 additions & 0 deletions
59
marketplace/gcp/data-test/chart-overlay/templates/verify-secrets.yaml
This file contains hidden or 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,59 @@ | ||
| {{- $apiKey := "00000000-0000-4000-8000-000000000001" }} | ||
| {{- $secretKey := "0000000000000000000000000000000000000000000000000000000000000001" }} | ||
| {{- $pgUser := "ccv" }} | ||
| {{- $pgPass := "ccv" }} | ||
| {{- $pgHost := "verify-postgres:5432" }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: verify-aggregator-app | ||
| type: Opaque | ||
| stringData: | ||
| secrets.toml: | | ||
| [storage] | ||
| url = "postgres://{{ $pgUser }}:{{ $pgPass }}@{{ $pgHost }}/aggregator?sslmode=disable" | ||
|
|
||
| [[clients]] | ||
| client_id = "committee-verifier-1" | ||
| api_key = "{{ $apiKey }}" | ||
| secret_key = "{{ $secretKey }}" | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: verify-verifier-app | ||
| type: Opaque | ||
| stringData: | ||
| secrets.toml: | | ||
| [db] | ||
| url = "postgres://{{ $pgUser }}:{{ $pgPass }}@{{ $pgHost }}/verifier?sslmode=disable" | ||
|
|
||
| [[aggregators]] | ||
| secret_name = "aggregator_1" | ||
| api_key = "{{ $apiKey }}" | ||
| secret_key = "{{ $secretKey }}" | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: verify-verifier-bootstrap | ||
| type: Opaque | ||
| stringData: | ||
| secrets.toml: | | ||
| [db] | ||
| url = "postgres://{{ $pgUser }}:{{ $pgPass }}@{{ $pgHost }}/bootstrap?sslmode=disable" | ||
|
|
||
| [keystore] | ||
| backend = "postgres" | ||
| password = "keystore-password" | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: verify-verifier-key-import | ||
| type: Opaque | ||
| stringData: | ||
| key.json: | | ||
| {"chainType":"evm","onchainPublicKey":"072cdf41f8814e23a3856591645b639f9c71de83","crypto":{"cipher":"aes-128-ctr","ciphertext":"375f050af72d8b14cf5fd90b03ebfd3989b1b79201d7009bf263db8fb0adfcebfcb327cce00e025d42ce51413e20d4e138a575396b33004d938a4457000513b1f3db6e68f56c5892b03552dac1ad934446d26ea94c226604857d1139a85e5073200c027c15f216884ff018b013f1c0da240881fa85a75f67d52d7108ddab19ca23e39756079b813e87d2567f2b72aab5da256b0decd4063b20f29fc8675bbbe150b6370d63560d8ccac13d964387eebe75a18333fd0ddf9c07b4d1c239aa5fc4a43729c0559a0eda18f29b4f8e4dedbc618e67e3ba9bcb211066493e1693bf4582158850c2cc518627e138af5b","cipherparams":{"iv":"e5a909d2e11de3ea49b5473f31ff3073"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":16384,"p":1,"r":8,"salt":"d4dace3b4401df431d04fe12a71ddef0e2426bf1fd9034fca02daa7843de97ba"},"mac":"2b92ff3c054909046826443b515f9402966d7a273f72ad60ebe61f9faacfcef3"}} | ||
| export-password.txt: >- | ||
| export-password |
29 changes: 29 additions & 0 deletions
29
marketplace/gcp/data-test/chart-overlay/templates/verify-tester.yaml
This file contains hidden or 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,29 @@ | ||
| {{- $sub := index .Subcharts "ccv-cell" }} | ||
| {{- $agg := include "ccv-cell.aggregator.fullname" $sub }} | ||
| {{- $ver := printf "%s-headless" (include "ccv-cell.verifier.fullname" $sub) }} | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: {{ .Release.Name }}-tester | ||
| annotations: | ||
| "helm.sh/hook": test-success | ||
| spec: | ||
| restartPolicy: Never | ||
| containers: | ||
| - name: tester | ||
| image: {{ include "ccv-cell-mp.image" .Values.verify.curl.image | quote }} | ||
| command: | ||
| - sh | ||
| - -c | ||
| - | | ||
| set -e | ||
| agg="http://{{ $agg }}:{{ $sub.Values.aggregator.service.ports.health }}/health/ready" | ||
| ver="http://{{ $ver }}:8100/health" | ||
| deadline=$(( $(date +%s) + 300 )) | ||
| for url in "$agg" "$ver"; do | ||
| until curl -m1 -fsS -o /dev/null "$url"; do | ||
| [ "$(date +%s)" -ge "$deadline" ] && echo "timed out waiting for $url" && exit 1 | ||
| echo "waiting for $url"; sleep 5 | ||
| done | ||
| echo "ok: $url" | ||
| done |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.