Skip to content

Commit dd3fbf5

Browse files
committed
operator 0.8.1-rc1 reviews
1 parent 861c675 commit dd3fbf5

7 files changed

Lines changed: 60 additions & 12 deletions

File tree

controller/api/v1alpha1/exporter_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type Exporter struct {
5555
// Exporters represent the services that connect to the physical or virtual
5656
// devices. They are responsible for providing the access to the devices and
5757
// for the communication with the devices. A jumpstarter exporter service
58-
// should be ran on a linux machine, or a pod, with the exporter credentials
58+
// should be run on a linux machine, or a pod, with the exporter credentials
5959
// and the right configuration for this resource to become online. For
6060
// more information see the Jumpstarter documentation:
6161
// https://jumpstarter.dev/main/introduction/exporters.html#exporters

controller/deploy/operator/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
# To re-generate a bundle for another specific version without changing the standard setup, you can:
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
VERSION ?= 0.7.5
6+
VERSION ?= 0.8.1-rc1
7+
8+
# OPENSHIFT_VERSIONS defines the Red Hat OpenShift version range injected into bundle metadata.
9+
OPENSHIFT_VERSIONS ?= v4.18-v4.21
710

811
# CHANNELS define the bundle channels used in the bundle.
912
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -307,7 +310,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
307310
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
308311
@# Inject Red Hat OpenShift version range into bundle metadata (not handled by operator-sdk)
309312
@if ! grep -q 'com.redhat.openshift.versions' bundle/metadata/annotations.yaml; then \
310-
echo ' com.redhat.openshift.versions: v4.18-v4.21' >> bundle/metadata/annotations.yaml; \
313+
echo ' com.redhat.openshift.versions: $(OPENSHIFT_VERSIONS)' >> bundle/metadata/annotations.yaml; \
311314
fi
312315
$(OPERATOR_SDK) bundle validate ./bundle
313316

controller/deploy/operator/config/manifests/bases/jumpstarter-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ metadata:
5050
},
5151
"spec": {
5252
"exporterSelector": {},
53-
"clientSelector": {}
53+
"policies": [{"from": [{"clientSelector": {}}]}]
5454
}
5555
}
5656
]
@@ -70,6 +70,7 @@ metadata:
7070
namespace: placeholder
7171
spec:
7272
apiservicedefinitions: {}
73+
replaces: jumpstarter-operator.v0.8.0
7374
customresourcedefinitions:
7475
owned:
7576
- description: Client represents a user identity for accessing the Jumpstarter

controller/deploy/operator/config/samples/jumpstarter_v1alpha1_client.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ metadata:
55
labels:
66
type: developer
77
spec:
8-
username: "keycloak:user-name-in-keycloak"
8+
username: "kc:user-name-in-keycloak"

controller/deploy/operator/contribute/update-contributions.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -euo pipefail
23

34
# Target repos: "clone-url local-directory"
45
# Add or remove entries here to sync to more/fewer upstreams.
@@ -22,8 +23,43 @@ if [ ! -f "$CSV_PATH" ]; then
2223
fi
2324

2425
VERSION=$(grep "^ version:" "$CSV_PATH" | awk '{print $2}')
26+
if [ -z "$VERSION" ]; then
27+
echo "Error: failed to extract VERSION from $CSV_PATH" >&2
28+
echo "Expected a line matching '^ version:' in $CSV_PATH but got nothing." >&2
29+
exit 1
30+
fi
2531
echo "Bundle version: ${VERSION}"
2632

33+
REPLACES=$(grep "^ replaces:" "$CSV_PATH" | awk '{print $2}')
34+
if [ -z "$REPLACES" ]; then
35+
echo "Error: 'spec.replaces' is not set in $CSV_PATH" >&2
36+
echo "Set 'replaces: jumpstarter-operator.vX.Y.Z' in the CSV base before contributing." >&2
37+
exit 1
38+
fi
39+
40+
REPLACES_VERSION="${REPLACES#jumpstarter-operator.v}"
41+
if [ "$REPLACES_VERSION" = "$VERSION" ]; then
42+
echo "Error: 'spec.replaces' version ($REPLACES_VERSION) is the same as the bundle version ($VERSION)." >&2
43+
echo "Update 'replaces' in the CSV base to point to the previous release." >&2
44+
exit 1
45+
fi
46+
47+
echo ""
48+
echo "============================================"
49+
echo " Bundle version : ${VERSION}"
50+
echo " Replaces : ${REPLACES} (v${REPLACES_VERSION})"
51+
echo "============================================"
52+
echo ""
53+
read -r -p "Proceed with contribution? [y/N] " confirm
54+
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
55+
echo ""
56+
echo "Aborted. To update these values, edit:"
57+
echo " - VERSION in: ${OPERATOR_DIR}/Makefile"
58+
echo " - replaces in: ${OPERATOR_DIR}/config/manifests/bases/jumpstarter-operator.clusterserviceversion.yaml"
59+
echo "Then re-run 'make bundle' followed by 'make contribute'."
60+
exit 1
61+
fi
62+
2763
# Clone any missing repos and ensure "user" remote points to the GITHUB_USER fork
2864
for entry in "${COMMUNITY_OPS[@]}"; do
2965
read -r url dir <<< "$entry"
@@ -40,7 +76,7 @@ for entry in "${COMMUNITY_OPS[@]}"; do
4076

4177
# Add or update the "user" remote for the fork
4278
(
43-
cd "$dir"
79+
cd "$dir" || exit 1
4480
if git remote get-url user &>/dev/null; then
4581
git remote set-url user "$user_fork"
4682
else
@@ -55,7 +91,7 @@ BRANCH="jumpstarter-operator-release-${VERSION}"
5591
for entry in "${COMMUNITY_OPS[@]}"; do
5692
read -r url dir <<< "$entry"
5793
echo "--- $dir: switching to branch $BRANCH ---"
58-
(cd "$dir" && git fetch --all && git checkout remotes/origin/main -B "$BRANCH")
94+
(cd "$dir" || exit 1; git fetch --all && git checkout remotes/origin/main -B "$BRANCH")
5995
done
6096

6197
# Copy bundle into each repo and commit
@@ -65,7 +101,7 @@ for entry in "${COMMUNITY_OPS[@]}"; do
65101
echo "Updating ${dir} to version ${VERSION}"
66102
mkdir -p "$dest"
67103
cp -v -r -f "${BUNDLE_DIR}"/* "$dest"
68-
(cd "$dir" && git add -A && git commit -s -m "operator jumpstarter-operator (${VERSION})")
104+
(cd "$dir" || exit 1; git add -A && git commit -s -m "operator jumpstarter-operator (${VERSION})")
69105
done
70106

71107
echo ""

controller/deploy/operator/internal/controller/jumpstarter/jumpstarter_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ func (r *JumpstarterReconciler) createControllerDeployment(jumpstarter *operator
751751
Args: []string{
752752
"--leader-elect",
753753
"--health-probe-bind-address=:8081",
754-
"--metrics-bind-address=:8080",
754+
"-metrics-bind-address=:8080",
755755
},
756756
Env: envVars,
757757
VolumeMounts: volumeMounts,

controller/internal/service/login/service.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"embed"
2222
"encoding/base64"
2323
"html/template"
24+
"net"
2425
"net/http"
2526
"os"
2627
"time"
@@ -131,9 +132,16 @@ func (s *Service) Start(ctx context.Context) error {
131132
})
132133

133134
port := getEnvOrDefault("LOGIN_SERVICE_PORT", defaultPort)
134-
// Ensure port has the ":" prefix for net.Listen format
135-
if port != "" && port[0] != ':' {
136-
port = ":" + port
135+
// Normalize into a valid net.Listen address.
136+
// If it's already a host:port (or [IPv6]:port), keep it as-is.
137+
// Otherwise treat it as a bare port and prepend ":".
138+
if port != "" {
139+
if _, _, err := net.SplitHostPort(port); err != nil {
140+
// Not a valid host:port — assume bare port (e.g. "8086")
141+
if port[0] != ':' {
142+
port = ":" + port
143+
}
144+
}
137145
}
138146

139147
server := &http.Server{

0 commit comments

Comments
 (0)