-
Notifications
You must be signed in to change notification settings - Fork 14
feat/scorecard certifier #72
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
Changes from all commits
76df305
c8fe854
162a091
8f712d3
a6273c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # Copyright Kusari, Inc. and GUAC contributors | ||
| # Licensed under the MIT license. See LICENSE file in the project root for details. | ||
| {{ if .Values.guac.scorecardCertifier.enabled }} | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ .Values.guac.scorecardCertifier.name }} | ||
| {{- if .Values.guac.scorecardCertifier.annotations }} | ||
| annotations: | ||
| {{ toYaml .Values.guac.scorecardCertifier.annotations | indent 4 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "guac.labels" . | nindent 4 }} | ||
| app.kubernetes.io/name: {{ .Values.guac.scorecardCertifier.name }} | ||
| app.kubernetes.io/component: {{ .Values.guac.scorecardCertifier.name }} | ||
| spec: | ||
| replicas: {{ .Values.guac.scorecardCertifier.replicas }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "guac.selectorLabels" . | nindent 6 }} | ||
| app.kubernetes.io/name: {{ .Values.guac.scorecardCertifier.name }} | ||
| app.kubernetes.io/component: {{ .Values.guac.scorecardCertifier.name }} | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "guac.selectorLabels" . | nindent 8 }} | ||
| app.kubernetes.io/name: {{ .Values.guac.scorecardCertifier.name }} | ||
| app.kubernetes.io/component: {{ .Values.guac.scorecardCertifier.name }} | ||
| spec: | ||
| serviceAccountName: {{ .Values.guac.scorecardCertifier.name }} | ||
| containers: | ||
| - name: {{ .Values.guac.scorecardCertifier.name }} | ||
| {{- if .Values.guac.guacImage.digest }} | ||
| image: "{{ .Values.guac.guacImage.repository }}@{{ .Values.guac.guacImage.digest }}" | ||
| {{- else }} | ||
| image: "{{ .Values.guac.guacImage.repository }}:{{ .Values.guac.guacImage.tag | default .Chart.AppVersion}}" | ||
| {{- end }} | ||
| imagePullPolicy: "{{ .Values.guac.guacImage.pullPolicy }}" | ||
| command: | ||
| {{ toYaml .Values.guac.scorecardCertifier.image.command | indent 10 }} | ||
| workingDir: {{ .Values.guac.guacImage.workingDir }} | ||
| {{- if .Values.guac.scorecardCertifier.ports }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conditional uses
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional and follows the same pattern used across all other deployment templates in this repository. The conditional .Values.guac.scorecardCertifier.ports acts as a boolean flag to enable/disable port rendering, while .Values.guac.scorecardCertifier.image.ports contains the actual port configuration.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great points - it does follow current standards. |
||
| ports: | ||
| {{ toYaml .Values.guac.scorecardCertifier.image.ports | indent 10 }} | ||
| {{- end }} | ||
| {{- if .Values.guac.scorecardCertifier.resources }} | ||
| resources: {{- toYaml .Values.guac.scorecardCertifier.resources | nindent 10 }} | ||
| {{- end }} | ||
|
|
||
| volumeMounts: | ||
| - name: guac-config | ||
| mountPath: {{ .Values.guac.guacImage.workingDir }} | ||
| readOnly: true | ||
|
|
||
| {{- if or .Values.guac.common.env .Values.guac.scorecardCertifier.env }} | ||
| env: | ||
| {{- if .Values.guac.common.env }} | ||
| {{ toYaml .Values.guac.common.env | indent 10 }} | ||
| {{- end }} | ||
| {{- if .Values.guac.scorecardCertifier.env }} | ||
| {{ toYaml .Values.guac.scorecardCertifier.env | indent 10 }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- if .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{ toYaml .Values.imagePullSecrets | indent 8 }} | ||
| {{- end }} | ||
| volumes: | ||
| - name: guac-config | ||
| configMap: | ||
| name: guac-cm | ||
| {{- if .Values.guac.scorecardCertifier.nodeSelector }} | ||
| nodeSelector: | ||
| {{ toYaml .Values.guac.scorecardCertifier.nodeSelector | indent 8 }} | ||
| {{- end }} | ||
|
|
||
| {{- if or .Values.guac.common.tolerations .Values.guac.scorecardCertifier.tolerations }} | ||
| tolerations: | ||
| {{- if .Values.guac.common.tolerations }} | ||
| {{ toYaml .Values.guac.common.tolerations | indent 8 }} | ||
| {{- end }} | ||
| {{- if .Values.guac.scorecardCertifier.tolerations }} | ||
| {{ toYaml .Values.guac.scorecardCertifier.tolerations | indent 8 }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright Kusari, Inc. and GUAC contributors | ||
| # Licensed under the MIT license. See LICENSE file in the project root for details. | ||
| {{ if .Values.guac.scorecardCertifier.enabled }} | ||
| {{ if .Values.guac.scorecardCertifier.serviceAccount.create }} | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ .Values.guac.scorecardCertifier.name }} | ||
| {{- if .Values.guac.scorecardCertifier.annotations }} | ||
| annotations: | ||
| {{ toYaml .Values.guac.scorecardCertifier.serviceAccount.annotations | indent 4 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "guac.labels" . | nindent 4 }} | ||
| app.kubernetes.io/name: {{ .Values.guac.scorecardCertifier.name }} | ||
| app.kubernetes.io/component: {{ .Values.guac.scorecardCertifier.name }} | ||
| {{- end }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Copyright Kusari, Inc. and GUAC contributors | ||
| # Licensed under the MIT license. See LICENSE file in the project root for details. | ||
| suite: Scorecard Certifier Deployment tests | ||
| templates: | ||
| - scorecard-certifier-deployment.yaml | ||
|
|
||
| tests: | ||
| - it: deployment should render | ||
| values: | ||
| - ./values_digest_and_tag.yaml | ||
| asserts: | ||
| - isKind: | ||
| of: Deployment | ||
| - hasDocuments: | ||
| count: 1 | ||
|
|
||
| - it: should run the scorecardCertifier image | ||
| values: | ||
| - ./values_digest_and_tag.yaml | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.containers[0].name | ||
| value: scorecard-certifier | ||
| - equal: | ||
| path: spec.template.spec.containers[0].image | ||
| value: ghcr.io/guacsec/guac@sha256:167e823f36e268f66b12a79d4c4b39df23c2f87847817c161b6c6ddbc9ee5c4e | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is not in other files but can you add a tag on which guac version this represents?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The corresponding version is v0.1.1, I have updated that and fixed tests as well. |
||
|
|
||
| - it: should run the scorecardCertifier sub command | ||
| values: | ||
| - ./values_digest_and_tag.yaml | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.containers[0].command[0] | ||
| value: "sh" | ||
| - equal: | ||
| path: spec.template.spec.containers[0].command[1] | ||
| value: "-c" | ||
| - equal: | ||
| path: spec.template.spec.containers[0].command[2] | ||
| value: "/opt/guac/guaccollect scorecard" | ||
|
|
||
| - it: should respect spec level parameters | ||
| values: | ||
| - ./values_digest_and_tag.yaml | ||
| asserts: | ||
| - equal: | ||
| path: spec.replicas | ||
| value: 1 | ||
| - equal: | ||
| path: spec.selector.matchLabels["app.kubernetes.io/name"] | ||
| value: scorecard-certifier | ||
| - equal: | ||
| path: spec.template.metadata.labels["app.kubernetes.io/name"] | ||
| value: scorecard-certifier | ||
|
|
||
| - it: should use tag if only tag is specified | ||
| values: | ||
| - ./values_tag_no_digest.yaml | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.containers[0].image | ||
| value: ghcr.io/guacsec/guac:latest | ||
|
|
||
| - it: should include tolerations | ||
| values: | ||
| - ./values_combine.yaml | ||
| asserts: | ||
| - equal: | ||
| path: spec.template.spec.tolerations[0].key | ||
| value: "kusari.cloud/common" | ||
| - equal: | ||
| path: spec.template.spec.tolerations[0].value | ||
| value: common | ||
| - equal: | ||
| path: spec.template.spec.tolerations[0].effect | ||
| value: NoSchedule | ||
| - equal: | ||
| path: spec.template.spec.tolerations[0].operator | ||
| value: Equal | ||
|
|
||
| - equal: | ||
| path: spec.template.spec.tolerations[1].key | ||
| value: "kusari.cloud/own" | ||
| - equal: | ||
| path: spec.template.spec.tolerations[1].value | ||
| value: own | ||
| - equal: | ||
| path: spec.template.spec.tolerations[1].effect | ||
| value: NoSchedule | ||
| - equal: | ||
| path: spec.template.spec.tolerations[1].operator | ||
| value: Equal | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,3 +37,8 @@ guac: | |
| visualizer: | ||
| serviceAccount: | ||
| create: true | ||
|
|
||
| scorecardCertifier: | ||
| enabled: true | ||
| serviceAccount: | ||
| create: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,3 +31,7 @@ guac: | |
|
|
||
| graphqlServer: | ||
| name: graphql-server | ||
|
|
||
| scorecardCertifier: | ||
| enabled: true | ||
| name: scorecard-certifier | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,17 @@ imagePullSecrets: | |
| ## @param guac.cdCertifier.serviceAccount.create - whether to create cdCertifier service account | ||
| ## @param guac.cdCertifier.serviceAccount.annotations - CD Certifier service account annotations | ||
| ## @param guac.cdCertifier.resources - [map] resource requests or limits of the cd Certifier deployment | ||
| ## @param guac.scorecardCertifier.enabled String Whether to deploy Scorecard Certifier | ||
| ## @param guac.scorecardCertifier.name String Name of the Scorecard Certifier component. | ||
| ## @param guac.scorecardCertifier.annotations.reloader.stakater.com/auto [string] Boolean for deploying [stakater/Reloader] (https://github.com/stakater/Reloader) | ||
| ## @param guac.scorecardCertifier.replicas Number of replicas for Scorecard Certifier deployment | ||
| ## @param guac.scorecardCertifier.image.command Command for the Scorecard Certifier image. It is not recommended to override this. | ||
| ## @param guac.scorecardCertifier.env Environment variables for Scorecard Certifier. Note: GITHUB_AUTH_TOKEN is required and should be provided via secretKeyRef. | ||
| ## @param guac.scorecardCertifier.nodeSelector - sets the node selector for where to run the deployment | ||
| ## @param guac.scorecardCertifier.tolerations | ||
| ## @param guac.scorecardCertifier.serviceAccount.create - whether to create scorecardCertifier service account | ||
| ## @param guac.scorecardCertifier.serviceAccount.annotations - Scorecard Certifier service account annotations | ||
| ## @param guac.scorecardCertifier.resources - [map] resource requests or limits of the Scorecard Certifier deployment | ||
| ## @param guac.ingestor.enabled String Whether to deploy Ingestor | ||
| ## @param guac.ingestor.name String Name of the ingestor component. | ||
| ## @param guac.ingestor.annotations.reloader.stakater.com/auto [string] Boolean for deploying [stakater/Reloader] (https://github.com/stakater/Reloader) | ||
|
|
@@ -272,6 +283,34 @@ guac: | |
| # cpu: "0.25" | ||
| # memory: "0.5G" | ||
|
|
||
| scorecardCertifier: | ||
| enabled: false | ||
| name: scorecard-certifier | ||
| annotations: | ||
| reloader.stakater.com/auto: "true" | ||
| replicas: 1 | ||
| image: | ||
| command: ['sh', '-c', '/opt/guac/guaccollect scorecard'] | ||
| # GITHUB_AUTH_TOKEN is required for scorecard certifier to fetch scorecards from GitHub | ||
| # Users should create a Kubernetes secret with their GitHub token and reference it here | ||
| # Example: | ||
| # kubectl create secret generic github-token --from-literal=token=<your-github-token> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't hold any hard opinions here - but I am curious if we should disable this certifier deployment by default given the dependency on an existing secret?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, disabled scorecard by default |
||
| env: | ||
| - name: GITHUB_AUTH_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: github-token | ||
| key: token | ||
| nodeSelector: {} | ||
| tolerations: [] | ||
| serviceAccount: | ||
| create: true | ||
| annotations: {} | ||
| resources: {} | ||
| # requests: | ||
| # cpu: "0.25" | ||
| # memory: "0.5G" | ||
|
|
||
| ingestor: | ||
| enabled: true | ||
| name: ingestor | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update the
values.yamlto reflect these resources existing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the scorecard certifier changes to values.yaml