Skip to content

Commit

Permalink
Remove pulumi-operator and move main to pulumi-operator-kubernetes
Browse files Browse the repository at this point in the history
This commit removes the separate `pulumi-operator` package because it created unnecessary complexity. Instead, the main runtimes are moved directly under `pulumi-operator-kubernetes`, simplifying project structure. Modifications in `release.yml` ensure the app can be correctly built and published to Docker. Furthermore, the Dockerfile has been added to support these changes. A few minor configurations (ex. image version in `service.rs` and features in `Cargo.toml`) have also been adjusted to suit this new design.
  • Loading branch information
jan-br committed Sep 21, 2023
1 parent 498f193 commit da2e74a
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 34 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -18,4 +18,15 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: pulumi-operator-kubernetes-job
dockerfile: pulumi-operator-kubernetes-job/Dockerfile
extract-git-tag: true
publish-pulumi-operator-kubernetes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Publish pulumi-operator-kubernetes Docker Image
uses: VaultVulp/gp-docker-action@1.6.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: pulumi-operator-kubernetes
dockerfile: pulumi-operator-kubernetes/Dockerfile
extract-git-tag: true
1 change: 0 additions & 1 deletion Cargo.toml
@@ -1,6 +1,5 @@
[workspace]
members = [
"pulumi-operator",
"pulumi-operator-kubernetes",
"pulumi-operator-kubernetes-job",
"pulumi-cli"
Expand Down
6 changes: 4 additions & 2 deletions pulumi-operator-kubernetes/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ springtime-di = "1.0.0"
springtime = { version = "1.0.0", features = ["tokio", "threadsafe"] }
async-trait = "0.1.71"
kube = { version = "0.85.0", features = ["runtime", "derive", "admission"] }
k8s-openapi = { version = "0.19.0", features = ["schemars"] }
k8s-openapi = { version = "0.19.0", features = ["schemars", "v1_26"] }
tokio = { version = "1.29.1", features = ["full"] }
thiserror = "1.0.43"
serde = "1.0.171"
Expand All @@ -20,4 +20,6 @@ tracing = "0.1.37"
warp = "0.3.5"

[features]
install-crds = []
install-crds = []
boot = []
default = ["boot"]
26 changes: 26 additions & 0 deletions pulumi-operator-kubernetes/Dockerfile
@@ -0,0 +1,26 @@
FROM rust:1.71-buster as chef
WORKDIR /usr/src/pulumi-operator
USER root
ENV CARGO_HOME=/root/.cargo
RUN apt update && apt install -y curl python3-pip npm
RUN curl -fsSL https://get.pulumi.com | sh
ENV PATH="/root/.pulumi/bin:${PATH}"
RUN cargo install cargo-chef

FROM chef as planner
WORKDIR /usr/src/pulumi-operator
USER root
ENV CARGO_HOME=/root/.cargo
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef as builder
WORKDIR /usr/src/pulumi-operator
USER root
ENV CARGO_HOME=/root/.cargo
COPY --from=planner /usr/src/pulumi-operator/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo install --path pulumi-operator-kubernetes && ls -alh /root/.cargo/bin/pulumi-operator-kubernetes && cp /root/.cargo/bin/pulumi-operator-kubernetes /usr/local/bin/pulumi-operator-kubernetes

ENTRYPOINT ["pulumi-operator-kubernetes"]
9 changes: 0 additions & 9 deletions pulumi-operator-kubernetes/src/lib.rs

This file was deleted.

@@ -1,13 +1,17 @@
use springtime::application;
use springtime_di::instance_provider::ComponentInstancePtr;

pub mod config_provider;
pub mod kubernetes;
pub mod stack;

#[tokio::main(flavor = "current_thread")]
async fn main() {
#[cfg(feature = "kubernetes")]
pulumi_operator_kubernetes::bind();
application::create_default()
.unwrap()
.run()
.await
.expect("could not start controller");
}

pub type Inst<T> = ComponentInstancePtr<T>;
2 changes: 1 addition & 1 deletion pulumi-operator-kubernetes/src/stack/service.rs
Expand Up @@ -63,7 +63,7 @@ impl KubernetesPulumiStackService {
"initContainers": init_containers,
"containers": [{
"name": "pulumi",
"image": "ghcr.io/stromee/pulumi-operator/pulumi-operator-kubernetes-job:1.0.13",
"image": "ghcr.io/stromee/pulumi-operator/pulumi-operator-kubernetes-job:1.0.15",
"env": [{
"name": "PULUMI_STACK",
"value": name
Expand Down
19 changes: 0 additions & 19 deletions pulumi-operator/Cargo.toml

This file was deleted.

0 comments on commit da2e74a

Please sign in to comment.