-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James Rawlings <[email protected]>
- Loading branch information
Showing
8 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!--monopod:start--> | ||
# kube-fluentd-operator | ||
| | | | ||
| - | - | | ||
| **Status** | stable | | ||
| **OCI Reference** | `cgr.dev/chainguard/kube-fluentd-operator` | | ||
|
||
|
||
* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/kube-fluentd-operator/overview/) | ||
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags. | ||
*[Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.* | ||
|
||
--- | ||
<!--monopod:end--> | ||
|
||
This image is used for the [Kubernetes Fluentd Operator](https://github.com/vmware/kube-fluentd-operator) | ||
|
||
|
||
## Get It! | ||
|
||
The image is available on `cgr.dev`: | ||
|
||
``` | ||
docker pull cgr.dev/chainguard/kube-fluentd-operator:latest | ||
``` | ||
|
||
This image is a drop-in replacement for the Kubernetes Fluentd Operator available upstream at `vmware/kube-fluentd-operator`. | ||
|
||
## Use It! | ||
|
||
``` | ||
git clone [email protected]:vmware/kube-fluentd-operator.git | ||
helm install kfo ./kube-fluentd-operator/charts/log-router \ | ||
--set rbac.create=true \ | ||
--set image.tag=latest \ | ||
--set image.repository=cgr.dev/chainguard/kube-fluentd-operator | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
contents: | ||
packages: | ||
- kube-fluentd-operator | ||
- kube-fluentd-operator-oci-entrypoint | ||
- kube-fluentd-operator-default-config | ||
- kube-fluentd-operator-compat | ||
|
||
entrypoint: | ||
command: /fluentd/entrypoint.sh | ||
|
||
environment: | ||
FLUENTD_CONF: fluent.conf | ||
LD_PRELOAD: /usr/lib/libjemalloc.so.2 | ||
GEM_PATH: /usr/lib/gem/home | ||
GEM_HOME: /usr/lib/gem/home | ||
PATH: /usr/lib/gem/home/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
accounts: | ||
groups: | ||
- groupname: nonroot | ||
gid: 65532 | ||
users: | ||
- username: nonroot | ||
uid: 65532 | ||
gid: 65532 | ||
run-as: 0 # need to write to /var/log and hostPath volumes are mounted as root | ||
|
||
annotations: | ||
"org.opencontainers.image.url": https://edu.chainguard.dev/chainguard/chainguard-images/reference/kube-fluentd-operator | ||
"org.opencontainers.image.source": https://github.com/chainguard-images/images/tree/main/images/kube-fluentd-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
- apko: | ||
config: configs/latest.apko.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
terraform { | ||
required_providers { | ||
apko = { source = "chainguard-dev/apko" } | ||
} | ||
} | ||
|
||
variable "target_repository" { | ||
description = "The docker repo into which the image and attestations should be published." | ||
} | ||
|
||
module "latest" { | ||
source = "../../tflib/publisher" | ||
|
||
target_repository = var.target_repository | ||
config = file("${path.module}/configs/latest.apko.yaml") | ||
} | ||
|
||
module "version-tags" { | ||
source = "../../tflib/version-tags" | ||
package = "kube-fluentd-operator" | ||
config = module.latest.config | ||
} | ||
|
||
module "test-latest" { | ||
source = "./tests" | ||
digest = module.latest.image_ref | ||
} | ||
|
||
module "tagger" { | ||
source = "../../tflib/tagger" | ||
|
||
depends_on = [ | ||
module.test-latest, | ||
] | ||
|
||
tags = merge( | ||
{ for t in toset(concat(["latest"], module.version-tags.tag_list)) : t => module.latest.image_ref }, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
helm = { source = "hashicorp/helm" } | ||
random = { source = "hashicorp/random" } | ||
} | ||
} | ||
|
||
variable "skip_crds" { | ||
description = "Used to deconflict between multiple installations within the same cluster." | ||
default = false | ||
} | ||
|
||
variable "digest" { | ||
description = "The image digest to run tests over." | ||
} | ||
|
||
data "oci_string" "ref" { input = var.digest } | ||
|
||
resource "random_pet" "suffix" {} | ||
|
||
resource "helm_release" "kfo" { | ||
name = "kfo-${random_pet.suffix.id}" | ||
namespace = "kfo" | ||
chart = "https://github.com/vmware/kube-fluentd-operator/releases/download/v1.17.4/log-router-0.4.0.tgz" # not sure how we can get the correct version of the chart rather than hardcoding a version below | ||
create_namespace = true | ||
timeout = 120 | ||
|
||
values = [ | ||
<<EOF | ||
rbac: | ||
create: true | ||
image: | ||
repository: "${data.oci_string.ref.registry_repo}" | ||
tag: "${data.oci_string.ref.pseudo_tag}" | ||
EOF | ||
] | ||
} | ||
|
||
data "oci_exec_test" "smoke" { | ||
digest = var.digest # This doesn't actually matter here, just pass it something valid | ||
|
||
# This script calls other files in the same relative directory | ||
working_dir = path.module | ||
script = "./smoke-test.sh" | ||
|
||
depends_on = [helm_release.kfo] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit -o nounset -o pipefail -x | ||
|
||
sleep 5 | ||
|
||
# There are docs to test a deployment of the operator, but this is not | ||
# working, same result with the upstream image. # https://github.com/vmware/kube-fluentd-operator#try-it-out | ||
|
||
# Instead, we will test the operator by deploying the log-router helm chart | ||
# and check the deamonset pod is healthy + the logs contain the expected text | ||
|
||
# Check the log-router pods are deployed and healthy | ||
kubectl wait --for=condition=ready pod --selector app=log-router --timeout=120s -n kfo | ||
|
||
# Define the timeout and delay variables | ||
TIMEOUT=180 | ||
DELAY=5 | ||
TIMER=0 | ||
|
||
# Loop until the current time is greater than the end time | ||
while [ $TIMER -lt $TIMEOUT ]; do | ||
# Run the command and check for the text | ||
if kubectl logs -n kfo -l app=log-router --tail -1 -c fluentd | grep "fluentd worker is now running"; then | ||
echo "Worker is running" | ||
exit 0 | ||
fi | ||
|
||
# Sleep for the specified delay, then increment the timer | ||
sleep $DELAY | ||
TIMER=$(($TIMER + $DELAY)) | ||
done | ||
|
||
echo "Worker failed to start within 3 minutes" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters