Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite operator to use easykube controllers #114

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN set -ex; \
FROM ubuntu:jammy AS python-builder

RUN apt-get update && \
apt-get install -y python3 python3-venv && \
apt-get install -y git python3 python3-venv && \
rm -rf /var/lib/apt/lists/*

RUN python3 -m venv /venv && \
Expand Down Expand Up @@ -66,12 +66,4 @@ COPY --from=python-builder /venv /venv

USER $APP_UID
ENTRYPOINT ["tini", "-g", "--"]
CMD [ \
"/venv/bin/kopf", \
"run", \
"--module", \
"capi_addons.operator", \
"--all-namespaces", \
"--liveness", \
"http://0.0.0.0:8000/healthz" \
]
CMD ["/venv/bin/cluster-api-addon-provider"]
8 changes: 4 additions & 4 deletions capi_addons/models/v1alpha1/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,15 @@ async def init_metadata(
else settings.secret_annotation_prefix
)
cloud_identity_name = cloud_identity["metadata"]["name"]
cloud_identity_label = f"{cloud_identity_label_prefix}/{cloud_identity_name}"
cloud_identity_label = f"{cloud_identity_name}.{cloud_identity_label_prefix}/uses"
self.metadata.labels[cloud_identity_label] = ""
# Add labels that allow us to filter by the configmaps and secrets that we reference
self.metadata.labels.update({
f"{settings.configmap_annotation_prefix}/{name}": ""
f"{name}.{settings.configmap_annotation_prefix}/uses": ""
for name in self.list_configmaps()
})
self.metadata.labels.update({
f"{settings.secret_annotation_prefix}/{name}": ""
f"{name}.{settings.secret_annotation_prefix}/uses": ""
for name in self.list_secrets()
})
labels_updated = self.metadata.labels != previous_labels
Expand Down Expand Up @@ -707,7 +707,7 @@ async def get_chart(
cluster: typing.Dict[str, typing.Any],
infra_cluster: typing.Dict[str, typing.Any],
cloud_identity: typing.Optional[typing.Dict[str, typing.Any]]
) -> contextlib.AbstractAsyncContextManager[Chart]:
) -> typing.AsyncIterator[Chart]:
# Write the files for the ephemeral chart
with tempfile.TemporaryDirectory() as chart_directory:
# Create the directories for the CRDs and templates
Expand Down
Loading
Loading