Skip to content

Commit eaf118c

Browse files
authored
Create Kustomization manifests (#28)
### Overview We need to create new Kustomize manifests that can be used to deploy the Datum APIServer and Datum Controller manager components so that these components can be used by the community to deploy the software and by our FluxCD pipeline. ### Acceptance Criteria - Two new kustomize programs should be created in the repo to support deploying the API Server and the controller manager - Flux is used to published the kustomize manifests to an OCI repository with the same tagging conventions used by the container image used for the operator binary. - Kustomize folder structure is documented in the repo. ### Potential Folder Structure I'd recommend we organize the repo to support kustomize manifests by using the following folder structure: ```shell config ├── apiserver │ └── kustomization.yaml └── controller-manager └── kustomization.yaml ``` ### Note The Kustomize manifests we expose in this repo should only be ones that are used to deploy the application in a way that can also be used by the open source community. Any additional manifests (e.g. kubeconfig) that we use to deploy the operator in our own specific way should be kept in datum-infra.
2 parents bd40412 + 450a9bd commit eaf118c

File tree

8 files changed

+265
-0
lines changed

8 files changed

+265
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish Artifacts
2+
3+
on:
4+
push:
5+
release:
6+
types: ['published']
7+
8+
jobs:
9+
publish-kustomize-bundles:
10+
permissions:
11+
id-token: write
12+
contents: read
13+
packages: write
14+
strategy:
15+
matrix:
16+
bundles:
17+
- name: ghcr.io/datum-cloud/apiserver
18+
path: config/apiserver
19+
- name: ghcr.io/datum-cloud/controller-manager
20+
path: config/controller-manager
21+
uses: datum-cloud/actions/.github/workflows/publish-kustomize-bundle.yaml@v1.1.0
22+
with:
23+
bundle-name: ${{ matrix.bundles.name }}
24+
bundle-path: ${{ matrix.bundles.path }}
25+
secrets: inherit

config/apiserver/deployment.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: datum-apiserver
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app.kubernetes.io/name: datum-apiserver
10+
app.kubernetes.io/part-of: datum-control-plane
11+
strategy:
12+
rollingUpdate:
13+
maxSurge: 25%
14+
maxUnavailable: 25%
15+
type: RollingUpdate
16+
template:
17+
metadata:
18+
labels:
19+
app.kubernetes.io/name: datum-apiserver
20+
app.kubernetes.io/part-of: datum-control-plane
21+
spec:
22+
automountServiceAccountToken: false
23+
containers:
24+
image: us-east4-docker.pkg.dev/datum-cloud-prod/datum-internal-images/datum-apiserver:v0.0.1-v1alpha12-amd64
25+
imagePullPolicy: IfNotPresent
26+
livenessProbe:
27+
failureThreshold: 3
28+
httpGet:
29+
path: /livez
30+
port: https
31+
scheme: HTTPS
32+
initialDelaySeconds: 10
33+
periodSeconds: 10
34+
successThreshold: 1
35+
timeoutSeconds: 15
36+
name: datum-apiserver
37+
ports:
38+
- containerPort: 6443
39+
name: https
40+
protocol: TCP
41+
readinessProbe:
42+
failureThreshold: 3
43+
httpGet:
44+
path: /readyz
45+
port: https
46+
scheme: HTTPS
47+
initialDelaySeconds: 10
48+
periodSeconds: 10
49+
successThreshold: 1
50+
timeoutSeconds: 15
51+
resources: {}
52+
startupProbe:
53+
failureThreshold: 3
54+
httpGet:
55+
path: /livez
56+
port: https
57+
scheme: HTTPS
58+
initialDelaySeconds: 10
59+
periodSeconds: 10
60+
successThreshold: 1
61+
timeoutSeconds: 15
62+
terminationMessagePath: /dev/termination-log
63+
terminationMessagePolicy: File
64+
dnsPolicy: ClusterFirst
65+
restartPolicy: Always
66+
schedulerName: default-scheduler
67+
securityContext: {}
68+
terminationGracePeriodSeconds: 30

config/apiserver/httpproxy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: projectcontour.io/v1
2+
kind: HTTPProxy
3+
metadata:
4+
name: datum-apiserver
5+
labels:
6+
app: datum-apiserver
7+
spec:
8+
ingressClassName: contour
9+
routes:
10+
- conditions:
11+
- prefix: /apis/resourcemanager.datumapis.com/v1alpha/projects/
12+
pathRewritePolicy:
13+
replacePrefix:
14+
- replacement: /
15+
services:
16+
- name: datum-apiserver
17+
port: 6443
18+
protocol: tls
19+
timeoutPolicy:
20+
response: infinity
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- deployment.yaml
5+
- service.yaml
6+
- httpproxy.yaml

config/apiserver/service.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: datum-apiserver
5+
labels:
6+
app: datum-apiserver
7+
spec:
8+
type: ClusterIP
9+
selector:
10+
app: datum-apiserver
11+
ports:
12+
- name: https
13+
port: 6443
14+
protocol: TCP
15+
targetPort: https
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: datum-controller-manager
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app.kubernetes.io/name: datum-controller-manager
10+
app.kubernetes.io/part-of: datum-control-plane
11+
strategy:
12+
rollingUpdate:
13+
maxSurge: 25%
14+
maxUnavailable: 25%
15+
type: RollingUpdate
16+
template:
17+
metadata:
18+
labels:
19+
app.kubernetes.io/name: datum-controller-manager
20+
app.kubernetes.io/part-of: datum-control-plane
21+
spec:
22+
automountServiceAccountToken: false
23+
containers:
24+
- name: datum-controller-manager
25+
image: us-east4-docker.pkg.dev/datum-cloud-prod/datum-internal-images/datum-controller-manager:v0.0.1-v1alpha2-amd64
26+
imagePullPolicy: IfNotPresent
27+
ports:
28+
- containerPort: 6443
29+
name: https
30+
protocol: TCP
31+
livenessProbe:
32+
httpGet:
33+
path: /healthz
34+
port: https
35+
scheme: HTTPS
36+
initialDelaySeconds: 10
37+
periodSeconds: 10
38+
readinessProbe:
39+
httpGet:
40+
path: /healthz
41+
port: https
42+
scheme: HTTPS
43+
initialDelaySeconds: 10
44+
periodSeconds: 10
45+
startupProbe:
46+
httpGet:
47+
path: /healthz
48+
port: https
49+
scheme: HTTPS
50+
initialDelaySeconds: 10
51+
periodSeconds: 10
52+
restartPolicy: Always
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- deployment.yaml

docs/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Kustomize Manifests for Datum APIServer and Controller Manager
2+
3+
## Overview
4+
This repository provides Kustomize manifests to deploy the Datum APIServer and Datum Controller Manager components. These manifests are structured for ease of use by the community and integration with FluxCD pipelines.
5+
6+
## Repository Structure
7+
```
8+
config
9+
├── api-server
10+
│ ├── deployment.yaml
11+
│ ├── httpproxy.yaml
12+
│ ├── kustomization.yaml
13+
│ ├── service.yaml
14+
├── controller-manager
15+
│ ├── deployment.yaml
16+
│ ├── kustomization.yaml
17+
docs
18+
```
19+
20+
### API Server
21+
The `api-server` folder contains the Kustomize manifests required to deploy the Datum APIServer, including:
22+
- **deployment.yaml**: Defines the Kubernetes Deployment for the API Server.
23+
- **httpproxy.yaml**: Configuration for HTTP routing (if applicable).
24+
- **kustomization.yaml**: Kustomize configuration for managing API Server resources.
25+
- **service.yaml**: Defines the Kubernetes Service for the API Server.
26+
27+
### Controller Manager
28+
The `controller-manager` folder contains the Kustomize manifests required to deploy the Datum Controller Manager, including:
29+
- **deployment.yaml**: Defines the Kubernetes Deployment for the Controller Manager.
30+
- **kustomization.yaml**: Kustomize configuration for managing Controller Manager resources.
31+
32+
## Pushing Manifests using Flux CLI
33+
We utilize `flux push artifact` to publish Kustomize manifests to an OCI repository.
34+
35+
### Example Workflow
36+
To push the manifests to an OCI registry, use the following command:
37+
```sh
38+
flux push artifact oci://ghcr.io/your-org/datum-kustomize:latest \
39+
--path=./config --source=your-repository-url
40+
```
41+
42+
## GitHub Actions Integration
43+
A GitHub Action is set up to automatically push these manifests upon changes. The workflow is defined as follows:
44+
45+
```yaml
46+
name: Publish Kustomize Manifests
47+
48+
on:
49+
push:
50+
branches:
51+
- main
52+
release:
53+
types: [published]
54+
55+
jobs:
56+
push-kustomize:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout Code
60+
uses: actions/checkout@v3
61+
62+
- name: Install Flux CLI
63+
run: |
64+
curl -s https://fluxcd.io/install.sh | sudo bash
65+
66+
- name: Push Manifests
67+
run: |
68+
flux push artifact oci://ghcr.io/your-org/datum-kustomize:latest \
69+
--path=./config --source=\$(git remote get-url origin)
70+
```
71+
72+
This ensures that any updates to the `config` directory are automatically pushed to the OCI registry.
73+
74+
This setup enables both community users and internal automation (e.g., FluxCD) to deploy the Datum APIServer and Controller Manager efficiently.
75+

0 commit comments

Comments
 (0)