Move defaults to env var
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>pull/247/head
parent
0c671d8a11
commit
b9942aacff
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
|
||||
{
|
||||
"name": "Launch Current File",
|
||||
"type": "go",
|
||||
|
|
@ -27,7 +27,15 @@
|
|||
"mode": "auto",
|
||||
"program": "${workspaceFolder}/cmd/manager/main.go",
|
||||
"env": {
|
||||
"WATCH_NAMESPACE": "che"
|
||||
"WATCH_NAMESPACE": "che",
|
||||
"CHE_FLAVOR": "che",
|
||||
"CONSOLE_LINK_NAME": "che",
|
||||
"CONSOLE_LINK_DISPLAY_NAME": "Eclipse Che",
|
||||
"CONSOLE_LINK_SECTION": "Red Hat Applications",
|
||||
"CONSOLE_LINK_IMAGE": "/dashboard/assets/branding/loader.svg",
|
||||
"CHE_IDENTITY_SECRET": "che-identity-secret",
|
||||
"CHE_IDENTITY_POSTGRES_SECRET": "che-identity-postgres-secret",
|
||||
"CHE_POSTGRES_SECRET": "che-postgres-secret"
|
||||
},
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": [
|
||||
|
|
|
|||
|
|
@ -65,3 +65,19 @@ spec:
|
|||
value: quay.io/eclipse/che-plugin-artifacts-broker:v3.1.2
|
||||
- name: IMAGE_default_che_server_secure_exposer_jwt_proxy_image
|
||||
value: quay.io/eclipse/che-jwtproxy:fd94e60
|
||||
- name: CHE_FLAVOR
|
||||
value: che
|
||||
- name: CONSOLE_LINK_NAME
|
||||
value: che
|
||||
- name: CONSOLE_LINK_DISPLAY_NAME
|
||||
value: "Eclipse Che"
|
||||
- name: CONSOLE_LINK_SECTION
|
||||
value: "Red Hat Applications"
|
||||
- name: CONSOLE_LINK_IMAGE
|
||||
value: "/dashboard/assets/branding/loader.svg"
|
||||
- name: CHE_IDENTITY_SECRET
|
||||
value: che-identity-secret
|
||||
- name: CHE_IDENTITY_POSTGRES_SECRET
|
||||
value: che-identity-postgres-secret
|
||||
- name: CHE_POSTGRES_SECRET
|
||||
value: che-postgres-secret
|
||||
|
|
|
|||
|
|
@ -64,6 +64,22 @@ spec:
|
|||
value: quay.io/eclipse/che-plugin-artifacts-broker:v3.1.2
|
||||
- name: IMAGE_default_che_server_secure_exposer_jwt_proxy_image
|
||||
value: quay.io/eclipse/che-jwtproxy:fd94e60
|
||||
- name: CHE_FLAVOR
|
||||
value: che
|
||||
- name: CONSOLE_LINK_NAME
|
||||
value: che
|
||||
- name: CONSOLE_LINK_DISPLAY_NAME
|
||||
value: "Eclipse Che"
|
||||
- name: CONSOLE_LINK_SECTION
|
||||
value: "Red Hat Applications"
|
||||
- name: CONSOLE_LINK_IMAGE
|
||||
value: "/dashboard/assets/branding/loader.svg"
|
||||
- name: CHE_IDENTITY_SECRET
|
||||
value: che-identity-secret
|
||||
- name: CHE_IDENTITY_POSTGRES_SECRET
|
||||
value: che-identity-postgres-secret
|
||||
- name: CHE_POSTGRES_SECRET
|
||||
value: che-postgres-secret
|
||||
restartPolicy: Always
|
||||
serviceAccountName: che-operator
|
||||
terminationGracePeriodSeconds: 5
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -53,7 +53,7 @@ require (
|
|||
golang.org/x/tools v0.0.0-20190107155254-e063def13b29 // indirect
|
||||
google.golang.org/appengine v1.4.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20181126151915-b503174bad59
|
||||
k8s.io/apimachinery v0.0.0-20181126123746-eddba98df674
|
||||
k8s.io/client-go v0.0.0-20181126152608-d082d5923d3c
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ command -v operator-sdk >/dev/null 2>&1 || { echo -e $RED"operator-sdk is not in
|
|||
|
||||
CHE_NAMESPACE=che
|
||||
|
||||
|
||||
|
||||
set +e
|
||||
kubectl create namespace $CHE_NAMESPACE
|
||||
set -e
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ createPRToMasterBranch() {
|
|||
resetChanges master
|
||||
local tmpBranch=${RELEASE}-to-master
|
||||
git checkout -B $tmpBranch
|
||||
git diff refs/heads/${BRANCH}...refs/heads/${RELEASE} ':(exclude)deploy/operator-local.yaml' ':(exclude)deploy/operator.yaml' ':(exclude)pkg/deploy/defaults_test.go'
|
||||
git diff refs/heads/${BRANCH}...refs/heads/${RELEASE} ':(exclude)deploy/operator-local.yaml' ':(exclude)deploy/operator.yaml'
|
||||
git add -A
|
||||
git commit -m "Copy "$RELEASE" csv to master" --signoff
|
||||
git push origin $tmpBranch
|
||||
|
|
@ -251,7 +251,6 @@ createPRToMasterBranch() {
|
|||
. ${RELEASE_DIR}/replace-images-tags.sh nightly master
|
||||
git add deploy/operator.yaml
|
||||
git add deploy/operator-local.yaml
|
||||
git add pkg/deploy/defaults_test.go
|
||||
git commit -m "Update images tags" --signoff
|
||||
git push origin $tmpBranch
|
||||
hub pull-request --base master --head ${tmpBranch} --browse -m "Update images tags in master branch"
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ func (r *ReconcileChe) Reconcile(request reconcile.Request) (reconcile.Result, e
|
|||
return reconcile.Result{Requeue: true}, nil
|
||||
}
|
||||
|
||||
cheFlavor := util.GetValue(instance.Spec.Server.CheFlavor, deploy.DefaultCheFlavor)
|
||||
cheFlavor := deploy.DefaultCheFlavor(instance)
|
||||
cheDeploymentName := cheFlavor
|
||||
if isOpenShift {
|
||||
// create a secret with router tls cert when on OpenShift infra and router is configured with a self signed certificate
|
||||
|
|
@ -1185,27 +1185,26 @@ func createConsoleLink(isOpenShift4 bool, protocol string, instance *orgv1.CheCl
|
|||
// console link is supported only with https
|
||||
return nil
|
||||
}
|
||||
cheFlavor := instance.Spec.Server.CheFlavor
|
||||
cheHost := instance.Spec.Server.CheHost
|
||||
preparedConsoleLink := &consolev1.ConsoleLink{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: deploy.DefaultConsoleLinkName,
|
||||
Name: deploy.DefaultConsoleLinkName(),
|
||||
},
|
||||
Spec: consolev1.ConsoleLinkSpec{
|
||||
Link: consolev1.Link{
|
||||
Href: protocol + "://" + cheHost,
|
||||
Text: deploy.DefaultConsoleLinkDisplayName(cheFlavor)},
|
||||
Text: deploy.DefaultConsoleLinkDisplayName()},
|
||||
Location: consolev1.ApplicationMenu,
|
||||
ApplicationMenu: &consolev1.ApplicationMenuSpec{
|
||||
Section: deploy.DefaultConsoleLinkSection,
|
||||
ImageURL: fmt.Sprintf("%s://%s%s", protocol, cheHost, deploy.DefaultConsoleLinkImage),
|
||||
Section: deploy.DefaultConsoleLinkSection(),
|
||||
ImageURL: fmt.Sprintf("%s://%s%s", protocol, cheHost, deploy.DefaultConsoleLinkImage()),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
existingConsoleLink := &consolev1.ConsoleLink{}
|
||||
|
||||
if getErr := r.nonCachedClient.Get(context.TODO(), client.ObjectKey{Name: deploy.DefaultConsoleLinkName}, existingConsoleLink); getErr == nil {
|
||||
if getErr := r.nonCachedClient.Get(context.TODO(), client.ObjectKey{Name: deploy.DefaultConsoleLinkName()}, existingConsoleLink); getErr == nil {
|
||||
// if found, update existing one. We need ResourceVersion from current one.
|
||||
preparedConsoleLink.ResourceVersion = existingConsoleLink.ResourceVersion
|
||||
logrus.Debugf("Updating the object: ConsoleLink, name: %s", existingConsoleLink.Name)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ package che
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/eclipse/che-operator/pkg/deploy"
|
||||
|
|
@ -25,6 +27,7 @@ import (
|
|||
routev1 "github.com/openshift/api/route/v1"
|
||||
userv1 "github.com/openshift/api/user/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v2"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
rbacapi "k8s.io/api/rbac/v1"
|
||||
|
|
@ -40,8 +43,18 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
func TestCheController(t *testing.T) {
|
||||
func init() {
|
||||
operator := &appsv1.Deployment{}
|
||||
data, err := ioutil.ReadFile("../../../deploy/operator.yaml")
|
||||
yaml.Unmarshal(data, operator)
|
||||
if err == nil {
|
||||
for _, env := range operator.Spec.Template.Spec.Containers[0].Env {
|
||||
os.Setenv(env.Name, env.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheController(t *testing.T) {
|
||||
// Set the logger to development mode for verbose logs.
|
||||
logf.SetLogger(logf.ZapLogger(true))
|
||||
|
||||
|
|
@ -196,7 +209,7 @@ func TestCheController(t *testing.T) {
|
|||
if cm.Data["CHE_INFRA_OPENSHIFT_TLS__ENABLED"] != "true" {
|
||||
t.Errorf("ConfigMap wasn't updated. Extecting true, got: %s", cm.Data["CHE_INFRA_OPENSHIFT_TLS__ENABLED"])
|
||||
}
|
||||
if err := cl.Get(context.TODO(), types.NamespacedName{Name: deploy.DefaultCheFlavor, Namespace: cheCR.Namespace}, route); err != nil {
|
||||
if err := cl.Get(context.TODO(), types.NamespacedName{Name: deploy.DefaultCheFlavor(cheCR), Namespace: cheCR.Namespace}, route); err != nil {
|
||||
t.Errorf("Route %s not found: %s", cm.Name, err)
|
||||
}
|
||||
if route.Spec.TLS.Termination != "edge" {
|
||||
|
|
|
|||
|
|
@ -157,8 +157,7 @@ func (r *ReconcileChe) CreateTLSSecret(instance *orgv1.CheCluster, url string, n
|
|||
}
|
||||
|
||||
func (r *ReconcileChe) GenerateAndSaveFields(instance *orgv1.CheCluster, request reconcile.Request) (err error) {
|
||||
|
||||
cheFlavor := util.GetValue(instance.Spec.Server.CheFlavor, deploy.DefaultCheFlavor)
|
||||
cheFlavor := deploy.DefaultCheFlavor(instance)
|
||||
if len(instance.Spec.Server.CheFlavor) < 1 {
|
||||
instance.Spec.Server.CheFlavor = cheFlavor
|
||||
if err := r.UpdateCheCRSpec(instance, "installation flavor", cheFlavor); err != nil {
|
||||
|
|
@ -170,7 +169,7 @@ func (r *ReconcileChe) GenerateAndSaveFields(instance *orgv1.CheCluster, request
|
|||
if cheMultiUser == "true" {
|
||||
if len(instance.Spec.Database.ChePostgresSecret) < 1 {
|
||||
if len(instance.Spec.Database.ChePostgresUser) < 1 || len(instance.Spec.Database.ChePostgresPassword) < 1 {
|
||||
chePostgresSecret := deploy.DefaultChePostgresSecret
|
||||
chePostgresSecret := deploy.DefaultChePostgresSecret()
|
||||
r.CreateSecret(instance, map[string][]byte{"user": []byte(deploy.DefaultChePostgresUser), "password": []byte(util.GeneratePasswd(12))}, chePostgresSecret)
|
||||
instance.Spec.Database.ChePostgresSecret = chePostgresSecret
|
||||
if err := r.UpdateCheCRSpec(instance, "Postgres Secret", chePostgresSecret); err != nil {
|
||||
|
|
@ -201,7 +200,7 @@ func (r *ReconcileChe) GenerateAndSaveFields(instance *orgv1.CheCluster, request
|
|||
}
|
||||
|
||||
if len(instance.Spec.Auth.IdentityProviderPostgresPassword) < 1 {
|
||||
identityPostgresSecret := deploy.DefaultCheIdentityPostgresSecret
|
||||
identityPostgresSecret := deploy.DefaultCheIdentityPostgresSecret()
|
||||
r.CreateSecret(instance, map[string][]byte{"password": []byte(keycloakPostgresPassword)}, identityPostgresSecret)
|
||||
instance.Spec.Auth.IdentityProviderPostgresSecret = identityPostgresSecret
|
||||
if err := r.UpdateCheCRSpec(instance, "Identity Provider Postgres Secret", identityPostgresSecret); err != nil {
|
||||
|
|
@ -223,7 +222,7 @@ func (r *ReconcileChe) GenerateAndSaveFields(instance *orgv1.CheCluster, request
|
|||
}
|
||||
|
||||
if len(instance.Spec.Auth.IdentityProviderAdminUserName) < 1 || len(instance.Spec.Auth.IdentityProviderPassword) < 1 {
|
||||
identityProviderSecret := deploy.DefaultCheIdentitySecret
|
||||
identityProviderSecret := deploy.DefaultCheIdentitySecret()
|
||||
r.CreateSecret(instance, map[string][]byte{"user": []byte(keycloakAdminUserName), "password": []byte(keycloakAdminPassword)}, identityProviderSecret)
|
||||
instance.Spec.Auth.IdentityProviderSecret = identityProviderSecret
|
||||
if err := r.UpdateCheCRSpec(instance, "Identity Provider Secret", identityProviderSecret); err != nil {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ package che
|
|||
import (
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/deploy"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
)
|
||||
|
|
@ -26,7 +25,7 @@ const (
|
|||
)
|
||||
|
||||
func (r *ReconcileChe) SetCheAvailableStatus(instance *orgv1.CheCluster, request reconcile.Request, protocol string, cheHost string) (err error) {
|
||||
cheFlavor := util.GetValue(instance.Spec.Server.CheFlavor, deploy.DefaultCheFlavor)
|
||||
cheFlavor := deploy.DefaultCheFlavor(instance)
|
||||
name := "Eclipse Che"
|
||||
if cheFlavor == "codeready" {
|
||||
name = "CodeReady Workspaces"
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
|
|||
if err != nil {
|
||||
logrus.Errorf("Failed to get current infra: %s", err)
|
||||
}
|
||||
cheFlavor := util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
cheFlavor := DefaultCheFlavor(cr)
|
||||
infra := "kubernetes"
|
||||
if isOpenShift {
|
||||
infra = "openshift"
|
||||
|
|
@ -145,10 +145,10 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
|
|||
tls := "false"
|
||||
openShiftIdentityProviderId := "NULL"
|
||||
openshiftOAuth := cr.Spec.Auth.OpenShiftoAuth
|
||||
defaultTargetNamespaceDefault := cr.Namespace // By default Che SA has right in the namespace where Che in installed ...
|
||||
defaultTargetNamespaceDefault := cr.Namespace // By default Che SA has right in the namespace where Che in installed ...
|
||||
if openshiftOAuth && isOpenShift {
|
||||
// ... But if the workspace is created under the openshift identity of the end-user,
|
||||
// Then we'll have rights to create any new namespace
|
||||
// Then we'll have rights to create any new namespace
|
||||
defaultTargetNamespaceDefault = "<username>-" + cheFlavor
|
||||
openShiftIdentityProviderId = "openshift-v3"
|
||||
if isOpenshift4 {
|
||||
|
|
@ -220,7 +220,7 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
|
|||
cheLogLevel := util.GetValue(cr.Spec.Server.CheLogLevel, DefaultCheLogLevel)
|
||||
cheDebug := util.GetValue(cr.Spec.Server.CheDebug, DefaultCheDebug)
|
||||
cheMetrics := strconv.FormatBool(cr.Spec.Metrics.Enable)
|
||||
cheLabels := util.MapToKeyValuePairs(GetLabels(cr, util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)))
|
||||
cheLabels := util.MapToKeyValuePairs(GetLabels(cr, cheFlavor))
|
||||
cheMultiUser := GetCheMultiUser(cr)
|
||||
|
||||
data := &CheConfigMap{
|
||||
|
|
@ -297,8 +297,7 @@ func GetConfigMapData(cr *orgv1.CheCluster) (cheEnv map[string]string) {
|
|||
}
|
||||
|
||||
func GetSpecConfigMap(checluster *orgv1.CheCluster, cheEnv map[string]string, clusterAPI ClusterAPI) (*corev1.ConfigMap, error) {
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
labels := GetLabels(checluster, cheFlavor)
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
configMap := &corev1.ConfigMap{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ConfigMap",
|
||||
|
|
|
|||
|
|
@ -42,12 +42,10 @@ var (
|
|||
)
|
||||
|
||||
const (
|
||||
DefaultCheFlavor = "che"
|
||||
DefaultChePostgresUser = "pgche"
|
||||
DefaultChePostgresHostName = "postgres"
|
||||
DefaultChePostgresPort = "5432"
|
||||
DefaultChePostgresDb = "dbche"
|
||||
DefaultChePostgresSecret = "che-postgres-secret"
|
||||
DefaultPvcStrategy = "common"
|
||||
DefaultPvcClaimSize = "1Gi"
|
||||
DefaultIngressStrategy = "multi-host"
|
||||
|
|
@ -68,7 +66,7 @@ const (
|
|||
DefaultCheVolumeClaimName = "che-data-volume"
|
||||
DefaultPostgresVolumeClaimName = "postgres-data"
|
||||
|
||||
DefaultJavaOpts = "-XX:MaxRAMPercentage=85.0"
|
||||
DefaultJavaOpts = "-XX:MaxRAMPercentage=85.0"
|
||||
DefaultWorkspaceJavaOpts = "-XX:MaxRAM=150m -XX:MaxRAMFraction=2 -XX:+UseParallelGC " +
|
||||
"-XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 " +
|
||||
"-Dsun.zip.disableMemoryMapping=true " +
|
||||
|
|
@ -88,15 +86,6 @@ const (
|
|||
OldDefaultCodeReadyServerImageRepo = "registry.redhat.io/codeready-workspaces/server-rhel8"
|
||||
OldDefaultCodeReadyServerImageTag = "1.2"
|
||||
OldCrwPluginRegistryUrl = "https://che-plugin-registry.openshift.io"
|
||||
|
||||
// ConsoleLink default
|
||||
DefaultConsoleLinkName = "che"
|
||||
DefaultConsoleLinkSection = "Red Hat Applications"
|
||||
DefaultConsoleLinkImage = "/dashboard/assets/branding/loader.svg"
|
||||
DefaultCheIdentitySecret = "che-identity-secret"
|
||||
DefaultCheIdentityPostgresSecret = "che-identity-postgres-secret"
|
||||
defaultConsoleLinkUpstreamDisplayName = "Eclipse Che"
|
||||
defaultConsoleLinkDisplayName = "CodeReady Workspaces"
|
||||
)
|
||||
|
||||
func InitDefaults(defaultsPath string) {
|
||||
|
|
@ -180,11 +169,36 @@ func MigratingToCRW2_0(cr *orgv1.CheCluster) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func DefaultConsoleLinkDisplayName(cheFlavor string) string {
|
||||
if cheFlavor == "codeready" {
|
||||
return defaultConsoleLinkDisplayName
|
||||
}
|
||||
return defaultConsoleLinkUpstreamDisplayName
|
||||
func DefaultCheFlavor(cr *orgv1.CheCluster) string {
|
||||
return util.GetValue(cr.Spec.Server.CheFlavor, getDefaultFromEnv("CHE_FLAVOR"))
|
||||
}
|
||||
|
||||
func DefaultConsoleLinkName() string {
|
||||
return getDefaultFromEnv("CONSOLE_LINK_NAME")
|
||||
}
|
||||
|
||||
func DefaultConsoleLinkDisplayName() string {
|
||||
return getDefaultFromEnv("CONSOLE_LINK_DISPLAY_NAME")
|
||||
}
|
||||
|
||||
func DefaultConsoleLinkSection() string {
|
||||
return getDefaultFromEnv("CONSOLE_LINK_SECTION")
|
||||
}
|
||||
|
||||
func DefaultConsoleLinkImage() string {
|
||||
return getDefaultFromEnv("CONSOLE_LINK_IMAGE")
|
||||
}
|
||||
|
||||
func DefaultCheIdentitySecret() string {
|
||||
return getDefaultFromEnv("CHE_IDENTITY_SECRET")
|
||||
}
|
||||
|
||||
func DefaultCheIdentityPostgresSecret() string {
|
||||
return getDefaultFromEnv("CHE_IDENTITY_POSTGRES_SECRET")
|
||||
}
|
||||
|
||||
func DefaultChePostgresSecret() string {
|
||||
return getDefaultFromEnv("CHE_POSTGRES_SECRET")
|
||||
}
|
||||
|
||||
func DefaultCheVersion() string {
|
||||
|
|
|
|||
|
|
@ -13,38 +13,62 @@ package deploy
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"gopkg.in/yaml.v2"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
cheVersionTest = "nightly"
|
||||
cheServerImageTest = "quay.io/eclipse/che-server:nightly"
|
||||
pluginRegistryImageTest = "quay.io/eclipse/che-plugin-registry:nightly"
|
||||
devfileRegistryImageTest = "quay.io/eclipse/che-devfile-registry:nightly"
|
||||
pvcJobsImageTest = "registry.access.redhat.com/ubi8-minimal:8.2-267"
|
||||
postgresImageTest = "centos/postgresql-96-centos7:9.6"
|
||||
keycloakImageTest = "quay.io/eclipse/che-keycloak:nightly"
|
||||
brokerMetadataTest = "quay.io/eclipse/che-plugin-metadata-broker:v3.1.2"
|
||||
brokerArtifactsTest = "quay.io/eclipse/che-plugin-artifacts-broker:v3.1.2"
|
||||
jwtProxyTest = "quay.io/eclipse/che-jwtproxy:fd94e60"
|
||||
tlsJobImageTest = "quay.io/eclipse/che-tls-secret-creator:alpine-3029769"
|
||||
var (
|
||||
cheVersionTest string
|
||||
cheServerImageTest string
|
||||
pluginRegistryImageTest string
|
||||
devfileRegistryImageTest string
|
||||
pvcJobsImageTest string
|
||||
postgresImageTest string
|
||||
keycloakImageTest string
|
||||
brokerMetadataTest string
|
||||
brokerArtifactsTest string
|
||||
jwtProxyTest string
|
||||
tlsJobImageTest string
|
||||
)
|
||||
|
||||
func init() {
|
||||
os.Setenv("CHE_VERSION", cheVersionTest)
|
||||
os.Setenv("IMAGE_default_che_server", cheServerImageTest)
|
||||
os.Setenv("IMAGE_default_plugin_registry", pluginRegistryImageTest)
|
||||
os.Setenv("IMAGE_default_devfile_registry", devfileRegistryImageTest)
|
||||
os.Setenv("IMAGE_default_che_tls_secrets_creation_job", tlsJobImageTest)
|
||||
os.Setenv("IMAGE_default_pvc_jobs", pvcJobsImageTest)
|
||||
os.Setenv("IMAGE_default_postgres", postgresImageTest)
|
||||
os.Setenv("IMAGE_default_keycloak", keycloakImageTest)
|
||||
os.Setenv("IMAGE_default_che_workspace_plugin_broker_metadata", brokerMetadataTest)
|
||||
os.Setenv("IMAGE_default_che_workspace_plugin_broker_artifacts", brokerArtifactsTest)
|
||||
os.Setenv("IMAGE_default_che_server_secure_exposer_jwt_proxy_image", jwtProxyTest)
|
||||
operator := &appsv1.Deployment{}
|
||||
data, err := ioutil.ReadFile("../../deploy/operator.yaml")
|
||||
yaml.Unmarshal(data, operator)
|
||||
if err == nil {
|
||||
for _, env := range operator.Spec.Template.Spec.Containers[0].Env {
|
||||
os.Setenv(env.Name, env.Value)
|
||||
switch env.Name {
|
||||
case "CHE_VERSION":
|
||||
cheVersionTest = env.Value
|
||||
case "IMAGE_default_che_server":
|
||||
cheServerImageTest = env.Value
|
||||
case "IMAGE_default_plugin_registry":
|
||||
pluginRegistryImageTest = env.Value
|
||||
case "IMAGE_default_devfile_registry":
|
||||
devfileRegistryImageTest = env.Value
|
||||
case "IMAGE_default_che_tls_secrets_creation_job":
|
||||
tlsJobImageTest = env.Value
|
||||
case "IMAGE_default_pvc_jobs":
|
||||
pvcJobsImageTest = env.Value
|
||||
case "IMAGE_default_postgres":
|
||||
postgresImageTest = env.Value
|
||||
case "IMAGE_default_keycloak":
|
||||
keycloakImageTest = env.Value
|
||||
case "IMAGE_default_che_workspace_plugin_broker_metadata":
|
||||
brokerMetadataTest = env.Value
|
||||
case "IMAGE_default_che_workspace_plugin_broker_artifacts":
|
||||
brokerArtifactsTest = env.Value
|
||||
case "IMAGE_default_che_server_secure_exposer_jwt_proxy_image":
|
||||
jwtProxyTest = env.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InitDefaultsFromEnv()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ import (
|
|||
)
|
||||
|
||||
func SyncCheDeploymentToCluster(checluster *orgv1.CheCluster, cmResourceVersion string, clusterAPI ClusterAPI) DeploymentProvisioningStatus {
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
clusterDeployment, err := getClusterDeployment(cheFlavor, checluster.Namespace, clusterAPI.Client)
|
||||
clusterDeployment, err := getClusterDeployment(DefaultCheFlavor(checluster), checluster.Namespace, clusterAPI.Client)
|
||||
if err != nil {
|
||||
return DeploymentProvisioningStatus{
|
||||
ProvisioningStatus: ProvisioningStatus{Err: err},
|
||||
|
|
@ -51,9 +50,9 @@ func getSpecCheDeployment(checluster *orgv1.CheCluster, cmResourceVersion string
|
|||
}
|
||||
|
||||
terminationGracePeriodSeconds := int64(30)
|
||||
labels := GetLabels(checluster, util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
cheFlavor := DefaultCheFlavor(checluster)
|
||||
labels := GetLabels(checluster, cheFlavor)
|
||||
optionalEnv := true
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
memRequest := util.GetValue(checluster.Spec.Server.ServerMemoryRequest, DefaultServerMemoryRequest)
|
||||
selfSignedCertEnv := corev1.EnvVar{
|
||||
Name: "CHE_SELF__SIGNED__CERT",
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ func SyncKeycloakDeploymentToCluster(checluster *orgv1.CheCluster, clusterAPI Cl
|
|||
func getSpecKeycloakDeployment(checluster *orgv1.CheCluster, clusterDeployment *appsv1.Deployment, clusterAPI ClusterAPI) (*appsv1.Deployment, error) {
|
||||
optionalEnv := true
|
||||
labels := GetLabels(checluster, KeycloakDeploymentName)
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
cheFlavor := DefaultCheFlavor(checluster)
|
||||
keycloakImage := util.GetValue(checluster.Spec.Auth.IdentityProviderImage, DefaultKeycloakImage(checluster))
|
||||
pullPolicy := corev1.PullPolicy(util.GetValue(string(checluster.Spec.Auth.IdentityProviderImagePullPolicy), DefaultPullPolicyFromDockerImage(keycloakImage)))
|
||||
jbossDir := "/opt/eap"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ func GetPostgresProvisionCommand(identityProviderPostgresSecret string) (command
|
|||
func GetKeycloakProvisionCommand(cr *orgv1.CheCluster, cheHost string) (command string) {
|
||||
requiredActions := ""
|
||||
updateAdminPassword := cr.Spec.Auth.UpdateAdminPassword
|
||||
cheFlavor := util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
cheFlavor := DefaultCheFlavor(cr)
|
||||
keycloakRealm := util.GetValue(cr.Spec.Auth.IdentityProviderRealm, cheFlavor)
|
||||
keycloakClientId := util.GetValue(cr.Spec.Auth.IdentityProviderClientId, cheFlavor+"-public")
|
||||
keycloakUserEnvVar := "${KEYCLOAK_USER}"
|
||||
|
|
@ -78,7 +78,7 @@ func GetKeycloakProvisionCommand(cr *orgv1.CheCluster, cheHost string) (command
|
|||
}
|
||||
|
||||
func GetOpenShiftIdentityProviderProvisionCommand(cr *orgv1.CheCluster, oAuthClientName string, oauthSecret string, isOpenShift4 bool) (command string, err error) {
|
||||
cheFlavor := util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
cheFlavor := DefaultCheFlavor(cr)
|
||||
openShiftApiUrl, err := util.GetClusterPublicHostname(isOpenShift4)
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to auto-detect public OpenShift API URL. Configure it in Identity provider details page in Keycloak admin console: %s", err)
|
||||
|
|
@ -154,7 +154,7 @@ func GetOpenShiftIdentityProviderProvisionCommand(cr *orgv1.CheCluster, oAuthCli
|
|||
}
|
||||
|
||||
func GetDeleteOpenShiftIdentityProviderProvisionCommand(cr *orgv1.CheCluster, isOpenShift4 bool) (command string) {
|
||||
cheFlavor := util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
cheFlavor := DefaultCheFlavor(cr)
|
||||
keycloakRealm := util.GetValue(cr.Spec.Auth.IdentityProviderRealm, cheFlavor)
|
||||
script := "/opt/jboss/keycloak/bin/kcadm.sh"
|
||||
keycloakUserEnvVar := "${KEYCLOAK_USER}"
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func getSpecJob(
|
|||
serviceAccountName string,
|
||||
env map[string]string,
|
||||
clusterAPI ClusterAPI) (*batchv1.Job, error) {
|
||||
labels := GetLabels(checluster, util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
labels["component"] = component
|
||||
|
||||
backoffLimit := int32(3)
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ package deploy
|
|||
|
||||
import (
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
)
|
||||
|
||||
func GetLabels(cr *orgv1.CheCluster, component string) (labels map[string]string) {
|
||||
cheFlavor := util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
labels = map[string]string{"app": cheFlavor, "component": component}
|
||||
labels = map[string]string{"app": DefaultCheFlavor(cr), "component": component}
|
||||
return labels
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ package deploy
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ type PluginRegistryConfigMap struct {
|
|||
}
|
||||
|
||||
func CreateDevfileRegistryConfigMap(cr *orgv1.CheCluster, endpoint string) *corev1.ConfigMap {
|
||||
labels := GetLabels(cr, util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(cr, DefaultCheFlavor(cr))
|
||||
return &corev1.ConfigMap{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ConfigMap",
|
||||
|
|
@ -49,7 +49,7 @@ func CreateDevfileRegistryConfigMap(cr *orgv1.CheCluster, endpoint string) *core
|
|||
}
|
||||
|
||||
func CreatePluginRegistryConfigMap(cr *orgv1.CheCluster) *corev1.ConfigMap {
|
||||
labels := GetLabels(cr, util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(cr, DefaultCheFlavor(cr))
|
||||
fmt.Println("Cr namespace " + cr.Namespace)
|
||||
return &corev1.ConfigMap{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import (
|
|||
"context"
|
||||
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
rbac "k8s.io/api/rbac/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
|
@ -68,7 +67,7 @@ func getClusterRole(name string, namespace string, client runtimeClient.Client)
|
|||
}
|
||||
|
||||
func getSpecRole(checluster *orgv1.CheCluster, name string, resources []string, verbs []string, clusterAPI ClusterAPI) (*rbac.Role, error) {
|
||||
labels := GetLabels(checluster, util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
role := &rbac.Role{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Role",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import (
|
|||
"context"
|
||||
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
rbac "k8s.io/api/rbac/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
|
@ -76,7 +75,7 @@ func getSpecRoleBinding(
|
|||
roleKind string,
|
||||
clusterAPI ClusterAPI) (*rbac.RoleBinding, error) {
|
||||
|
||||
labels := GetLabels(checluster, util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
roleBinding := &rbac.RoleBinding{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "RoleBinding",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import (
|
|||
"fmt"
|
||||
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
routev1 "github.com/openshift/api/route/v1"
|
||||
|
|
@ -113,9 +112,8 @@ func getClusterRoute(name string, namespace string, client runtimeClient.Client)
|
|||
}
|
||||
|
||||
func getSpecRoute(checluster *orgv1.CheCluster, name string, serviceName string, port int32, clusterAPI ClusterAPI) (*routev1.Route, error) {
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
tlsSupport := checluster.Spec.Server.TlsSupport
|
||||
labels := GetLabels(checluster, cheFlavor)
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
weight := int32(100)
|
||||
|
||||
if name == "keycloak" {
|
||||
|
|
|
|||
|
|
@ -13,13 +13,12 @@ package deploy
|
|||
|
||||
import (
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func NewSecret(cr *orgv1.CheCluster, name string, data map[string][]byte) *corev1.Secret {
|
||||
labels := GetLabels(cr, util.GetValue(cr.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(cr, DefaultCheFlavor(cr))
|
||||
return &corev1.Secret{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Secret",
|
||||
|
|
|
|||
|
|
@ -55,8 +55,7 @@ func SyncCheServiceToCluster(checluster *orgv1.CheCluster, clusterAPI ClusterAPI
|
|||
func GetSpecCheService(checluster *orgv1.CheCluster, clusterAPI ClusterAPI) (*corev1.Service, error) {
|
||||
portName := []string{"http"}
|
||||
portNumber := []int32{8080}
|
||||
cheFlavor := util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor)
|
||||
labels := GetLabels(checluster, cheFlavor)
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
|
||||
if checluster.Spec.Metrics.Enable {
|
||||
portName = append(portName, "metrics")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import (
|
|||
"context"
|
||||
|
||||
orgv1 "github.com/eclipse/che-operator/pkg/apis/org/v1"
|
||||
"github.com/eclipse/che-operator/pkg/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
|
@ -62,7 +61,7 @@ func getClusterServiceAccount(name string, namespace string, client runtimeClien
|
|||
}
|
||||
|
||||
func getSpecServiceAccount(checluster *orgv1.CheCluster, name string, clusterAPI ClusterAPI) (*corev1.ServiceAccount, error) {
|
||||
labels := GetLabels(checluster, util.GetValue(checluster.Spec.Server.CheFlavor, DefaultCheFlavor))
|
||||
labels := GetLabels(checluster, DefaultCheFlavor(checluster))
|
||||
serviceAccount := &corev1.ServiceAccount{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ServiceAccount",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
# Updates images into:
|
||||
# - deploy/operator.yaml
|
||||
# - deploy/operator-local.yaml
|
||||
# - pkg/deploy/defaults_test.go
|
||||
# Usage:
|
||||
# ./release-operator-code.sh <RELEASE> <CHE_RELEASE_BRANCH>
|
||||
|
||||
|
|
@ -89,19 +88,6 @@ replaceImagesTags() {
|
|||
yq -ryY "( .spec.template.spec.containers[] | select(.name == \"che-operator\").env[] | select(.name == \"IMAGE_default_che_server_secure_exposer_jwt_proxy_image\") | .value ) = \"${JWT_PROXY_IMAGE_RELEASE}\"" \
|
||||
>> "${NEW_OPERATOR_LOCAL_YAML}"
|
||||
mv "${NEW_OPERATOR_LOCAL_YAML}" "${OPERATOR_LOCAL_YAML}"
|
||||
|
||||
defaulTest=${BASE_DIR}/pkg/deploy/defaults_test.go
|
||||
sed -i 's|cheVersionTest.*= ".*"|cheVersionTest = "'${RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|cheServerImageTest.*= ".*"|cheServerImageTest = "'"$CHE_SERVER_IMAGE_REALEASE"'"|g' $defaulTest
|
||||
sed -i 's|cheOperatorImageTest.*= ".*"|cheOperatorImageTest = "'"quay.io/eclipse/che-operator:${RELEASE}"'"|g' $defaulTest
|
||||
sed -i 's|pluginRegistryImageTest.*= ".*"|pluginRegistryImageTest = "'${PLUGIN_REGISTRY_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|devfileRegistryImageTest.*= ".*"|devfileRegistryImageTest = "'${DEVFILE_REGISTRY_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|pvcJobsImageTest.*= ".*"|pvcJobsImageTest = "'${UBI8_MINIMAL_IMAGE}'"|g' $defaulTest
|
||||
sed -i 's|keycloakImageTest.*= ".*"|keycloakImageTest = "'${KEYCLOAK_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|brokerMetadataTest.*= ".*"|brokerMetadataTest = "'${PLUGIN_BROKER_METADATA_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|brokerArtifactsTest.*= ".*"|brokerArtifactsTest = "'${PLUGIN_BROKER_ARTIFACTS_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|jwtProxyTest.*= ".*"|jwtProxyTest = "'${JWT_PROXY_IMAGE_RELEASE}'"|g' $defaulTest
|
||||
sed -i 's|cheVersionTest = ".*"|cheVersionTest = "nightly"|g' /home/tolusha/gocode/src/github.com/eclipse/che-operator/pkg/deploy/defaults_test.go
|
||||
}
|
||||
|
||||
init "$@"
|
||||
|
|
|
|||
Loading…
Reference in New Issue