-
Notifications
You must be signed in to change notification settings - Fork 4
Add Helm chart for deployment-tracker #62
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 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23cf2f0
add helm chart
bdehamer 1dc85c7
set default version to 0.0.0
bdehamer 1bdd11c
Update deploy/charts/deployment-tracker/templates/clusterrole.yaml
bdehamer 3ed5e00
Add Helm template validation for mutually exclusive namespace flags (…
Copilot 86a91a7
Update deploy/charts/deployment-tracker/templates/_helpers.tpl
bdehamer 6e24dc1
remove required value warning in notes
bdehamer 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
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
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,13 @@ | ||
| # Patterns to ignore when building packages. | ||
| .DS_Store | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| .git | ||
| .gitignore | ||
| .project | ||
| .idea | ||
| *.tmproj | ||
| .vscode |
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,17 @@ | ||
| apiVersion: v2 | ||
| name: deployment-tracker | ||
| description: A Kubernetes controller that monitors pod lifecycles and uploads deployment records to GitHub's artifact metadata API | ||
| type: application | ||
| version: 0.0.0 | ||
| appVersion: "0.0.0" | ||
| kubeVersion: ">= 1.19.0-0" | ||
| keywords: | ||
| - kubernetes | ||
| - deployment-tracker | ||
| - github | ||
| - artifact-attestations | ||
| - supply-chain-security | ||
| home: https://github.com/github/deployment-tracker | ||
| maintainers: | ||
| - name: GitHub Package Security | ||
| url: https://github.com/github |
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,173 @@ | ||
| # deployment-tracker Helm Chart | ||
|
|
||
| A Helm chart for deploying the deployment-tracker Kubernetes controller, which | ||
| monitors pod lifecycles and uploads deployment records to GitHub's artifact | ||
| metadata API. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Kubernetes 1.19+ | ||
| - Helm 3.8+ | ||
| - A GitHub organization with | ||
| [Artifact Attestations](https://docs.github.com/en/actions/concepts/security/artifact-attestations) | ||
| enabled | ||
| - An API token or GitHub App for authentication | ||
|
|
||
| ## Installation | ||
|
|
||
| ### Install from OCI registry | ||
|
|
||
| ```bash | ||
| helm install deployment-tracker \ | ||
| oci://ghcr.io/github/charts/deployment-tracker \ | ||
| --namespace deployment-tracker \ | ||
| --create-namespace \ | ||
| --set config.org=my-org \ | ||
| --set config.logicalEnvironment=production \ | ||
| --set config.cluster=my-cluster \ | ||
| --set auth.apiTokenSecret=my-api-token-secret | ||
| ``` | ||
|
|
||
| ### Install from local source | ||
|
|
||
| ```bash | ||
| helm install deployment-tracker ./deploy/charts/deployment-tracker \ | ||
| --namespace deployment-tracker \ | ||
| --create-namespace \ | ||
| -f my-values.yaml | ||
| ``` | ||
|
|
||
| ## Required Values | ||
|
|
||
| The following values **must** be set for the controller to function: | ||
|
|
||
| | Value | Description | | ||
| |-------|-------------| | ||
| | `config.org` | GitHub organization name | | ||
| | `config.logicalEnvironment` | Logical environment name (e.g., `production`, `staging`) | | ||
| | `config.cluster` | Kubernetes cluster name | | ||
|
|
||
| At least one authentication method must be configured (see | ||
| [Authentication](#authentication)). | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Controller Configuration | ||
|
|
||
| | Parameter | Description | Default | | ||
| |-----------|-------------|---------| | ||
| | `config.org` | GitHub organization name | `""` (required) | | ||
| | `config.logicalEnvironment` | Logical environment name | `""` (required) | | ||
| | `config.cluster` | Cluster name | `""` (required) | | ||
| | `config.physicalEnvironment` | Physical environment name | `""` | | ||
| | `config.baseUrl` | API base URL | `api.github.com` | | ||
| | `config.dnTemplate` | Deployment name template | `{{namespace}}/{{deploymentName}}/{{containerName}}` | | ||
| | `config.namespace` | Namespace to monitor (empty for all) | `""` | | ||
| | `config.excludeNamespaces` | Namespaces to exclude (comma-separated) | `""` | | ||
| | `config.workers` | Number of worker goroutines | `2` | | ||
| | `config.metricsPort` | Port for Prometheus metrics | `9090` | | ||
|
|
||
| ### Image Configuration | ||
|
|
||
| | Parameter | Description | Default | | ||
| |-----------|-------------|---------| | ||
| | `image.repository` | Container image repository | `ghcr.io/github/deployment-tracker` | | ||
| | `image.tag` | Container image tag | Chart `appVersion` | | ||
| | `image.pullPolicy` | Image pull policy | `IfNotPresent` | | ||
| | `imagePullSecrets` | Image pull secrets | `[]` | | ||
|
|
||
| ### Authentication | ||
|
|
||
| The controller supports two authentication methods: API token and GitHub App. | ||
|
|
||
| #### API Token | ||
|
|
||
| ```yaml | ||
| # Option 1: Inline token (not recommended for production) | ||
| auth: | ||
| apiToken: "ghp_xxxxxxxxxxxx" | ||
|
|
||
| # Option 2: Reference to an existing Secret (recommended) | ||
| auth: | ||
| apiTokenSecret: "my-api-token-secret" | ||
| ``` | ||
|
|
||
| When using `apiTokenSecret`, the Secret must have a key named `token`: | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: my-api-token-secret | ||
| type: Opaque | ||
| stringData: | ||
| token: "ghp_xxxxxxxxxxxx" | ||
| ``` | ||
|
|
||
| #### GitHub App | ||
|
|
||
| ```yaml | ||
| # Option 1: Inline private key | ||
| auth: | ||
| githubApp: | ||
| appId: "12345" | ||
| installId: "67890" | ||
| privateKey: "<base64-encoded-private-key>" | ||
|
|
||
| # Option 2: Reference to an existing Secret (recommended) | ||
| auth: | ||
| githubApp: | ||
| appId: "12345" | ||
| installId: "67890" | ||
| privateKeySecret: "my-github-app-secret" | ||
| ``` | ||
|
|
||
| When using `privateKeySecret`, the Secret must have a key named `private-key`: | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: my-github-app-secret | ||
| type: Opaque | ||
| stringData: | ||
| private-key: "<base64-encoded-private-key>" | ||
| ``` | ||
|
|
||
| ### Resources and Security | ||
|
|
||
| | Parameter | Description | Default | | ||
| |-----------|-------------|---------| | ||
| | `replicaCount` | Number of controller replicas | `1` | | ||
| | `resources.requests.cpu` | CPU request | `100m` | | ||
| | `resources.requests.memory` | Memory request | `1024Mi` | | ||
| | `resources.limits.cpu` | CPU limit | `200m` | | ||
| | `resources.limits.memory` | Memory limit | `2048Mi` | | ||
| | `securityContext` | Container security context | Hardened (see values.yaml) | | ||
| | `readinessProbe` | Readiness probe configuration | HTTP GET /metrics:9090 | | ||
| | `lifecycle` | Lifecycle hooks | preStop sleep 5s | | ||
|
|
||
| ### Service and Networking | ||
|
|
||
| | Parameter | Description | Default | | ||
| |-----------|-------------|---------| | ||
| | `service.enabled` | Create a Service for metrics | `true` | | ||
| | `service.type` | Service type | `ClusterIP` | | ||
| | `service.port` | Service port | `9090` | | ||
| | `nodeSelector` | Node selector | `{}` | | ||
| | `tolerations` | Tolerations | `[]` | | ||
| | `affinity` | Affinity rules | `{}` | | ||
|
|
||
| ### Service Account | ||
|
|
||
| | Parameter | Description | Default | | ||
| |-----------|-------------|---------| | ||
| | `serviceAccount.create` | Create a ServiceAccount | `true` | | ||
| | `serviceAccount.name` | ServiceAccount name | Generated from fullname | | ||
| | `serviceAccount.annotations` | ServiceAccount annotations | `{}` | | ||
|
|
||
| ## Uninstalling | ||
|
|
||
| ```bash | ||
| helm uninstall deployment-tracker -n deployment-tracker | ||
| ``` |
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,26 @@ | ||
| deployment-tracker has been installed. | ||
|
|
||
| {{- if not .Values.config.org }} | ||
|
|
||
| WARNING: config.org is not set. The controller requires a GitHub organization name. | ||
| {{- end }} | ||
|
|
||
| 1. Check the deployment status: | ||
|
|
||
| kubectl get deployment {{ include "deployment-tracker.fullname" . }} -n {{ .Release.Namespace }} | ||
|
|
||
| 2. Check the controller pods: | ||
|
|
||
| kubectl get pods -n {{ .Release.Namespace }} -l "{{ include "deployment-tracker.selectorLabels" . | replace "\n" "," }}" | ||
|
|
||
| 3. View controller logs: | ||
|
|
||
| kubectl logs -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "deployment-tracker.name" . }}" -f | ||
|
|
||
| {{- if .Values.service.enabled }} | ||
|
|
||
| 4. Access Prometheus metrics: | ||
|
|
||
| kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "deployment-tracker.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }} | ||
| curl http://localhost:{{ .Values.service.port }}/metrics | ||
| {{- 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,60 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "deployment-tracker.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| */}} | ||
| {{- define "deployment-tracker.fullname" -}} | ||
| {{- if .Values.fullnameOverride }} | ||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||
| {{- if contains $name .Release.Name }} | ||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "deployment-tracker.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels. | ||
| */}} | ||
| {{- define "deployment-tracker.labels" -}} | ||
| helm.sh/chart: {{ include "deployment-tracker.chart" . }} | ||
| {{ include "deployment-tracker.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels. | ||
| */}} | ||
| {{- define "deployment-tracker.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "deployment-tracker.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use. | ||
| */}} | ||
| {{- define "deployment-tracker.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "deployment-tracker.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
bdehamer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {{- end }} | ||
| {{- end }} | ||
34 changes: 34 additions & 0 deletions
34
deploy/charts/deployment-tracker/templates/clusterrole.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,34 @@ | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ include "deployment-tracker.fullname" . }} | ||
| labels: | ||
| {{- include "deployment-tracker.labels" . | nindent 4 }} | ||
| rules: | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - pods | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - deployments | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - replicasets | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - batch | ||
| resources: | ||
| - cronjobs | ||
| - jobs | ||
| verbs: | ||
| - get | ||
bdehamer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.