-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move OAuth proxy image reference to params.env
- Loading branch information
Showing
7 changed files
with
71 additions
and
51 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
trustyaiServiceImage=quay.io/trustyai/trustyai-service:latest | ||
trustyaiOperatorImage=quay.io/trustyai/trustyai-service-operator:latest | ||
trustyaiOperatorImage=quay.io/trustyai/trustyai-service-operator:latest | ||
oauthProxyImage=registry.redhat.io/openshift4/ose-oauth-proxy:latest |
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,46 @@ | ||
package controllers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
// getImageFromConfigMap gets a custom image value from a ConfigMap in the operator's namespace | ||
func (r *TrustyAIServiceReconciler) getImageFromConfigMap(ctx context.Context, key string, defaultImage string) (string, error) { | ||
if r.Namespace != "" { | ||
// Define the key for the ConfigMap | ||
configMapKey := types.NamespacedName{ | ||
Namespace: r.Namespace, | ||
Name: imageConfigMap, | ||
} | ||
|
||
// Create an empty ConfigMap object | ||
var cm corev1.ConfigMap | ||
|
||
// Try to get the ConfigMap | ||
if err := r.Get(ctx, configMapKey, &cm); err != nil { | ||
if errors.IsNotFound(err) { | ||
// ConfigMap not found, fallback to default values | ||
return defaultImage, nil | ||
} | ||
// Other error occurred when trying to fetch the ConfigMap | ||
return defaultImage, fmt.Errorf("error reading configmap %s", configMapKey) | ||
} | ||
|
||
// ConfigMap is found, extract the image and tag | ||
image, ok := cm.Data[key] | ||
|
||
if !ok { | ||
// One or both of the keys are not present in the ConfigMap, return error | ||
return defaultImage, fmt.Errorf("configmap %s does not contain necessary keys", configMapKey) | ||
} | ||
|
||
// Return the image and tag | ||
return image, nil | ||
} else { | ||
return defaultImage, nil | ||
} | ||
} |
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
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