Skip to content

Commit

Permalink
[285] Fix image strem processing
Browse files Browse the repository at this point in the history
Fixes #285
  • Loading branch information
yersan committed Nov 22, 2023
1 parent fab0001 commit 8ebd028
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions controllers/wildflyserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ import (
corev1 "k8s.io/api/core/v1"
apiErrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
"reflect"

"k8s.io/client-go/tools/record"
"os"
"reflect"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
"strconv"
"strings"

Expand Down Expand Up @@ -284,8 +285,7 @@ func (r *WildFlyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
builder := ctrl.NewControllerManagedBy(mgr).
For(&wildflyv1alpha1.WildFlyServer{})

builder.Owns(&appsv1.StatefulSet{}).
Owns(&corev1.Service{})
builder.Owns(&corev1.Service{})

if hasServiceMonitor() {
builder.Owns(&monitoringv1.ServiceMonitor{})
Expand All @@ -296,6 +296,7 @@ func (r *WildFlyServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
builder.Owns(&routev1.Route{})
}

builder.Watches(&source.Kind{Type: &appsv1.StatefulSet{}}, &handler.EnqueueRequestForOwner{OwnerType: &wildflyv1alpha1.WildFlyServer{}, IsController: false})
return builder.Complete(r)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Create(w *wildflyv1alpha1.WildFlyServer, client client.Client, scheme *runt
// mark the object with the current server generation
MarkServerGeneration(w, meta)

if err := controllerutil.SetControllerReference(w, meta, scheme); err != nil {
if err := controllerutil.SetOwnerReference(w, meta, scheme); err != nil {
logger.Error(err, "Failed to set controller reference for new resource")
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const (
ImageTypeGeneric = "generic"
// ImageTypeGeneric is one of the possible values for MarkerImageType annotation denoting a bootable JAR type image
ImageTypeBootable = "bootable-jar"
// SecretsDir is the the directory to mount volumes from Secrets
// SecretsDir is the directory to mount volumes from Secrets
SecretsDir = "/etc/secrets/"
// ConfigMapsDir is the the directory to mount volumes from ConfigMaps
// ConfigMapsDir is the directory to mount volumes from ConfigMaps
ConfigMapsDir = "/etc/configmaps/"
// StatefuleSetTemplateLabelsEnvVarName is the name of the envvar containg label/value map for pods created from the statefulset's template
StatefuleSetTemplateLabelsEnvVarName string = "STATEFULSET_TEMPLATE_LABELS"
Expand Down
3 changes: 2 additions & 1 deletion pkg/resources/statefulsets/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func NewStatefulSet(w *wildflyv1alpha1.WildFlyServer, labels map[string]string,
ObjectMeta: metav1.ObjectMeta{
Labels: labelsForActiveWildflyPod,
Annotations: map[string]string{
resources.MarkerImageType: wildflyImageTypeAnnotation,
"alpha.image.policy.openshift.io/resolve-names": "*",
resources.MarkerImageType: wildflyImageTypeAnnotation,
},
},
Spec: corev1.PodSpec{
Expand Down

0 comments on commit 8ebd028

Please sign in to comment.