Skip to content

Commit a8b6591

Browse files
make oauth image and cert generator configurable via env vars
Signed-off-by: Kevin <[email protected]>
1 parent 3b5a5d2 commit a8b6591

File tree

8 files changed

+38
-12
lines changed

8 files changed

+38
-12
lines changed

Diff for: .github/workflows/project-codeflare-release.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,18 @@ jobs:
9898
steps:
9999
- name: Release CodeFlare operator
100100
run: |
101-
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field appwrapper-version=${{ github.event.inputs.appwrapper-version }} --field kuberay-version=${{ github.event.inputs.kuberay-version }} --field kueue-version=${{ github.event.inputs.kueue-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
101+
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator \
102+
--ref ${{ github.ref }} \
103+
--field is-stable=${{ github.event.inputs.is-stable }} \
104+
--field version=${{ github.event.inputs.operator-version }} \
105+
--field replaces=${{ github.event.inputs.replaces }} \
106+
--field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} \
107+
--field appwrapper-version=${{ github.event.inputs.appwrapper-version }} \
108+
--field kuberay-version=${{ github.event.inputs.kuberay-version }} \
109+
--field kueue-version=${{ github.event.inputs.kueue-version }} \
110+
--field quay-organization=${{ github.event.inputs.quay-organization }} \
111+
--field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} \
112+
--field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
102113
env:
103114
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
104115
shell: bash

Diff for: config/e2e/config.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ data:
77
kuberay:
88
rayDashboardOAuthEnabled: false
99
ingressDomain: "kind"
10-
certGeneratorImage: quay.io/rhoai/ray:2.23.0-py39-cu121
1110
appwrapper:
1211
enabled: true

Diff for: config/e2e/patch_resources.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
- op: replace
44
path: /spec/template/spec/containers/0/imagePullPolicy
55
value: IfNotPresent
6+
- op: add
7+
path: /spec/template/spec/containers/0/env/-
8+
value:
9+
name: CERT_GENERATOR_IMAGE
10+
value: quay.io/rhoai/ray:2.23.0-py39-cu121

Diff for: main.go

-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ func main() {
147147
RayDashboardOAuthEnabled: ptr.To(true),
148148
IngressDomain: "",
149149
MTLSEnabled: ptr.To(true),
150-
CertGeneratorImage: "registry.redhat.io/ubi9@sha256:770cf07083e1c85ae69c25181a205b7cdef63c11b794c89b3b487d4670b4c328",
151150
},
152151
AppWrapper: &config.AppWrapperConfiguration{
153152
Enabled: ptr.To(false),

Diff for: pkg/config/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ type KubeRayConfiguration struct {
5050
IngressDomain string `json:"ingressDomain"`
5151

5252
MTLSEnabled *bool `json:"mTLSEnabled,omitempty"`
53-
54-
CertGeneratorImage string `json:"certGeneratorImage"`
5553
}
5654

5755
type ControllerManager struct {

Diff for: pkg/controllers/raycluster_webhook.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func validateHeadGroupServiceAccountName(rayCluster *rayv1.RayCluster) field.Err
231231
func oauthProxyContainer(rayCluster *rayv1.RayCluster) corev1.Container {
232232
return corev1.Container{
233233
Name: oauthProxyContainerName,
234-
Image: "registry.redhat.io/openshift4/ose-oauth-proxy@sha256:1ea6a01bf3e63cdcf125c6064cbd4a4a270deaf0f157b3eabb78f60556840366",
234+
Image: OAuthProxyImage,
235235
Ports: []corev1.ContainerPort{
236236
{ContainerPort: 8443, Name: "oauth-proxy"},
237237
},
@@ -349,7 +349,7 @@ func rayHeadInitContainer(rayCluster *rayv1.RayCluster, config *config.KubeRayCo
349349

350350
initContainerHead := corev1.Container{
351351
Name: "create-cert",
352-
Image: config.CertGeneratorImage,
352+
Image: CertGeneratorImage,
353353
Command: []string{
354354
"sh",
355355
"-c",
@@ -363,7 +363,7 @@ func rayHeadInitContainer(rayCluster *rayv1.RayCluster, config *config.KubeRayCo
363363
func rayWorkerInitContainer(config *config.KubeRayConfiguration) corev1.Container {
364364
initContainerWorker := corev1.Container{
365365
Name: "create-cert",
366-
Image: config.CertGeneratorImage,
366+
Image: CertGeneratorImage,
367367
Command: []string{
368368
"sh",
369369
"-c",

Diff for: pkg/controllers/raycluster_webhook_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func TestValidateCreate(t *testing.T) {
243243
Containers: []corev1.Container{
244244
{
245245
Name: oauthProxyContainerName,
246-
Image: "registry.redhat.io/openshift4/ose-oauth-proxy@sha256:1ea6a01bf3e63cdcf125c6064cbd4a4a270deaf0f157b3eabb78f60556840366",
246+
Image: OAuthProxyImage,
247247
Ports: []corev1.ContainerPort{
248248
{ContainerPort: 8443, Name: "oauth-proxy"},
249249
},
@@ -363,7 +363,7 @@ func TestValidateUpdate(t *testing.T) {
363363
Containers: []corev1.Container{
364364
{
365365
Name: oauthProxyContainerName,
366-
Image: "registry.redhat.io/openshift4/ose-oauth-proxy@sha256:1ea6a01bf3e63cdcf125c6064cbd4a4a270deaf0f157b3eabb78f60556840366",
366+
Image: OAuthProxyImage,
367367
Ports: []corev1.ContainerPort{
368368
{ContainerPort: 8443, Name: "oauth-proxy"},
369369
},
@@ -414,7 +414,7 @@ func TestValidateUpdate(t *testing.T) {
414414
InitContainers: []corev1.Container{
415415
{
416416
Name: "create-cert",
417-
Image: "",
417+
Image: "registry.redhat.io/ubi9@sha256:770cf07083e1c85ae69c25181a205b7cdef63c11b794c89b3b487d4670b4c328",
418418
Command: []string{
419419
"sh",
420420
"-c",
@@ -490,7 +490,7 @@ func TestValidateUpdate(t *testing.T) {
490490
InitContainers: []corev1.Container{
491491
{
492492
Name: "create-cert",
493-
Image: "",
493+
Image: "registry.redhat.io/ubi9@sha256:770cf07083e1c85ae69c25181a205b7cdef63c11b794c89b3b487d4670b4c328",
494494
Command: []string{
495495
"sh",
496496
"-c",

Diff for: pkg/controllers/support.go

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package controllers
22

33
import (
4+
"os"
5+
46
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
57

68
corev1 "k8s.io/api/core/v1"
@@ -14,6 +16,18 @@ import (
1416
routeapply "github.com/openshift/client-go/route/applyconfigurations/route/v1"
1517
)
1618

19+
var (
20+
CertGeneratorImage = getEnv("CERT_GENERATOR_IMAGE", "registry.redhat.io/ubi9@sha256:770cf07083e1c85ae69c25181a205b7cdef63c11b794c89b3b487d4670b4c328")
21+
OAuthProxyImage = getEnv("OAUTH_PROXY_IMAGE", "registry.redhat.io/openshift4/ose-oauth-proxy@sha256:1ea6a01bf3e63cdcf125c6064cbd4a4a270deaf0f157b3eabb78f60556840366")
22+
)
23+
24+
func getEnv(key, fallback string) string {
25+
if value, ok := os.LookupEnv(key); ok {
26+
return value
27+
}
28+
return fallback
29+
}
30+
1731
func serviceNameFromCluster(cluster *rayv1.RayCluster) string {
1832
return cluster.Name + "-head-svc"
1933
}

0 commit comments

Comments
 (0)