Skip to content

Commit df2e580

Browse files
authored
Merge branch 'main' into mh_roxie-41
2 parents 690ef8d + 878de21 commit df2e580

8 files changed

Lines changed: 381 additions & 87 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
branches: [ main ]
1010

1111
env:
12-
REGISTRY: ghcr.io
13-
IMAGE_NAME: ${{ github.repository }}
12+
REGISTRY: quay.io
13+
IMAGE_NAME: rhacs-eng/roxie
1414

1515
jobs:
1616
docker-build-push:
@@ -35,12 +35,12 @@ jobs:
3535
- name: Set up Docker Buildx
3636
uses: docker/setup-buildx-action@v3
3737

38-
- name: Log in to GitHub Container Registry
38+
- name: Log in to Quay.io
3939
uses: docker/login-action@v3
4040
with:
4141
registry: ${{ env.REGISTRY }}
42-
username: ${{ github.actor }}
43-
password: ${{ secrets.GITHUB_TOKEN }}
42+
username: ${{ secrets.REGISTRY_USERNAME }}
43+
password: ${{ secrets.REGISTRY_TOKEN }}
4444

4545
- name: Get build metadata
4646
id: build-meta

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-release:
13+
name: Build and Release Binaries
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version-file: go.mod
26+
cache: true
27+
28+
- name: Get version information
29+
id: version
30+
run: |
31+
echo "version=$(make version)" >> $GITHUB_OUTPUT
32+
echo "git_commit=$(make get-commit-hash)" >> $GITHUB_OUTPUT
33+
echo "build_date=$(make get-build-date)" >> $GITHUB_OUTPUT
34+
35+
- name: Build binaries for multiple platforms
36+
env:
37+
VERSION: ${{ steps.version.outputs.version }}
38+
GIT_COMMIT: ${{ steps.version.outputs.git_commit }}
39+
BUILD_DATE: ${{ steps.version.outputs.build_date }}
40+
run: |
41+
LDFLAGS="-X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} -X main.buildDate=${BUILD_DATE}"
42+
43+
# Linux amd64
44+
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o roxie-linux-amd64 ./cmd
45+
46+
# Linux arm64
47+
GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o roxie-linux-arm64 ./cmd
48+
49+
# macOS amd64
50+
GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o roxie-darwin-amd64 ./cmd
51+
52+
# macOS arm64
53+
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o roxie-darwin-arm64 ./cmd
54+
55+
# Generate checksums
56+
sha256sum roxie-* > checksums.txt
57+
58+
- name: Create GitHub Release
59+
uses: softprops/action-gh-release@v2
60+
with:
61+
name: Release ${{ steps.version.outputs.version }}
62+
draft: false
63+
prerelease: false
64+
generate_release_notes: true
65+
files: |
66+
roxie-linux-amd64
67+
roxie-linux-arm64
68+
roxie-darwin-amd64
69+
roxie-darwin-arm64
70+
checksums.txt

Dockerfile

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ RUN echo "Building for ${TARGETOS}/${TARGETARCH}" && \
3232
-o roxie \
3333
./cmd
3434

35+
# Download gcloud SDK in builder stage to avoid UBI filesystem restrictions
36+
ARG GCLOUD_VERSION=latest
37+
RUN apk add --no-cache curl python3 && \
38+
ARCH=${TARGETARCH:-amd64} && \
39+
if [ "${ARCH}" = "amd64" ]; then \
40+
GCLOUD_ARCH="x86_64"; \
41+
elif [ "${ARCH}" = "arm64" ]; then \
42+
GCLOUD_ARCH="arm"; \
43+
else \
44+
echo "ERROR: Unsupported architecture: ${ARCH}"; exit 1; \
45+
fi && \
46+
curl -fsSL "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-${GCLOUD_ARCH}.tar.gz" | \
47+
tar -xz -C /tmp && \
48+
/tmp/google-cloud-sdk/bin/gcloud components install gke-gcloud-auth-plugin --quiet
49+
3550
# Stage 2: Runtime image based on Red Hat UBI Minimal
3651
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
3752

@@ -64,19 +79,17 @@ RUN microdnf install -y \
6479
ARG KUBECTL_VERSION=v1.29.0
6580
RUN ARCH=${TARGETARCH:-amd64} && \
6681
echo "Installing kubectl for ${ARCH}" && \
67-
curl -sLo /usr/local/bin/kubectl \
82+
curl -fsSLo /usr/local/bin/kubectl \
6883
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" \
6984
&& chmod +x /usr/local/bin/kubectl
7085

7186
# Install helm - architecture-aware
7287
ARG HELM_VERSION=v3.14.0
7388
RUN ARCH=${TARGETARCH:-amd64} && \
7489
echo "Installing helm for ${ARCH}" && \
75-
curl -sL "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" \
76-
| tar xz -C /tmp \
77-
&& mv /tmp/linux-${ARCH}/helm /usr/local/bin/helm \
78-
&& chmod +x /usr/local/bin/helm \
79-
&& rm -rf /tmp/linux-${ARCH}
90+
curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" | \
91+
tar -xzO "linux-${ARCH}/helm" > /usr/local/bin/helm && \
92+
chmod +x /usr/local/bin/helm
8093

8194
# Install roxctl - architecture-aware
8295
# The mirror has architecture-specific binaries: 'roxctl' (amd64) and 'roxctl-arm64'
@@ -108,37 +121,23 @@ RUN microdnf install -y podman fuse-overlayfs \
108121
# without requiring users to manage different auth plugins
109122

110123
# 1. Google Cloud (GKE) - gke-gcloud-auth-plugin
111-
RUN ARCH=${TARGETARCH:-amd64} && \
112-
echo "Installing gcloud SDK and gke-gcloud-auth-plugin for ${ARCH}" && \
113-
# Map Docker arch names to gcloud package names
114-
if [ "${ARCH}" = "amd64" ]; then \
115-
GCLOUD_ARCH="x86_64"; \
116-
elif [ "${ARCH}" = "arm64" ]; then \
117-
GCLOUD_ARCH="arm"; \
118-
else \
119-
echo "ERROR: Unsupported architecture: ${ARCH}"; exit 1; \
120-
fi && \
121-
# Download and install gcloud SDK
122-
curl -sL "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-${GCLOUD_ARCH}.tar.gz" \
123-
| tar xz -C /opt && \
124-
# Install gke-gcloud-auth-plugin
125-
/opt/google-cloud-sdk/bin/gcloud components install gke-gcloud-auth-plugin --quiet && \
126-
# Create symlinks in PATH
127-
ln -s /opt/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud && \
124+
# Copy gcloud SDK from builder stage (extracted there to avoid UBI filesystem restrictions)
125+
COPY --from=builder /tmp/google-cloud-sdk /opt/google-cloud-sdk
126+
RUN ln -s /opt/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud && \
128127
ln -s /opt/google-cloud-sdk/bin/gke-gcloud-auth-plugin /usr/local/bin/gke-gcloud-auth-plugin
129128

130129
# 2. AWS (EKS) - aws-iam-authenticator
131130
RUN ARCH=${TARGETARCH:-amd64} && \
132131
echo "Installing aws-iam-authenticator for ${ARCH}" && \
133-
curl -sLo /usr/local/bin/aws-iam-authenticator \
132+
curl -fsSLo /usr/local/bin/aws-iam-authenticator \
134133
"https://amazon-eks.s3.us-west-2.amazonaws.com/1.30.0/2024-05-12/bin/linux/${ARCH}/aws-iam-authenticator" && \
135134
chmod +x /usr/local/bin/aws-iam-authenticator
136135

137136
# 3. Azure (AKS) - kubelogin
138137
RUN ARCH=${TARGETARCH:-amd64} && \
139138
echo "Installing kubelogin (Azure) for ${ARCH}" && \
140139
KUBELOGIN_VERSION="v0.1.4" && \
141-
curl -sL "https://github.com/Azure/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin-linux-${ARCH}.zip" \
140+
curl -fsSL "https://github.com/Azure/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin-linux-${ARCH}.zip" \
142141
-o /tmp/kubelogin.zip && \
143142
unzip -q /tmp/kubelogin.zip -d /tmp && \
144143
mv /tmp/bin/linux_${ARCH}/kubelogin /usr/local/bin/kubelogin && \

cmd/deploy.go

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,33 @@ func newDeployCmd() *cobra.Command {
1818
cmd := &cobra.Command{
1919
Use: "deploy [component]",
2020
Short: "Deploy ACS components",
21-
Long: `Deploy ACS components (central, secured-cluster).
21+
Long: `Deploy ACS components (central, secured-cluster, operator).
2222
2323
Examples:
2424
roxie deploy central
2525
roxie deploy secured-cluster
26-
roxie deploy both`,
27-
ValidArgs: []string{"central", "secured-cluster", "both", "all"},
26+
roxie deploy both
27+
roxie deploy operator`,
28+
ValidArgs: []string{"central", "secured-cluster", "both", "all", "operator"},
2829
Args: cobra.MaximumNArgs(1),
2930
RunE: runDeploy,
3031
}
3132

3233
cmd.Flags().BoolVar(&helm, "helm", false, "Deploy using Helm charts instead of operator")
3334
_ = cmd.Flags().MarkHidden("helm")
3435
cmd.Flags().BoolVar(&olm, "olm", false, "Deploy operator via OLM (requires OLM installed)")
36+
cmd.Flags().BoolVar(&konflux, "konflux", false, "Use Konflux images")
3537
cmd.Flags().BoolVar(&deployOperator, "deploy-operator", true, "Deploy and check operator (set to false to skip operator deployment/checks)")
3638
cmd.Flags().BoolVar(&portForwarding, "port-forwarding", false, "Enable localhost port-forward for Central")
3739
cmd.Flags().BoolVar(&pauseReconciliation, "pause-reconciliation", false, "Pause reconciliation after deployment")
3840
cmd.Flags().StringVar(&overrideFile, "override", "", "Path to YAML file with overrides")
3941
cmd.Flags().StringArrayVar(&overrideSetExpressions, "set", []string{}, "Set override values (can specify multiple times, e.g., --set foo.bar=val)")
4042
cmd.Flags().StringVar(&exposure, "exposure", "loadbalancer", "Central exposure backend (loadbalancer, none)")
41-
cmd.Flags().StringVar(&resources, "resources", "auto", "Resource sizing preset (auto=cluster-based, medium, small)")
43+
cmd.Flags().StringVar(&resources, "resources", "acs-defaults", "Resource sizing preset (acs-defaults, auto, medium, small)")
4244
cmd.Flags().StringVar(&shell, "shell", "", "Shell to spawn after Central deployment")
4345
cmd.Flags().StringVar(&envrc, "envrc", "", "Write environment to file instead of spawning sub-shell")
4446
cmd.Flags().BoolVar(&singleNamespace, "single-namespace", false, "Deploy all components in a single namespace ('stackrox' by default)")
47+
cmd.Flags().StringVarP(&tag, "tag", "t", "", "Main image tag to use for deployment (takes precedence over MAIN_IMAGE_TAG environment variable)")
4548

4649
return cmd
4750
}
@@ -64,6 +67,10 @@ func runDeploy(cmd *cobra.Command, args []string) error {
6467
component = args[0]
6568
}
6669

70+
if component == "operator" && helm {
71+
return errors.New("cannot use --helm flag with 'operator' component")
72+
}
73+
6774
if (component == "central" || component == "both") && os.Getenv("ROXIE_SHELL") != "" {
6875
return errors.New("already in a roxie sub-shell (ROXIE_SHELL environment variable is set), please exit the shell and try again")
6976
}
@@ -109,6 +116,19 @@ func runDeploy(cmd *cobra.Command, args []string) error {
109116
return errors.New("cannot use both --helm and --olm flags together")
110117
}
111118

119+
if konflux {
120+
if helm {
121+
return errors.New("cannot use both --helm and --konflux flags together (Konflux requires operator-based deployment)")
122+
}
123+
if olm {
124+
return errors.New("cannot use both --olm and --konflux flags together (not currently implemented)")
125+
}
126+
clusterType := env.GetCurrentClusterType()
127+
if clusterType != env.InfraOpenShift4 {
128+
return fmt.Errorf("--konflux flag is only supported on OpenShift 4 clusters (current cluster type: %s)", clusterType.String())
129+
}
130+
}
131+
112132
if !deployOperator && olm {
113133
return errors.New("cannot use --deploy-operator=false with --olm (OLM requires operator deployment)")
114134
}
@@ -123,6 +143,8 @@ func runDeploy(cmd *cobra.Command, args []string) error {
123143
d.PrintCentralDeploymentSummary()
124144
case "secured-cluster", "sensor":
125145
d.PrintSecuredClusterDeploymentSummary()
146+
case "operator":
147+
// No deployment summary needed for operator-only deployment
126148
}
127149

128150
if envrc != "" {
@@ -142,6 +164,13 @@ func runDeploy(cmd *cobra.Command, args []string) error {
142164
}
143165
}
144166

167+
if konflux {
168+
if err := d.SetUseKonflux(true); err != nil {
169+
return err
170+
}
171+
172+
}
173+
145174
d.SetDeployOperator(deployOperator)
146175

147176
d.SetVerbose(verbose)
@@ -150,9 +179,16 @@ func runDeploy(cmd *cobra.Command, args []string) error {
150179
d.SetPauseReconciliation(pauseReconciliation)
151180
d.SetSingleNamespace(singleNamespace)
152181

153-
mainImageTag, err := helpers.LookupMainImageTag(log)
154-
if err != nil {
155-
return fmt.Errorf("looking up main image tag: %w", err)
182+
var mainImageTag string
183+
if tag != "" {
184+
log.Dimf("Using main image tag from --tag flag: %s", tag)
185+
mainImageTag = tag
186+
}
187+
if mainImageTag == "" {
188+
mainImageTag, err = helpers.LookupMainImageTag(log)
189+
if err != nil {
190+
return fmt.Errorf("looking up main image tag: %w", err)
191+
}
156192
}
157193
d.SetMainImageTag(mainImageTag)
158194

@@ -192,14 +228,15 @@ func resolveAutoResources(clusterType env.ClusterType, log *logger.Logger) strin
192228
switch clusterType {
193229
case env.LocalKind:
194230
resolvedResources = "small"
195-
log.Info("Auto-detected cluster type Kind: using small resources")
196231
case env.InfraOpenShift4:
197232
resolvedResources = "medium"
198-
log.Info("Auto-detected cluster type OpenShift 4: using medium resources")
233+
case env.InfraGKE:
234+
resolvedResources = "medium"
199235
default:
200-
resolvedResources = "default"
201-
log.Info("Auto-detected cluster type " + clusterType.String() + ": using default resources")
236+
resolvedResources = "acs-defaults"
202237
}
203238

239+
log.Infof("Auto-detected cluster type %s: using resource profile %q", clusterType.String(), resolvedResources)
240+
204241
return resolvedResources
205242
}

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var (
1313
earlyReadiness bool
1414
helm bool
1515
olm bool
16+
konflux bool
1617
deployOperator bool
1718
portForwarding bool
1819
pauseReconciliation bool
@@ -23,6 +24,7 @@ var (
2324
shell string
2425
envrc string
2526
singleNamespace bool
27+
tag string
2628
)
2729

2830
func main() {

0 commit comments

Comments
 (0)