diff --git a/deploy/crds/org_v1_che_crd.yaml b/deploy/crds/org_v1_che_crd.yaml index 428af85e3f..8526bd373d 100644 --- a/deploy/crds/org_v1_che_crd.yaml +++ b/deploy/crds/org_v1_che_crd.yaml @@ -81,6 +81,14 @@ spec: for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + identityProviderIngress: + description: Ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderPassword: description: Overrides the password of Keycloak admin user. This is useful to override it ONLY if you use an external Identity @@ -111,6 +119,14 @@ spec: field). If omitted or left blank, it will be set to the value of the `flavour` field. type: string + identityProviderRoute: + description: Route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderSecret: description: 'The secret that contains `user` and `password` for Identity Provider. If the secret is defined then `identityProviderAdminUserName` @@ -328,6 +344,22 @@ spec: description: 'Log level for the Che server: `INFO` or `DEBUG`. Defaults to `INFO`.' type: string + cheServerIngress: + description: Che server ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object + cheServerRoute: + description: Che server route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object cheWorkspaceClusterRole: description: Custom cluster role bound to the user for the Che workspaces. The default roles are used if this is omitted or left blank. @@ -348,6 +380,14 @@ spec: deployment. This includes the image tag. Omit it or leave it empty to use the defaut container image provided by the operator. type: string + devfileRegistryIngress: + description: Devfile registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryMemoryLimit: description: Overrides the memory limit used in the Devfile registry deployment. Defaults to 256Mi. @@ -361,6 +401,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + devfileRegistryRoute: + description: Devfile registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryUrl: description: Public URL of the Devfile registry, that serves sample, ready-to-use devfiles. You should set it ONLY if you use an external @@ -400,8 +448,16 @@ spec: pluginRegistryImage: description: Overrides the container image used in the Plugin registry deployment. This includes the image tag. Omit it or leave it empty - to use the defaut container image provided by the operator. - type: string + to use the default container image provided by the operator. + type: string + pluginRegistryIngress: + description: Plugin registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryMemoryLimit: description: Overrides the memory limit used in the Plugin registry deployment. Defaults to 256Mi. @@ -415,6 +471,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + pluginRegistryRoute: + description: Plugin registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryUrl: description: Public URL of the Plugin registry, that serves sample ready-to-use devfiles. You should set it ONLY if you use an external diff --git a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml index baa08b0381..740ce0cc31 100644 --- a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml @@ -52,13 +52,13 @@ metadata: categories: Developer Tools certified: "false" containerImage: quay.io/eclipse/che-operator:nightly - createdAt: "2020-09-24T08:45:16Z" + createdAt: "2020-09-25T09:17:34Z" description: A Kube-native development solution that delivers portable and collaborative developer workspaces. operatorframework.io/suggested-namespace: eclipse-che repository: https://github.com/eclipse/che-operator support: Eclipse Foundation - name: eclipse-che-preview-kubernetes.v7.19.0-6.nightly + name: eclipse-che-preview-kubernetes.v7.20.0-9.nightly namespace: placeholder spec: apiservicedefinitions: {} @@ -402,4 +402,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.19.0-6.nightly + version: 7.20.0-9.nightly diff --git a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml index 428af85e3f..8526bd373d 100644 --- a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/org_v1_che_crd.yaml @@ -81,6 +81,14 @@ spec: for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + identityProviderIngress: + description: Ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderPassword: description: Overrides the password of Keycloak admin user. This is useful to override it ONLY if you use an external Identity @@ -111,6 +119,14 @@ spec: field). If omitted or left blank, it will be set to the value of the `flavour` field. type: string + identityProviderRoute: + description: Route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderSecret: description: 'The secret that contains `user` and `password` for Identity Provider. If the secret is defined then `identityProviderAdminUserName` @@ -328,6 +344,22 @@ spec: description: 'Log level for the Che server: `INFO` or `DEBUG`. Defaults to `INFO`.' type: string + cheServerIngress: + description: Che server ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object + cheServerRoute: + description: Che server route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object cheWorkspaceClusterRole: description: Custom cluster role bound to the user for the Che workspaces. The default roles are used if this is omitted or left blank. @@ -348,6 +380,14 @@ spec: deployment. This includes the image tag. Omit it or leave it empty to use the defaut container image provided by the operator. type: string + devfileRegistryIngress: + description: Devfile registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryMemoryLimit: description: Overrides the memory limit used in the Devfile registry deployment. Defaults to 256Mi. @@ -361,6 +401,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + devfileRegistryRoute: + description: Devfile registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryUrl: description: Public URL of the Devfile registry, that serves sample, ready-to-use devfiles. You should set it ONLY if you use an external @@ -400,8 +448,16 @@ spec: pluginRegistryImage: description: Overrides the container image used in the Plugin registry deployment. This includes the image tag. Omit it or leave it empty - to use the defaut container image provided by the operator. - type: string + to use the default container image provided by the operator. + type: string + pluginRegistryIngress: + description: Plugin registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryMemoryLimit: description: Overrides the memory limit used in the Plugin registry deployment. Defaults to 256Mi. @@ -415,6 +471,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + pluginRegistryRoute: + description: Plugin registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryUrl: description: Public URL of the Plugin registry, that serves sample ready-to-use devfiles. You should set it ONLY if you use an external diff --git a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index afe0809a81..c9e4c6df60 100644 --- a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -49,13 +49,13 @@ metadata: categories: Developer Tools, OpenShift Optional certified: "false" containerImage: quay.io/eclipse/che-operator:nightly - createdAt: "2020-09-24T08:45:16Z" + createdAt: "2020-09-25T09:17:35Z" description: A Kube-native development solution that delivers portable and collaborative developer workspaces in OpenShift. operatorframework.io/suggested-namespace: eclipse-che repository: https://github.com/eclipse/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.19.0-6.nightly + name: eclipse-che-preview-openshift.v7.20.0-9.nightly namespace: placeholder spec: apiservicedefinitions: {} @@ -435,4 +435,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.19.0-6.nightly + version: 7.20.0-9.nightly diff --git a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index 428af85e3f..8526bd373d 100644 --- a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -81,6 +81,14 @@ spec: for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + identityProviderIngress: + description: Ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderPassword: description: Overrides the password of Keycloak admin user. This is useful to override it ONLY if you use an external Identity @@ -111,6 +119,14 @@ spec: field). If omitted or left blank, it will be set to the value of the `flavour` field. type: string + identityProviderRoute: + description: Route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object identityProviderSecret: description: 'The secret that contains `user` and `password` for Identity Provider. If the secret is defined then `identityProviderAdminUserName` @@ -328,6 +344,22 @@ spec: description: 'Log level for the Che server: `INFO` or `DEBUG`. Defaults to `INFO`.' type: string + cheServerIngress: + description: Che server ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object + cheServerRoute: + description: Che server route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object cheWorkspaceClusterRole: description: Custom cluster role bound to the user for the Che workspaces. The default roles are used if this is omitted or left blank. @@ -348,6 +380,14 @@ spec: deployment. This includes the image tag. Omit it or leave it empty to use the defaut container image provided by the operator. type: string + devfileRegistryIngress: + description: Devfile registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryMemoryLimit: description: Overrides the memory limit used in the Devfile registry deployment. Defaults to 256Mi. @@ -361,6 +401,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + devfileRegistryRoute: + description: Devfile registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object devfileRegistryUrl: description: Public URL of the Devfile registry, that serves sample, ready-to-use devfiles. You should set it ONLY if you use an external @@ -400,8 +448,16 @@ spec: pluginRegistryImage: description: Overrides the container image used in the Plugin registry deployment. This includes the image tag. Omit it or leave it empty - to use the defaut container image provided by the operator. - type: string + to use the default container image provided by the operator. + type: string + pluginRegistryIngress: + description: Plugin registry ingress custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryMemoryLimit: description: Overrides the memory limit used in the Plugin registry deployment. Defaults to 256Mi. @@ -415,6 +471,14 @@ spec: registry deployment. Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. type: string + pluginRegistryRoute: + description: Plugin registry route custom settings + properties: + labels: + description: Comma separated list of labels that can be used + to organize and categorize (scope and select) objects. + type: string + type: object pluginRegistryUrl: description: Public URL of the Plugin registry, that serves sample ready-to-use devfiles. You should set it ONLY if you use an external diff --git a/pkg/apis/org/v1/che_types.go b/pkg/apis/org/v1/che_types.go index b71f4d98d4..98e274a474 100644 --- a/pkg/apis/org/v1/che_types.go +++ b/pkg/apis/org/v1/che_types.go @@ -47,7 +47,6 @@ type CheClusterSpec struct { // Configuration settings related to the metrics collection used by the Che installation. // +optional Metrics CheClusterSpecMetrics `json:"metrics"` - // Configuration settings specific to Che installations made on upstream Kubernetes. // +optional K8s CheClusterSpecK8SOnly `json:"k8s"` @@ -158,6 +157,12 @@ type CheClusterSpecServer struct { // Overrides the memory request used in the Devfile registry deployment. Defaults to 16Mi. // +optional DevfileRegistryMemoryRequest string `json:"devfileRegistryMemoryRequest,omitempty"` + // Devfile registry ingress custom settings + // +optional + DevfileRegistryIngress IngressCustomSettings `json:"devfileRegistryIngress,omitempty"` + // Devfile registry route custom settings + // +optional + DevfileRegistryRoute RouteCustomSettings `json:"devfileRegistryRoute,omitempty"` // Instructs the operator on whether or not to deploy a dedicated Devfile registry server. // By default a dedicated devfile registry server is started. // But if `externalDevfileRegistry` is `true`, then no such dedicated server will be started by the operator @@ -170,7 +175,7 @@ type CheClusterSpecServer struct { // +optional PluginRegistryUrl string `json:"pluginRegistryUrl,omitempty"` // Overrides the container image used in the Plugin registry deployment. This includes the image tag. - // Omit it or leave it empty to use the defaut container image provided by the operator. + // Omit it or leave it empty to use the default container image provided by the operator. // +optional PluginRegistryImage string `json:"pluginRegistryImage,omitempty"` // Overrides the image pull policy used in the Plugin registry deployment. @@ -183,6 +188,12 @@ type CheClusterSpecServer struct { // Overrides the memory request used in the Plugin registry deployment. Defaults to 16Mi. // +optional PluginRegistryMemoryRequest string `json:"pluginRegistryMemoryRequest,omitempty"` + // Plugin registry ingress custom settings + // +optional + PluginRegistryIngress IngressCustomSettings `json:"pluginRegistryIngress,omitempty"` + // Plugin registry route custom settings + // +optional + PluginRegistryRoute RouteCustomSettings `json:"pluginRegistryRoute,omitempty"` // Instructs the operator on whether or not to deploy a dedicated Plugin registry server. // By default a dedicated plugin registry server is started. // But if `externalPluginRegistry` is `true`, then no such dedicated server will be started by the operator @@ -262,6 +273,12 @@ type CheClusterSpecServer struct { // The labels that need to be present (and are put) on the configmaps representing the gateway configuration. // +optional SingleHostGatewayConfigMapLabels labels.Set `json:"singleHostGatewayConfigMapLabels,omitempty"` + // Che server ingress custom settings + // +optional + CheServerIngress IngressCustomSettings `json:"cheServerIngress,omitempty"` + // Che server route custom settings + // +optional + CheServerRoute RouteCustomSettings `json:"cheServerRoute,omitempty"` } // +k8s:openapi-gen=true @@ -392,6 +409,26 @@ type CheClusterSpecAuth struct { // Default value is `Always` for `nightly` or `latest` images, and `IfNotPresent` in other cases. // +optional IdentityProviderImagePullPolicy corev1.PullPolicy `json:"identityProviderImagePullPolicy,omitempty"` + // Ingress custom settings + // +optional + IdentityProviderIngress IngressCustomSettings `json:"identityProviderIngress,omitempty"` + // Route custom settings + // +optional + IdentityProviderRoute RouteCustomSettings `json:"identityProviderRoute,omitempty"` +} + +// Ingress custom settings, can be extended in the future +type IngressCustomSettings struct { + // Comma separated list of labels that can be used to organize and categorize (scope and select) objects. + // +optional + Labels string `json:"labels,omitempty"` +} + +// Route custom settings, can be extended in the future +type RouteCustomSettings struct { + // Comma separated list of labels that can be used to organize and categorize (scope and select) objects. + // +optional + Labels string `json:"labels,omitempty"` } // +k8s:openapi-gen=true diff --git a/pkg/apis/org/v1/zz_generated.deepcopy.go b/pkg/apis/org/v1/zz_generated.deepcopy.go index 30dfaece18..3de941451c 100644 --- a/pkg/apis/org/v1/zz_generated.deepcopy.go +++ b/pkg/apis/org/v1/zz_generated.deepcopy.go @@ -95,6 +95,8 @@ func (in *CheClusterSpec) DeepCopy() *CheClusterSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CheClusterSpecAuth) DeepCopyInto(out *CheClusterSpecAuth) { *out = *in + out.IdentityProviderIngress = in.IdentityProviderIngress + out.IdentityProviderRoute = in.IdentityProviderRoute return } @@ -159,6 +161,10 @@ func (in *CheClusterSpecMetrics) DeepCopy() *CheClusterSpecMetrics { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CheClusterSpecServer) DeepCopyInto(out *CheClusterSpecServer) { *out = *in + out.DevfileRegistryIngress = in.DevfileRegistryIngress + out.DevfileRegistryRoute = in.DevfileRegistryRoute + out.PluginRegistryIngress = in.PluginRegistryIngress + out.PluginRegistryRoute = in.PluginRegistryRoute if in.CustomCheProperties != nil { in, out := &in.CustomCheProperties, &out.CustomCheProperties *out = make(map[string]string, len(*in)) @@ -173,6 +179,8 @@ func (in *CheClusterSpecServer) DeepCopyInto(out *CheClusterSpecServer) { (*out)[key] = val } } + out.CheServerIngress = in.CheServerIngress + out.CheServerRoute = in.CheServerRoute return } @@ -217,3 +225,35 @@ func (in *CheClusterStatus) DeepCopy() *CheClusterStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IngressCustomSettings) DeepCopyInto(out *IngressCustomSettings) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressCustomSettings. +func (in *IngressCustomSettings) DeepCopy() *IngressCustomSettings { + if in == nil { + return nil + } + out := new(IngressCustomSettings) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteCustomSettings) DeepCopyInto(out *RouteCustomSettings) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteCustomSettings. +func (in *RouteCustomSettings) DeepCopy() *RouteCustomSettings { + if in == nil { + return nil + } + out := new(RouteCustomSettings) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/org/v1/zz_generated.openapi.go b/pkg/apis/org/v1/zz_generated.openapi.go index 4f75d8ea71..a6a5d0c803 100644 --- a/pkg/apis/org/v1/zz_generated.openapi.go +++ b/pkg/apis/org/v1/zz_generated.openapi.go @@ -227,10 +227,23 @@ func schema_pkg_apis_org_v1_CheClusterSpecAuth(ref common.ReferenceCallback) com Format: "", }, }, + "identityProviderIngress": { + SchemaProps: spec.SchemaProps{ + Description: "Ingress custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings"), + }, + }, + "identityProviderRoute": { + SchemaProps: spec.SchemaProps{ + Description: "Route custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"), + }, + }, }, }, }, - Dependencies: []string{}, + Dependencies: []string{ + "github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings", "github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"}, } } @@ -532,6 +545,18 @@ func schema_pkg_apis_org_v1_CheClusterSpecServer(ref common.ReferenceCallback) c Format: "", }, }, + "devfileRegistryIngress": { + SchemaProps: spec.SchemaProps{ + Description: "Devfile registry ingress custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings"), + }, + }, + "devfileRegistryRoute": { + SchemaProps: spec.SchemaProps{ + Description: "Devfile registry route custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"), + }, + }, "externalDevfileRegistry": { SchemaProps: spec.SchemaProps{ Description: "Instructs the operator on whether or not to deploy a dedicated Devfile registry server. By default a dedicated devfile registry server is started. But if `externalDevfileRegistry` is `true`, then no such dedicated server will be started by the operator and you will have to manually set the `devfileRegistryUrl` field", @@ -548,7 +573,7 @@ func schema_pkg_apis_org_v1_CheClusterSpecServer(ref common.ReferenceCallback) c }, "pluginRegistryImage": { SchemaProps: spec.SchemaProps{ - Description: "Overrides the container image used in the Plugin registry deployment. This includes the image tag. Omit it or leave it empty to use the defaut container image provided by the operator.", + Description: "Overrides the container image used in the Plugin registry deployment. This includes the image tag. Omit it or leave it empty to use the default container image provided by the operator.", Type: []string{"string"}, Format: "", }, @@ -574,6 +599,18 @@ func schema_pkg_apis_org_v1_CheClusterSpecServer(ref common.ReferenceCallback) c Format: "", }, }, + "pluginRegistryIngress": { + SchemaProps: spec.SchemaProps{ + Description: "Plugin registry ingress custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings"), + }, + }, + "pluginRegistryRoute": { + SchemaProps: spec.SchemaProps{ + Description: "Plugin registry route custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"), + }, + }, "externalPluginRegistry": { SchemaProps: spec.SchemaProps{ Description: "Instructs the operator on whether or not to deploy a dedicated Plugin registry server. By default a dedicated plugin registry server is started. But if `externalPluginRegistry` is `true`, then no such dedicated server will be started by the operator and you will have to manually set the `pluginRegistryUrl` field.", @@ -686,10 +723,23 @@ func schema_pkg_apis_org_v1_CheClusterSpecServer(ref common.ReferenceCallback) c }, }, }, + "cheServerIngress": { + SchemaProps: spec.SchemaProps{ + Description: "Che server ingress custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings"), + }, + }, + "cheServerRoute": { + SchemaProps: spec.SchemaProps{ + Description: "Che server route custom settings", + Ref: ref("github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"), + }, + }, }, }, }, - Dependencies: []string{}, + Dependencies: []string{ + "github.com/eclipse/che-operator/pkg/apis/org/v1.IngressCustomSettings", "github.com/eclipse/che-operator/pkg/apis/org/v1.RouteCustomSettings"}, } } diff --git a/pkg/controller/che/che_controller.go b/pkg/controller/che/che_controller.go index 07c185a051..28e31461a3 100644 --- a/pkg/controller/che/che_controller.go +++ b/pkg/controller/che/che_controller.go @@ -720,7 +720,8 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e exposedServiceName := getServerExposingServiceName(instance) cheHost := "" if !isOpenShift { - ingress, err := deploy.SyncIngressToCluster(deployContext, cheFlavor, instance.Spec.Server.CheHost, exposedServiceName, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.CheServerIngress.Labels + ingress, err := deploy.SyncIngressToCluster(deployContext, cheFlavor, instance.Spec.Server.CheHost, exposedServiceName, 8080, additionalLabels) if !tests { if ingress == nil { logrus.Infof("Waiting on ingress '%s' to be ready", cheFlavor) @@ -739,7 +740,8 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e customHost = "" } - route, err := deploy.SyncRouteToCluster(deployContext, cheFlavor, customHost, exposedServiceName, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.CheServerRoute.Labels + route, err := deploy.SyncRouteToCluster(deployContext, cheFlavor, customHost, exposedServiceName, 8080, additionalLabels) if !tests { if route == nil { logrus.Infof("Waiting on route '%s' to be ready", cheFlavor) @@ -780,7 +782,7 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e if err != nil { logrus.Errorf("Error provisioning '%s' to cluster: %v", deploy.DevfileRegistry, err) } - return reconcile.Result{Requeue: true}, err + return reconcile.Result{RequeueAfter: time.Second * 1}, err } } @@ -790,7 +792,7 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e if err != nil { logrus.Errorf("Error provisioning '%s' to cluster: %v", deploy.PluginRegistry, err) } - return reconcile.Result{Requeue: true}, err + return reconcile.Result{RequeueAfter: time.Second * 1}, err } } @@ -991,7 +993,8 @@ func EvaluateCheServerVersion(cr *orgv1.CheCluster) string { func getDefaultCheHost(deployContext *deploy.DeployContext) (string, error) { routeName := deploy.DefaultCheFlavor(deployContext.CheCluster) - route, err := deploy.SyncRouteToCluster(deployContext, routeName, "", getServerExposingServiceName(deployContext.CheCluster), 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.CheServerRoute.Labels + route, err := deploy.SyncRouteToCluster(deployContext, routeName, "", getServerExposingServiceName(deployContext.CheCluster), 8080, additionalLabels) if route == nil { logrus.Infof("Waiting on route '%s' to be ready", routeName) if err != nil { diff --git a/pkg/deploy/devfile_registry.go b/pkg/deploy/devfile_registry.go index 787a0a24ee..a5ddbef57b 100644 --- a/pkg/deploy/devfile_registry.go +++ b/pkg/deploy/devfile_registry.go @@ -67,7 +67,8 @@ func SyncDevfileRegistryToCluster(deployContext *DeployContext, cheHost string) logrus.Error(err) } } else { - ingress, err := SyncIngressToCluster(deployContext, DevfileRegistry, domain, DevfileRegistry, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.DevfileRegistryIngress.Labels + ingress, err := SyncIngressToCluster(deployContext, DevfileRegistry, domain, DevfileRegistry, 8080, additionalLabels) if !util.IsTestMode() { if ingress == nil { logrus.Infof("Waiting on ingress '%s' to be ready", DevfileRegistry) @@ -98,7 +99,8 @@ func SyncDevfileRegistryToCluster(deployContext *DeployContext, cheHost string) } } else { // the empty string for a host is intentional here - we let OpenShift decide on the hostname - route, err := SyncRouteToCluster(deployContext, DevfileRegistry, "", DevfileRegistry, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.DevfileRegistryRoute.Labels + route, err := SyncRouteToCluster(deployContext, DevfileRegistry, "", DevfileRegistry, 8080, additionalLabels) if !util.IsTestMode() { if route == nil { logrus.Infof("Waiting on route '%s' to be ready", DevfileRegistry) diff --git a/pkg/deploy/identity_provider.go b/pkg/deploy/identity_provider.go index 24cc11c0d4..9f2f61013f 100644 --- a/pkg/deploy/identity_provider.go +++ b/pkg/deploy/identity_provider.go @@ -78,8 +78,8 @@ func SyncIdentityProviderToCluster(deployContext *DeployContext, cheHost string, keycloakURL = protocol + "://" + cheHost } else { - logrus.Infof("Deploying Keycloak on %s", host) - ingress, err := SyncIngressToCluster(deployContext, "keycloak", host, "keycloak", 8080) + additionalLabels := deployContext.CheCluster.Spec.Auth.IdentityProviderIngress.Labels + ingress, err := SyncIngressToCluster(deployContext, "keycloak", host, "keycloak", 8080, additionalLabels) if !tests { if ingress == nil { logrus.Info("Waiting on ingress 'keycloak' to be ready") @@ -91,8 +91,6 @@ func SyncIdentityProviderToCluster(deployContext *DeployContext, cheHost string, } } - logrus.Infof("Deployed Keycloak on %s", ingress.Spec.Rules[0].Host) - if err := DeleteGatewayRouteConfig(keycloakGatewayConfig, deployContext); !tests && err != nil { logrus.Error(err) } @@ -115,7 +113,8 @@ func SyncIdentityProviderToCluster(deployContext *DeployContext, cheHost string, } } else { // create Keycloak route - route, err := SyncRouteToCluster(deployContext, "keycloak", "", "keycloak", 8080) + additionalLabels := deployContext.CheCluster.Spec.Auth.IdentityProviderRoute.Labels + route, err := SyncRouteToCluster(deployContext, "keycloak", "", "keycloak", 8080, additionalLabels) if !tests { if route == nil { logrus.Info("Waiting on route 'keycloak' to be ready") diff --git a/pkg/deploy/ingress.go b/pkg/deploy/ingress.go index 17d5e86320..9b67eba0b4 100644 --- a/pkg/deploy/ingress.go +++ b/pkg/deploy/ingress.go @@ -14,6 +14,7 @@ package deploy import ( "context" "fmt" + "reflect" "github.com/eclipse/che-operator/pkg/util" "github.com/google/go-cmp/cmp" @@ -29,7 +30,10 @@ import ( ) var ingressDiffOpts = cmp.Options{ - cmpopts.IgnoreFields(v1beta1.Ingress{}, "TypeMeta", "ObjectMeta", "Status"), + cmpopts.IgnoreFields(v1beta1.Ingress{}, "TypeMeta", "Status"), + cmp.Comparer(func(x, y metav1.ObjectMeta) bool { + return reflect.DeepEqual(x.Labels, y.Labels) + }), } func SyncIngressToCluster( @@ -37,9 +41,10 @@ func SyncIngressToCluster( name string, host string, serviceName string, - servicePort int) (*v1beta1.Ingress, error) { + servicePort int, + additionalLabels string) (*v1beta1.Ingress, error) { - specIngress, err := getSpecIngress(deployContext, name, host, serviceName, servicePort) + specIngress, err := getSpecIngress(deployContext, name, host, serviceName, servicePort, additionalLabels) if err != nil { return nil, err } @@ -109,13 +114,15 @@ func getSpecIngress( name string, host string, serviceName string, - servicePort int) (*v1beta1.Ingress, error) { + servicePort int, + additionalLabels string) (*v1beta1.Ingress, error) { tlsSupport := deployContext.CheCluster.Spec.Server.TlsSupport ingressStrategy := util.GetServerExposureStrategy(deployContext.CheCluster, DefaultServerExposureStrategy) ingressDomain := deployContext.CheCluster.Spec.K8s.IngressDomain ingressClass := util.GetValue(deployContext.CheCluster.Spec.K8s.IngressClass, DefaultIngressClass) labels := GetLabels(deployContext.CheCluster, name) + MergeLabels(labels, additionalLabels) if host == "" { if ingressStrategy == "multi-host" { diff --git a/pkg/deploy/labels.go b/pkg/deploy/labels.go index fc601dcc5b..51041ad3ee 100644 --- a/pkg/deploy/labels.go +++ b/pkg/deploy/labels.go @@ -12,6 +12,8 @@ package deploy import ( + "strings" + orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1" ) @@ -19,3 +21,12 @@ func GetLabels(cr *orgv1.CheCluster, component string) (labels map[string]string labels = map[string]string{"app": DefaultCheFlavor(cr), "component": component} return labels } + +func MergeLabels(labels map[string]string, additionalLabels string) { + for _, l := range strings.Split(additionalLabels, ",") { + pair := strings.SplitN(l, "=", 2) + if len(pair) == 2 { + labels[pair[0]] = pair[1] + } + } +} diff --git a/pkg/deploy/plugin_registry.go b/pkg/deploy/plugin_registry.go index dd310eb832..add18a8d6a 100644 --- a/pkg/deploy/plugin_registry.go +++ b/pkg/deploy/plugin_registry.go @@ -67,7 +67,8 @@ func SyncPluginRegistryToCluster(deployContext *DeployContext, cheHost string) ( logrus.Error(err) } } else { - ingress, err := SyncIngressToCluster(deployContext, PluginRegistry, domain, PluginRegistry, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.PluginRegistryIngress.Labels + ingress, err := SyncIngressToCluster(deployContext, PluginRegistry, domain, PluginRegistry, 8080, additionalLabels) if !util.IsTestMode() { if ingress == nil { logrus.Infof("Waiting on ingress '%s' to be ready", PluginRegistry) @@ -98,7 +99,8 @@ func SyncPluginRegistryToCluster(deployContext *DeployContext, cheHost string) ( } } else { // the empty string for a host is intentional here - we let OpenShift decide on the hostname - route, err := SyncRouteToCluster(deployContext, PluginRegistry, "", PluginRegistry, 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.PluginRegistryRoute.Labels + route, err := SyncRouteToCluster(deployContext, PluginRegistry, "", PluginRegistry, 8080, additionalLabels) if !util.IsTestMode() { if route == nil { logrus.Infof("Waiting on route '%s' to be ready", PluginRegistry) diff --git a/pkg/deploy/route.go b/pkg/deploy/route.go index e1cd4aea5f..8da9a177cd 100644 --- a/pkg/deploy/route.go +++ b/pkg/deploy/route.go @@ -14,6 +14,7 @@ package deploy import ( "context" "fmt" + "reflect" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" @@ -29,12 +30,18 @@ import ( ) var routeDiffOpts = cmp.Options{ - cmpopts.IgnoreFields(routev1.Route{}, "TypeMeta", "ObjectMeta", "Status"), + cmpopts.IgnoreFields(routev1.Route{}, "TypeMeta", "Status"), cmpopts.IgnoreFields(routev1.RouteSpec{}, "Host", "WildcardPolicy"), + cmp.Comparer(func(x, y metav1.ObjectMeta) bool { + return reflect.DeepEqual(x.Labels, y.Labels) + }), } var routeWithHostDiffOpts = cmp.Options{ - cmpopts.IgnoreFields(routev1.Route{}, "TypeMeta", "ObjectMeta", "Status"), + cmpopts.IgnoreFields(routev1.Route{}, "TypeMeta", "Status"), cmpopts.IgnoreFields(routev1.RouteSpec{}, "WildcardPolicy"), + cmp.Comparer(func(x, y metav1.ObjectMeta) bool { + return reflect.DeepEqual(x.Labels, y.Labels) + }), } func SyncRouteToCluster( @@ -42,9 +49,10 @@ func SyncRouteToCluster( name string, host string, serviceName string, - servicePort int32) (*routev1.Route, error) { + servicePort int32, + additionalLabels string) (*routev1.Route, error) { - specRoute, err := GetSpecRoute(deployContext, name, host, serviceName, servicePort) + specRoute, err := GetSpecRoute(deployContext, name, host, serviceName, servicePort, additionalLabels) if err != nil { return nil, err } @@ -69,19 +77,18 @@ func SyncRouteToCluster( } diff := cmp.Diff(clusterRoute, specRoute, diffOpts) if len(diff) > 0 { - logrus.Infof("Updating existed object: %s, name: %s", clusterRoute.Kind, clusterRoute.Name) + logrus.Infof("Deleting existed object: %s, name: %s", clusterRoute.Kind, clusterRoute.Name) fmt.Printf("Difference:\n%s", diff) err := deployContext.ClusterAPI.Client.Delete(context.TODO(), clusterRoute) - if err != nil { + if !errors.IsNotFound(err) { return nil, err } - err = deployContext.ClusterAPI.Client.Create(context.TODO(), specRoute) - return nil, err + return nil, nil } - return clusterRoute, err + return clusterRoute, nil } func DeleteRouteIfExists(name string, deployContext *DeployContext) error { @@ -92,7 +99,7 @@ func DeleteRouteIfExists(name string, deployContext *DeployContext) error { if ingress != nil { err = deployContext.ClusterAPI.Client.Delete(context.TODO(), ingress) - if err != nil { + if !errors.IsNotFound(err) { return err } } @@ -123,15 +130,18 @@ func GetSpecRoute( name string, host string, serviceName string, - servicePort int32) (*routev1.Route, error) { + servicePort int32, + additionalLabels string) (*routev1.Route, error) { tlsSupport := deployContext.CheCluster.Spec.Server.TlsSupport labels := GetLabels(deployContext.CheCluster, DefaultCheFlavor(deployContext.CheCluster)) - weight := int32(100) - if name == "keycloak" { labels = GetLabels(deployContext.CheCluster, name) } + MergeLabels(labels, additionalLabels) + + weight := int32(100) + targetPort := intstr.IntOrString{ Type: intstr.Int, IntVal: int32(servicePort), diff --git a/pkg/deploy/tls.go b/pkg/deploy/tls.go index a0b509dde7..fd32bbd5bb 100644 --- a/pkg/deploy/tls.go +++ b/pkg/deploy/tls.go @@ -112,7 +112,8 @@ func GetEndpointTLSCrtChain(deployContext *DeployContext, endpointURL string) ([ if isTestRoute { // Create test route to get certificates chain. // Note, it is not possible to use SyncRouteToCluster here as it may cause infinite reconcile loop. - routeSpec, err := GetSpecRoute(deployContext, "test", "", "test", 8080) + additionalLabels := deployContext.CheCluster.Spec.Server.CheServerRoute.Labels + routeSpec, err := GetSpecRoute(deployContext, "test", "", "test", 8080, additionalLabels) if err != nil { return nil, err }