Apply part-of label to devworkspace resources managed by Che Operator (#1189)
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>pull/1191/head
parent
afe2557f20
commit
ce4e107719
|
|
@ -201,7 +201,8 @@ func (r *CheClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
|
|||
// But we need to detect the hostname on which the gateway is exposed so that the rest of our subsystems work.
|
||||
host, err = r.detectCheHost(ctx, currentV1)
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
// Wait some time in case the route is not ready yet
|
||||
return ctrl.Result{RequeueAfter: 2 * time.Second}, err
|
||||
}
|
||||
|
||||
// setting changed to false, because we jump from inactive directly to established, because we are no longer in
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import (
|
|||
"runtime"
|
||||
|
||||
"github.com/eclipse-che/che-operator/api/v2alpha1"
|
||||
"github.com/eclipse-che/che-operator/pkg/deploy"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
)
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ func AddStandardLabelsForComponent(cluster *v2alpha1.CheCluster, component strin
|
|||
|
||||
func AddStandardLabelsFromNames(appName string, component string, labels map[string]string) map[string]string {
|
||||
labels["app.kubernetes.io/name"] = appName
|
||||
labels["app.kubernetes.io/part-of"] = appName
|
||||
labels["app.kubernetes.io/part-of"] = deploy.CheEclipseOrg
|
||||
labels["app.kubernetes.io/component"] = component
|
||||
return labels
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ func (c *CheRoutingSolver) provisionServices(objs *solvers.RoutingObjects, cheCl
|
|||
Name: common.ServiceName(routing.Spec.DevWorkspaceId),
|
||||
Namespace: routing.Namespace,
|
||||
Labels: map[string]string{
|
||||
constants.DevWorkspaceIDLabel: routing.Spec.DevWorkspaceId,
|
||||
constants.DevWorkspaceIDLabel: routing.Spec.DevWorkspaceId,
|
||||
deploy.KubernetesPartOfLabelKey: deploy.CheEclipseOrg,
|
||||
},
|
||||
},
|
||||
Spec: corev1.ServiceSpec{
|
||||
|
|
@ -397,7 +398,8 @@ func exposeAllEndpoints(cheCluster *v2alpha1.CheCluster, routing *dwo.DevWorkspa
|
|||
Name: defaults.GetGatewayWorkspaceConfigMapName(routing.Spec.DevWorkspaceId),
|
||||
Namespace: routing.Namespace,
|
||||
Labels: map[string]string{
|
||||
constants.DevWorkspaceIDLabel: routing.Spec.DevWorkspaceId,
|
||||
constants.DevWorkspaceIDLabel: routing.Spec.DevWorkspaceId,
|
||||
deploy.KubernetesPartOfLabelKey: deploy.CheEclipseOrg,
|
||||
},
|
||||
},
|
||||
Data: map[string]string{},
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import (
|
|||
"github.com/devfile/devworkspace-operator/pkg/constants"
|
||||
"github.com/eclipse-che/che-operator/api/v2alpha1"
|
||||
"github.com/eclipse-che/che-operator/controllers/devworkspace/defaults"
|
||||
"github.com/eclipse-che/che-operator/pkg/deploy"
|
||||
routev1 "github.com/openshift/api/route/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
|
@ -103,10 +103,13 @@ func (e *IngressExposer) initFrom(ctx context.Context, cl client.Client, cluster
|
|||
yes := true
|
||||
|
||||
newSecret := &corev1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: tlsSecretName,
|
||||
Namespace: routing.Namespace,
|
||||
OwnerReferences: []v1.OwnerReference{
|
||||
Labels: map[string]string{
|
||||
deploy.KubernetesPartOfLabelKey: deploy.CheEclipseOrg,
|
||||
},
|
||||
OwnerReferences: []metav1.OwnerReference{
|
||||
{
|
||||
Name: routing.Name,
|
||||
Kind: routing.Kind,
|
||||
|
|
@ -135,7 +138,8 @@ func (e *RouteExposer) getRouteForService(endpoint *EndpointInfo) routev1.Route
|
|||
Name: getEndpointExposingObjectName(endpoint.componentName, e.devWorkspaceID, endpoint.port, endpoint.endpointName),
|
||||
Namespace: endpoint.service.Namespace,
|
||||
Labels: map[string]string{
|
||||
constants.DevWorkspaceIDLabel: e.devWorkspaceID,
|
||||
constants.DevWorkspaceIDLabel: e.devWorkspaceID,
|
||||
deploy.KubernetesPartOfLabelKey: deploy.CheEclipseOrg,
|
||||
},
|
||||
Annotations: routeAnnotations(endpoint.componentName, endpoint.endpointName),
|
||||
OwnerReferences: endpoint.service.OwnerReferences,
|
||||
|
|
@ -176,7 +180,8 @@ func (e *IngressExposer) getIngressForService(endpoint *EndpointInfo) networking
|
|||
Name: getEndpointExposingObjectName(endpoint.componentName, e.devWorkspaceID, endpoint.port, endpoint.endpointName),
|
||||
Namespace: endpoint.service.Namespace,
|
||||
Labels: map[string]string{
|
||||
constants.DevWorkspaceIDLabel: e.devWorkspaceID,
|
||||
constants.DevWorkspaceIDLabel: e.devWorkspaceID,
|
||||
deploy.KubernetesPartOfLabelKey: deploy.CheEclipseOrg,
|
||||
},
|
||||
Annotations: finalizeIngressAnnotations(e.ingressAnnotations, endpoint.componentName, endpoint.endpointName),
|
||||
OwnerReferences: endpoint.service.OwnerReferences,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ package sync
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/eclipse-che/che-operator/pkg/deploy"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -83,7 +84,7 @@ func (s *Syncer) Delete(ctx context.Context, object client.Object) error {
|
|||
|
||||
func (s *Syncer) create(ctx context.Context, owner client.Object, key client.ObjectKey, blueprint client.Object) (client.Object, error) {
|
||||
actual := blueprint.DeepCopyObject().(client.Object)
|
||||
kind := blueprint.GetObjectKind().GroupVersionKind().Kind
|
||||
kind := deploy.GetObjectType(blueprint)
|
||||
log.Info("Creating a new object", "kind", kind, "name", blueprint.GetName(), "namespace", blueprint.GetNamespace())
|
||||
obj, err := s.setOwnerReference(owner, blueprint)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue