feat(k8s): Add helm chart for deploying to k8s - #154
Conversation
|
Just realised i forgot to add the workflow for validating that the static manifest has been generated. |
fb57f5d to
8f7d8d9
Compare
|
Added the missing workflow |
pehlicd
left a comment
There was a problem hiding this comment.
Looks good overall, just couple of minor adjustments and questions need to be addressed. Thanks a lot for massive effort you put in this PR, I highly appreciate it.
| --- | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: crd-wizard | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: crd-wizard | ||
| namespace: crd-wizard | ||
| labels: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: crd-wizard | ||
| labels: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| rules: | ||
| - apiGroups: ["*"] | ||
| resources: ["*"] | ||
| verbs: ["get", "list"] | ||
| # "Extensive" permissions requested. | ||
| # This provides full read access to all resources in all API groups. | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: crd-wizard | ||
| labels: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: crd-wizard | ||
| namespace: crd-wizard | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: crd-wizard | ||
| apiGroup: rbac.authorization.k8s.io | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: crd-wizard | ||
| namespace: crd-wizard | ||
| labels: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| spec: | ||
| type: ClusterIP | ||
| ipFamilyPolicy: PreferDualStack | ||
| ports: | ||
| - port: 8080 | ||
| targetPort: http | ||
| protocol: TCP | ||
| name: http | ||
| selector: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: crd-wizard | ||
| namespace: crd-wizard | ||
| labels: | ||
| app: crd-wizard | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: crd-wizard | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: crd-wizard | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| spec: | ||
| serviceAccountName: crd-wizard-sa | ||
| serviceAccountName: crd-wizard | ||
| containers: | ||
| - name: crd-wizard | ||
| image: ghcr.io/pehlicd/crd-wizard:latest | ||
| imagePullPolicy: Always | ||
| # Explicit command and args allow overriding the Dockerfile ENTRYPOINT ["crd-wizard", "web"] | ||
| # This makes it easier to use Kustomize patches to change arguments (e.g. adding flags) | ||
| command: ["crd-wizard"] | ||
| args: ["web"] | ||
| ports: | ||
| - containerPort: 8080 | ||
| name: http | ||
| livenessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 10 | ||
| resources: | ||
| limits: | ||
| cpu: 500m | ||
| memory: 512Mi | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| - name: crd-wizard | ||
| image: "ghcr.io/pehlicd/crd-wizard:latest" | ||
| imagePullPolicy: IfNotPresent | ||
| command: | ||
| - crd-wizard | ||
| args: | ||
| - web | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| protocol: TCP | ||
| livenessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 15 | ||
| periodSeconds: 20 | ||
| successThreshold: 1 | ||
| failureThreshold: 3 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 10 | ||
| resources: | ||
| limits: | ||
| cpu: 500m | ||
| memory: 512Mi | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| --- | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: Ingress | ||
| metadata: | ||
| name: crd-wizard | ||
| namespace: crd-wizard | ||
| labels: | ||
| app.kubernetes.io/name: crd-wizard | ||
| app.kubernetes.io/instance: crd-wizard | ||
| app.kubernetes.io/version: "0.0.0" | ||
| spec: | ||
| rules: | ||
| - http: | ||
| paths: | ||
| - path: / | ||
| pathType: Prefix | ||
| backend: | ||
| service: | ||
| name: crd-wizard | ||
| port: | ||
| name: http |
There was a problem hiding this comment.
what is the motivation behind moving ingress, rbac and service objects into one place?
There was a problem hiding this comment.
That is just how helm template outputs it, so it is merely a consequence of generating the manifest from the helm chart.
Though since it is no longer intended to be manually changed i think this should be ok.
Add helm chart derived from `helm create` command. Add README.md and LICENSE files to the helm chart directory. Add lint target to Makefile for helm chart linting. Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
Use the helm chart as a single source of truth for k8s. Generate the base manifest from the helm chart. This consolidates the manifest into a single file. Breaking change: The selector and resource names have changed. Delete the old manifest before applying the new one. Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
Add workflow for linting helm chart. Add workflow for checking if manifests have been updated. Add step for releasing helm chart in release workflow. Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>
8f7d8d9 to
0541cd9
Compare
This PR add a helm chart for deploying to kubernetes.
Additionally it generates the static k8s manifest from the helm chart to maintain a single source of truth.
Finally it add CI workflows to automate verficiation of the helm chart as well as the release.
Example helm chart generated with the new workflow:
Please not that there currently is no working image for k8s.
Closes: #152
Special Notes:
ghcr.io/pehlicd/helm-charts/crd-wizardinstead of the originally plannedghcr.io/pehlicd/crd-wizard-helm