undistro / zora

Zora is an open source solution that helps you achieve compliance with Kubernetes best practices recommended by industry-leading frameworks. By scanning your cluster with multiple plugins, Zora identifies potential issues, misconfigurations, and vulnerabilities.
https://getup.io/opensource/zora-oss
Apache License 2.0
278 stars 23 forks source link

Multi-platform docker images #201

Closed matheusfm closed 1 year ago

matheusfm commented 1 year ago

Description

Building multi-platform docker images.

Linked Issues

Closes https://github.com/undistro/zora/issues/200

How has this been tested?

Checklist

References:

wsilva commented 1 year ago

Sorry for the Delay. Following up:

I set up a values.yaml with the following change:

...
operator:
  replicaCount: 1
  image:
    repository: ghcr.io/undistro/zora/operator
    tag: "feat-multi-platform-support"
    pullPolicy: IfNotPresent
...

But got the following error:

$ helm install zora -n zora-system -f values.yaml undistro/zora --wait
Error: INSTALLATION FAILED: failed post-install: pod zora-saas-install-hook failed

Looking at the pods got the following:

$ kubectl -n zora-system get pod -o wide
NAME                             READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINATED NODE   READINESS GATES
zora-operator-65fb445f99-m8746   2/2     Running   0          19m   10.42.1.20   pi2    <none>           <none>
zora-saas-install-hook           0/1     Error     0          19m   10.42.3.16   pi4    <none>           <none>

The logs for both pods:

$ kubectl -n zora-system logs -f zora-saas-install-hook
exec /bin/sh: exec format error
$ kubectl -n zora-system logs -f zora-operator-65fb445f99-m8746 -c manager
I0310 21:27:20.816933       1 request.go:665] Waited for 1.04579305s due to client-side throttling, not priority and fairness, request: GET:https://10.43.0.1:443/apis/helm.cattle.io/v1?timeout=32s
{"level":"info","ts":"2023-03-10T21:27:21Z","logger":"controller-runtime.metrics","msg":"Metrics server is starting to listen","addr":"127.0.0.1:8080"}
{"level":"info","ts":"2023-03-10T21:27:21Z","logger":"setup","msg":"registering SaaS hooks on reconcilers","workspaceID":"bd430fe4-fbe7-452c-9d7f-a41d0baff358"}
{"level":"info","ts":"2023-03-10T21:27:21Z","logger":"setup","msg":"starting manager"}
{"level":"info","ts":"2023-03-10T21:27:21Z","msg":"Starting server","kind":"health probe","addr":"[::]:8081"}
{"level":"info","ts":"2023-03-10T21:27:21Z","msg":"Starting server","path":"/metrics","kind":"metrics","addr":"127.0.0.1:8080"}
I0310 21:27:21.251889       1 leaderelection.go:248] attempting to acquire leader lease zora-system/e0f4eef4.zora.undistro.io...
I0310 21:27:40.230012       1 leaderelection.go:258] successfully acquired lease zora-system/e0f4eef4.zora.undistro.io
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.cluster","msg":"Starting EventSource","reconciler group":"zora.undistro.io","reconciler kind":"Cluster","source":"kind source: *v1alpha1.Cluster"}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.cluster","msg":"Starting Controller","reconciler group":"zora.undistro.io","reconciler kind":"Cluster"}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.clusterscan","msg":"Starting EventSource","reconciler group":"zora.undistro.io","reconciler kind":"ClusterScan","source":"kind source: *v1alpha1.ClusterScan"}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.clusterscan","msg":"Starting EventSource","reconciler group":"zora.undistro.io","reconciler kind":"ClusterScan","source":"kind source: *v1.CronJob"}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.clusterscan","msg":"Starting Controller","reconciler group":"zora.undistro.io","reconciler kind":"ClusterScan"}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.cluster","msg":"Starting workers","reconciler group":"zora.undistro.io","reconciler kind":"Cluster","worker count":1}
{"level":"info","ts":"2023-03-10T21:27:40Z","logger":"controller.clusterscan","msg":"Starting workers","reconciler group":"zora.undistro.io","reconciler kind":"ClusterScan","worker count":1}

Conclusion:

The architecture change is working like a charm and the post hook looks like to be another issue that I will investigate. I think you can merge and thanks for work. 🙇

wsilva commented 1 year ago

I have figured out the issue with the hook, the image radial/busyboxplus:curl does not support arm64 architecture.

In this pull request https://github.com/undistro/zora/pull/204 I have changed it to curlimages/curl:7.88.1 that supports arm64 and is rootless. (https://hub.docker.com/r/curlimages/curl/tags)

Be free to use or build another one.

matheusfm commented 1 year ago

Thank you @wsilva Good catch about the helm hook image! I'm closing this PR so we can consider yours (https://github.com/undistro/zora/pull/204).