Compare commits
No commits in common. "39bab0cb3a1d8909820c8ea0595647e6a54f0d7f" and "31e2a32e0187a10a25dcf74cde23ec322f6f435a" have entirely different histories.
39bab0cb3a
...
31e2a32e01
|
@ -1,12 +1,4 @@
|
||||||
# Ignore everything by default
|
target
|
||||||
|
Tiltfile
|
||||||
*
|
manifests
|
||||||
|
orig-compose
|
||||||
# Except the stuff we need
|
|
||||||
|
|
||||||
!.dockerignore
|
|
||||||
!Dockerfile
|
|
||||||
!orig-compose/
|
|
||||||
!src/
|
|
||||||
!Cargo.lock
|
|
||||||
!Cargo.toml
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
target
|
/target
|
||||||
|
Tiltfile
|
||||||
|
manifests/
|
||||||
|
|
121
Tiltfile
121
Tiltfile
|
@ -1,121 +0,0 @@
|
||||||
# Welcome to Tilt!
|
|
||||||
# To get you started as quickly as possible, we have created a
|
|
||||||
# starter Tiltfile for you.
|
|
||||||
#
|
|
||||||
# Uncomment, modify, and delete any commands as needed for your
|
|
||||||
# project's configuration.
|
|
||||||
|
|
||||||
|
|
||||||
# Output diagnostic messages
|
|
||||||
# You can print log messages, warnings, and fatal errors, which will
|
|
||||||
# appear in the (Tiltfile) resource in the web UI. Tiltfiles support
|
|
||||||
# multiline strings and common string operations such as formatting.
|
|
||||||
#
|
|
||||||
# More info: https://docs.tilt.dev/api.html#api.warn
|
|
||||||
print("""
|
|
||||||
-----------------------------------------------------------------
|
|
||||||
✨ Hello Tilt! This appears in the (Tiltfile) pane whenever Tilt
|
|
||||||
evaluates this file.
|
|
||||||
-----------------------------------------------------------------
|
|
||||||
""".strip())
|
|
||||||
|
|
||||||
|
|
||||||
# Build Docker image
|
|
||||||
# Tilt will automatically associate image builds with the resource(s)
|
|
||||||
# that reference them (e.g. via Kubernetes or Docker Compose YAML).
|
|
||||||
|
|
||||||
# More info: https://docs.tilt.dev/api.html#api.docker_build
|
|
||||||
|
|
||||||
docker_build('melenion/neon-operator',
|
|
||||||
context='.',
|
|
||||||
)
|
|
||||||
|
|
||||||
docker_build('melenion/compute-node-v15', context="orig-compose/compute_wrapper", build_args={"REPOSITORY": "neondatabase", "COMPUTE_IMAGE": "compute-node-v15"})
|
|
||||||
|
|
||||||
k8s_yaml("crd.yaml")
|
|
||||||
k8s_kind('NeonDatabase', image_json_path='{.spec.compute_image_ref}')
|
|
||||||
|
|
||||||
# Apply Kubernetes manifests
|
|
||||||
# Tilt will build & push any necessary images, re-deploying your
|
|
||||||
# resources as they change.
|
|
||||||
#
|
|
||||||
# More info: https://docs.tilt.dev/api.html#api.k8s_yaml
|
|
||||||
#
|
|
||||||
k8s_yaml(['manifests/deployment.yaml', 'manifests/rbac.yaml', 'manifests/example.yaml'])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Customize a Kubernetes resource
|
|
||||||
# By default, Kubernetes resource names are automatically assigned
|
|
||||||
# based on objects in the YAML manifests, e.g. Deployment name.
|
|
||||||
#
|
|
||||||
# Tilt strives for sane defaults, so calling k8s_resource is
|
|
||||||
# optional, and you only need to pass the arguments you want to
|
|
||||||
# override.
|
|
||||||
#
|
|
||||||
# More info: https://docs.tilt.dev/api.html#api.k8s_resource
|
|
||||||
#
|
|
||||||
# k8s_resource('my-deployment',
|
|
||||||
# # map one or more local ports to ports on your Pod
|
|
||||||
# port_forwards=['5000:8080'],
|
|
||||||
# # change whether the resource is started by default
|
|
||||||
# auto_init=False,
|
|
||||||
# # control whether the resource automatically updates
|
|
||||||
# trigger_mode=TRIGGER_MODE_MANUAL
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
# Run local commands
|
|
||||||
# Local commands can be helpful for one-time tasks like installing
|
|
||||||
# project prerequisites. They can also manage long-lived processes
|
|
||||||
# for non-containerized services or dependencies.
|
|
||||||
#
|
|
||||||
# More info: https://docs.tilt.dev/local_resource.html
|
|
||||||
#
|
|
||||||
# local_resource('install-helm',
|
|
||||||
# cmd='which helm > /dev/null || brew install helm',
|
|
||||||
# # `cmd_bat`, when present, is used instead of `cmd` on Windows.
|
|
||||||
# cmd_bat=[
|
|
||||||
# 'powershell.exe',
|
|
||||||
# '-Noninteractive',
|
|
||||||
# '-Command',
|
|
||||||
# '& {if (!(Get-Command helm -ErrorAction SilentlyContinue)) {scoop install helm}}'
|
|
||||||
# ]
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
# Extensions are open-source, pre-packaged functions that extend Tilt
|
|
||||||
#
|
|
||||||
# More info: https://github.com/tilt-dev/tilt-extensions
|
|
||||||
#
|
|
||||||
load('ext://git_resource', 'git_checkout')
|
|
||||||
|
|
||||||
|
|
||||||
# Organize logic into functions
|
|
||||||
# Tiltfiles are written in Starlark, a Python-inspired language, so
|
|
||||||
# you can use functions, conditionals, loops, and more.
|
|
||||||
#
|
|
||||||
# More info: https://docs.tilt.dev/tiltfile_concepts.html
|
|
||||||
#
|
|
||||||
def tilt_demo():
|
|
||||||
# Tilt provides many useful portable built-ins
|
|
||||||
# https://docs.tilt.dev/api.html#modules.os.path.exists
|
|
||||||
if os.path.exists('tilt-avatars/Tiltfile'):
|
|
||||||
# It's possible to load other Tiltfiles to further organize
|
|
||||||
# your logic in large projects
|
|
||||||
# https://docs.tilt.dev/multiple_repos.html
|
|
||||||
load_dynamic('tilt-avatars/Tiltfile')
|
|
||||||
watch_file('tilt-avatars/Tiltfile')
|
|
||||||
git_checkout('https://github.com/tilt-dev/tilt-avatars.git',
|
|
||||||
checkout_dir='tilt-avatars')
|
|
||||||
|
|
||||||
|
|
||||||
# Edit your Tiltfile without restarting Tilt
|
|
||||||
# While running `tilt up`, Tilt watches the Tiltfile on disk and
|
|
||||||
# automatically re-evaluates it on change.
|
|
||||||
#
|
|
||||||
# To see it in action, try uncommenting the following line with
|
|
||||||
# Tilt running.
|
|
||||||
# tilt_demo()
|
|
13
crd.yaml
13
crd.yaml
|
@ -3,11 +3,11 @@ items:
|
||||||
- apiVersion: apiextensions.k8s.io/v1
|
- apiVersion: apiextensions.k8s.io/v1
|
||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
creationTimestamp: "2024-05-26T16:36:02Z"
|
creationTimestamp: "2024-05-24T17:05:01Z"
|
||||||
generation: 1
|
generation: 1
|
||||||
name: neondatabases.melenion.com
|
name: neondatabases.melenion.com
|
||||||
resourceVersion: "1639"
|
resourceVersion: "32345"
|
||||||
uid: 67a48c88-e122-4e7a-a2d2-92ed68ef989e
|
uid: c72c3bea-c002-4a74-a91a-f6d1a36f683d
|
||||||
spec:
|
spec:
|
||||||
conversion:
|
conversion:
|
||||||
strategy: None
|
strategy: None
|
||||||
|
@ -28,14 +28,11 @@ items:
|
||||||
properties:
|
properties:
|
||||||
spec:
|
spec:
|
||||||
properties:
|
properties:
|
||||||
compute_image_ref:
|
|
||||||
type: string
|
|
||||||
neon_image_ref:
|
neon_image_ref:
|
||||||
type: string
|
type: string
|
||||||
postgres_version:
|
postgres_version:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- compute_image_ref
|
|
||||||
- neon_image_ref
|
- neon_image_ref
|
||||||
- postgres_version
|
- postgres_version
|
||||||
type: object
|
type: object
|
||||||
|
@ -55,12 +52,12 @@ items:
|
||||||
- nd
|
- nd
|
||||||
singular: neondatabase
|
singular: neondatabase
|
||||||
conditions:
|
conditions:
|
||||||
- lastTransitionTime: "2024-05-26T16:36:02Z"
|
- lastTransitionTime: "2024-05-24T17:05:01Z"
|
||||||
message: no conflicts found
|
message: no conflicts found
|
||||||
reason: NoConflicts
|
reason: NoConflicts
|
||||||
status: "True"
|
status: "True"
|
||||||
type: NamesAccepted
|
type: NamesAccepted
|
||||||
- lastTransitionTime: "2024-05-26T16:36:02Z"
|
- lastTransitionTime: "2024-05-24T17:05:01Z"
|
||||||
message: the initial names have been accepted
|
message: the initial names have been accepted
|
||||||
reason: InitialNamesAccepted
|
reason: InitialNamesAccepted
|
||||||
status: "True"
|
status: "True"
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: neon-operator
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: neon-operator
|
|
||||||
strategy:
|
|
||||||
type: Recreate
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: neon-operator
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: neon-operator
|
|
||||||
image: melenion/neon-operator:latest
|
|
||||||
imagePullPolicy: Always
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: "128Mi"
|
|
||||||
cpu: "500m"
|
|
||||||
serviceAccountName: neon-operator
|
|
|
@ -1,8 +0,0 @@
|
||||||
apiVersion: melenion.com/v1
|
|
||||||
kind: NeonDatabase
|
|
||||||
metadata:
|
|
||||||
name: my-neon-database
|
|
||||||
spec:
|
|
||||||
compute_image_ref: "melenion/compute-node-v15"
|
|
||||||
neon_image_ref: "neondatabase/neon"
|
|
||||||
postgres_version: "15"
|
|
|
@ -1,54 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: neon-operator
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: neon-operator-cluster-role
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- melenion.com
|
|
||||||
resources:
|
|
||||||
- neondatabases
|
|
||||||
verbs:
|
|
||||||
- "*"
|
|
||||||
- apiGroups: [""]
|
|
||||||
resources:
|
|
||||||
- pods
|
|
||||||
- services
|
|
||||||
- endpoints
|
|
||||||
- persistentvolumeclaims
|
|
||||||
- events
|
|
||||||
- configmaps
|
|
||||||
- secrets
|
|
||||||
- deployments
|
|
||||||
verbs:
|
|
||||||
- "*"
|
|
||||||
- apiGroups:
|
|
||||||
- apiextensions.k8s.io
|
|
||||||
resources:
|
|
||||||
- customresourcedefinitions
|
|
||||||
verbs:
|
|
||||||
- "*"
|
|
||||||
- apiGroups:
|
|
||||||
- apps
|
|
||||||
resources:
|
|
||||||
- deployments
|
|
||||||
- statefulsets
|
|
||||||
verbs:
|
|
||||||
- "*"
|
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
metadata:
|
|
||||||
name: neon-operator-cluster-role-binding
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: neon-operator-cluster-role
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: neon-operator
|
|
||||||
namespace: default
|
|
|
@ -109,7 +109,7 @@ async fn reconcile(neon: Arc<NeonDatabase>, context: Arc<ContextData>) -> Result
|
||||||
neon::reconcile_storage_broker(client.clone(), &namespace).await?;
|
neon::reconcile_storage_broker(client.clone(), &namespace).await?;
|
||||||
neon::reconcile_page_server(client.clone(), &namespace).await?;
|
neon::reconcile_page_server(client.clone(), &namespace).await?;
|
||||||
neon::reconcile_safe_keepers(client.clone(), &namespace).await?;
|
neon::reconcile_safe_keepers(client.clone(), &namespace).await?;
|
||||||
neon::reconcile_compute(client.clone(), &namespace, &neon.spec.compute_image_ref).await?;
|
neon::reconcile_compute(client.clone(), &namespace, &neon.spec.neon_image_ref).await?;
|
||||||
Ok(Action::requeue(Duration::from_secs(5)))
|
Ok(Action::requeue(Duration::from_secs(5)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ pub async fn create_deployment(client: Client, namespace: &str) -> Result<(), Er
|
||||||
]),
|
]),
|
||||||
image: Some("minio/mc".to_string()),
|
image: Some("minio/mc".to_string()),
|
||||||
command: Some(vec!["bash".to_string(), "-c".to_string()]),
|
command: Some(vec!["bash".to_string(), "-c".to_string()]),
|
||||||
args: Some(vec!["until (/usr/bin/mc alias set minio http://localhost:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD) do
|
args: Some(vec!["until (/usr/bin/mc alias set minio http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD) do
|
||||||
echo 'Waiting to start minio...' && sleep 1;
|
echo 'Waiting to start minio...' && sleep 1;
|
||||||
done;
|
done;
|
||||||
/usr/bin/mc mb --ignore-existing minio/neon --region=eu-north-1;
|
/usr/bin/mc mb --ignore-existing minio/neon --region=eu-north-1;
|
||||||
|
|
|
@ -373,11 +373,7 @@ pub async fn reconcile_safe_keepers(client: Client, namespace: &str) -> Result<(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn reconcile_compute(
|
pub async fn reconcile_compute(client: Client, namespace: &str, image: &str) -> Result<(), Error> {
|
||||||
client: Client,
|
|
||||||
namespace: &str,
|
|
||||||
compute_image: &str,
|
|
||||||
) -> Result<(), Error> {
|
|
||||||
let deployment = Deployment {
|
let deployment = Deployment {
|
||||||
metadata: ObjectMeta {
|
metadata: ObjectMeta {
|
||||||
name: Some("compute".to_string()),
|
name: Some("compute".to_string()),
|
||||||
|
@ -398,7 +394,7 @@ pub async fn reconcile_compute(
|
||||||
spec: Some(PodSpec {
|
spec: Some(PodSpec {
|
||||||
containers: vec![Container {
|
containers: vec![Container {
|
||||||
name: "compute".to_string(),
|
name: "compute".to_string(),
|
||||||
image: Some(compute_image.to_string()),
|
image: Some(image.to_string()),
|
||||||
ports: Some(vec![ContainerPort {
|
ports: Some(vec![ContainerPort {
|
||||||
container_port: 9898,
|
container_port: 9898,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
Loading…
Reference in New Issue