Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.so
*.dylib
bin/*
dist/
_output/
Dockerfile.cross

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ ARG BASE_IMAGE=registry.access.redhat.com/ubi9-micro:latest

FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1786351949 AS builder

ARG APP_VERSION="0.0.0-dev"

USER root
WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -23,12 +21,14 @@ RUN CGO_ENABLED=1 GOEXPERIMENT=boringcrypto \
go build -trimpath -ldflags="-s -w" -o manager ./cmd/main.go

# Runtime stage
FROM ${BASE_IMAGE} as final
FROM ${BASE_IMAGE} AS final

WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

ARG APP_VERSION="0.0.0-dev"

ENTRYPOINT ["/manager"]

LABEL name="hyperfleet-operator" \
Expand Down
294 changes: 164 additions & 130 deletions Makefile

Large diffs are not rendered by default.

53 changes: 1 addition & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,63 +62,12 @@ kubectl delete -k config/samples/
make uninstall
```

**UnDeploy the controller from the cluster:**
**Undeploy the controller from the cluster:**

```sh
make undeploy
```

## Project Distribution

Following the options to release and provide this solution to the users.

### By providing a bundle with all YAML files

1. Build the installer for the image built and published in the registry:

```sh
make build-installer IMG=<some-registry>/hyperfleet-operator:tag
```

**NOTE:** The makefile target mentioned above generates an 'install.yaml'
file in the dist directory. This file contains all the resources built
with Kustomize, which are necessary to install this project without its
dependencies.

2. Using the installer

Users can just run 'kubectl apply -f <URL for YAML BUNDLE>' to install
the project, i.e.:

```sh
kubectl apply -f https://raw.githubusercontent.com/<org>/hyperfleet-operator/<tag or branch>/dist/install.yaml
```

### By providing a Helm Chart

1. Build the chart using the optional helm plugin

```sh
operator-sdk edit --plugins=helm/v1-alpha
```

2. See that a chart was generated under 'dist/chart', and users
can obtain this solution from there.

**NOTE:** If you change the project, you need to update the Helm Chart
using the same command above to sync the latest changes. Furthermore,
if you create webhooks, you need to use the above command with
the '--force' flag and manually ensure that any custom configuration
previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml'
is manually re-applied afterwards.

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project

**NOTE:** Run `make help` for more information on all potential `make` targets

More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)

## License

Copyright 2026.
Expand Down
24 changes: 24 additions & 0 deletions bundle-hack/update_bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail

CSV_FILE="${CSV_FILE:-/manifests/hyperfleet-operator.clusterserviceversion.yaml}"

# Update image references in the CSV file using yq
yq eval '
# Update operator deployment image
(.spec.install.spec.deployments[].spec.template.spec.containers[] | select(.name == "manager") | .image) = strenv(HYPERFLEET_OPERATOR_IMAGE_PULLSPEC) |

# Update RELATED_IMAGE_HYPERFLEET_API env var
(.spec.install.spec.deployments[].spec.template.spec.containers[] | select(.name == "manager") | .env[] | select(.name == "RELATED_IMAGE_HYPERFLEET_API") | .value) = strenv(HYPERFLEET_API_IMAGE_PULLSPEC) |

# Update containerImage annotation
.metadata.annotations.containerImage = strenv(HYPERFLEET_OPERATOR_IMAGE_PULLSPEC) |

# Update relatedImages
.spec.relatedImages = [
{"name": "hyperfleet-operator", "image": strenv(HYPERFLEET_OPERATOR_IMAGE_PULLSPEC)},
{"name": "hyperfleet-api", "image": strenv(HYPERFLEET_API_IMAGE_PULLSPEC)}
]
' -i "${CSV_FILE}"

cat "${CSV_FILE}"
21 changes: 21 additions & 0 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=hyperfleet-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.42.3
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
51 changes: 51 additions & 0 deletions bundle.konflux.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Konflux bundle image build. Unlike the auto-generated bundle.Dockerfile (used
# for local dev with operator-sdk), this runs bundle-hack/update_bundle.sh to
# patch digest-pinned image references into the CSV at build time.
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS builder-runner
RUN microdnf install -y tar gzip && \
curl -sL https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64.tar.gz | tar xz && \
mv yq_linux_amd64 /usr/bin/yq
Comment thread
ma-hill marked this conversation as resolved.

FROM builder-runner AS builder
# Hack to set the operator container image in the deployment
Comment thread
ma-hill marked this conversation as resolved.
# Konflux nudges update these variables with the latest digest-pinned pullspecs.
ARG HYPERFLEET_OPERATOR_IMAGE_PULLSPEC="quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-operator@sha256:placeholder"
ENV HYPERFLEET_OPERATOR_IMAGE_PULLSPEC=${HYPERFLEET_OPERATOR_IMAGE_PULLSPEC}

ARG HYPERFLEET_API_IMAGE_PULLSPEC="quay.io/redhat-services-prod/hyperfleet-tenant/hyperfleet/hyperfleet-api@sha256:8533d0d875480f31f5112e454659a095a5d2e993c139a9045a06be6b67b829ca"
ENV HYPERFLEET_API_IMAGE_PULLSPEC=${HYPERFLEET_API_IMAGE_PULLSPEC}

COPY bundle-hack .
COPY bundle/manifests /manifests/

RUN ./update_bundle.sh
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
ma-hill marked this conversation as resolved.

FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=hyperfleet-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.42.3
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy patched manifests from builder, metadata and tests from source.
COPY --from=builder /manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/


ARG APP_VERSION="0.0.0-dev"
LABEL name="hyperfleet-operator-bundle" \
vendor="Red Hat, Inc." \
version="${APP_VERSION}" \
summary="OLM bundle for the HyperFleet Operator" \
description="OLM bundle for the HyperFleet Operator, which installs and manages HyperFleet."
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: hyperfleet-operator
control-plane: controller-manager
name: hyperfleet-operator-controller-manager-metrics-service
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: 8443
selector:
app.kubernetes.io/name: hyperfleet-operator
control-plane: controller-manager
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: hyperfleet-operator
name: hyperfleet-operator-hyperfleetconfig-admin-role
rules:
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs
verbs:
- '*'
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: hyperfleet-operator
name: hyperfleet-operator-hyperfleetconfig-editor-role
rules:
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: hyperfleet-operator
name: hyperfleet-operator-hyperfleetconfig-viewer-role
rules:
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs
verbs:
- get
- list
- watch
- apiGroups:
- hyperfleet.redhat.com
resources:
- hyperfleetconfigs/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: hyperfleet-operator
name: hyperfleet-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
Loading