Skip to content

Commit 7d2d9f2

Browse files
authored
Merge pull request #36 from omertuc/unouger
Remove dependency on ouger
2 parents 2cacaad + 86e8fe1 commit 7d2d9f2

File tree

91 files changed

+29108
-471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+29108
-471
lines changed

Diff for: Cargo.lock

+75-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ libc = "0.2.147"
4646
clio = { version = "0.3.4", features = ["clap", "clap-parse"] }
4747
data-url = "0.3.0"
4848
reqwest = { version = "0.11.20", default-features = false }
49+
prost = "0.12.1"
50+
51+
[build-dependencies]
52+
prost-build = "0.12.1"
4953

Diff for: Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ RUN apt-get install -y protobuf-compiler
1414
RUN cargo chef cook --release --recipe-path recipe.json
1515
COPY Cargo.toml Cargo.lock .
1616
COPY src/ src/
17+
COPY build.rs build.rs
1718
RUN cargo build --release --bin recert
1819

19-
FROM docker.io/library/golang:1.19-bookworm as ouger-builder
20-
COPY ./ouger $GOPATH/src
21-
WORKDIR $GOPATH/src
22-
RUN go build -buildvcs=false -o $GOPATH/bin/ouger_server cmd/server/ouger_server.go
23-
2420
FROM docker.io/library/debian:bookworm AS runtime
2521
WORKDIR app
2622
RUN apt-get update
2723
RUN apt-get install -y openssl
28-
COPY --from=ouger-builder /go/bin/ouger_server /usr/local/bin
2924
COPY --from=builder /app/target/release/recert /usr/local/bin
3025
ENTRYPOINT ["/usr/local/bin/recert"]

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For more information see the [design doc](docs/design.md)
2222

2323
### Local Development
2424

25-
You need protoc (dnf install protobuf-compiler), podman, etcdctl, [ouger](https://github.com/omertuc/ouger), meld, and an IBU backup seed image. Then run `./run_seed.sh <seed pullspec>`
25+
You need protoc (dnf install protobuf-compiler), podman, etcdctl, meld, and an IBU seed image. Then run `./run_seed.sh <seed pullspec>`
2626

2727
### Run on a cluster
2828

Diff for: build.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
extern crate prost_build;
2+
3+
use std::io::Result;
4+
5+
fn main() -> Result<()> {
6+
let mut prost_build = prost_build::Config::new();
7+
8+
prost_build.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]");
9+
prost_build.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
10+
11+
prost_build.include_file("_includes.rs");
12+
13+
prost_build.compile_protos(
14+
&[
15+
"k8s.io/api/core/v1/generated.proto",
16+
"k8s.io/api/admissionregistration/v1/generated.proto",
17+
"k8s.io/api/apps/v1/generated.proto",
18+
"route/v1/generated.proto",
19+
],
20+
&["./src/protobuf"],
21+
)?;
22+
23+
Ok(())
24+
}

Diff for: docs/design.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,10 @@ right places and doesn't miss anything.
696696
#### etcd scanning
697697

698698
recert will fetch all etcd values of `secrets`, `configmaps`, `machineconfigs`
699-
and a few other kinds. Since etcd doesn't store YAMLs for most resources, and
700-
instead stores a protobuf binary encoding of the resources, `recert` for now
701-
has to use [ouger](https://github.com/omertuc/ouger/) to convert those
702-
resources from and to YAML (this is usually done by kube-apiserver when you
703-
normally use kubernetes, but with recert we use direct etcd access).
699+
and a few other kinds. Since kube-apiserver doesn't store raw JSONs in etcd for
700+
most resources, and instead stores a protobuf binary encoding of the resources,
701+
`recert` has to use protobuf definitions copied from the kubernetes repo in
702+
order to be able to decode/encode those values.
704703

705704
For each kind of resource, `recert` has specialized code to scan it for
706705
cryptographic objects. i.e., recert will not simply brute-force blindly
@@ -977,8 +976,8 @@ key gets discarded during installation.
977976
### etcd cache
978977

979978
During the Commit stage mentioned above, we would do many writes to etcd. It's
980-
very slow to go through ouger and etcd for each one, so instead we maintain an
981-
in-memory cache of all etcd YAMLs, and all writes actually happen in memory.
979+
very slow to go through etcd for each one, so instead we maintain an in-memory
980+
cache of all etcd YAMLs, and all writes actually happen in memory.
982981

983982
In the end, we simply commit that cache back to etcd. This essentially batches
984983
all the etcd writes of the same YAML into a single operation.

Diff for: example.crt

-20
This file was deleted.

0 commit comments

Comments
 (0)