Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha committed Jun 3, 2022
1 parent 3b3489f commit f379e5c
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 52 deletions.
20 changes: 10 additions & 10 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ deployEclipseCheWithHelm() {
deployEclipseCheWithOperator "${chectlbin}" "${platform}" "${templates}" "${customimage}"

# Get configuration
local identityProvider=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.ingress.auth.identityProviderURL}')
local oAuthSecret=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.ingress.auth.oAuthSecret}')
local oAuthClientName=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.ingress.auth.oAuthClientName}')
local domain=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.ingress.domain}')
local identityProvider=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.networking.auth.identityProviderURL}')
local oAuthSecret=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.networking.auth.oAuthSecret}')
local oAuthClientName=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.networking.auth.oAuthClientName}')
local domain=$(kubectl get checluster/eclipse-che -n ${NAMESPACE} -o jsonpath='{.spec.networking.domain}')

# Delete Eclipse Che (Cert Manager and Dex are still there)
${chectlbin} server:delete -y -n ${NAMESPACE}
Expand All @@ -226,10 +226,10 @@ deployEclipseCheWithHelm() {
helm install che \
--create-namespace \
--namespace eclipse-che \
--set ingress.domain="${domain}" \
--set ingress.auth.oAuthSecret="${oAuthSecret}" \
--set ingress.auth.oAuthClientName="${oAuthClientName}" \
--set ingress.auth.identityProviderURL="${identityProvider}" .
--set networking.domain="${domain}" \
--set networking.auth.oAuthSecret="${oAuthSecret}" \
--set networking.auth.oAuthClientName="${oAuthClientName}" \
--set networking.auth.identityProviderURL="${identityProvider}" .
popd

local cheVersion=$(yq -r '.spec.template.spec.containers[0].env[] | select(.name == "CHE_VERSION") | .value' < "${OPERATOR_DEPLOYMENT}")
Expand Down Expand Up @@ -258,8 +258,8 @@ deployEclipseCheWithOperator() {
checluster=$(grep -rlx "kind: CheCluster" /tmp/chectl-templates/che-operator/)
apiVersion=$(yq -r '.apiVersion' ${checluster})
if [[ ${apiVersion} == "org.eclipse.che/v2" ]]; then
yq -riY '.spec.ingress.domain = "'$(minikube ip).nip.io'"' ${checluster}
yq -riY '.spec.ingress.tlsSecretName = "che-tls"' ${checluster}
yq -riY '.spec.networking.domain = "'$(minikube ip).nip.io'"' ${checluster}
yq -riY '.spec.networking.tlsSecretName = "che-tls"' ${checluster}
else
yq -riY '.spec.k8s.ingressDomain = "'$(minikube ip).nip.io'"' ${checluster}
fi
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ update-helmcharts: ## Update Helm Charts
yq -rYi --arg examples "$${CRDS_SAMPLES}" ".annotations.\"artifacthub.io/crdsExamples\" = \$$examples" $${chartYaml}
rm -rf $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
else
yq -riY '.spec.ingress.tlsSecretName = "che-tls"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.ingress.domain = "{{ .Values.ingress.domain }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.ingress.auth.oAuthSecret = "{{ .Values.ingress.auth.oAuthSecret }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.ingress.auth.oAuthClientName = "{{ .Values.ingress.auth.oAuthClientName }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.ingress.auth.identityProviderURL = "{{ .Values.ingress.auth.identityProviderURL }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.networking.tlsSecretName = "che-tls"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.networking.domain = "{{ .Values.networking.domain }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.networking.auth.oAuthSecret = "{{ .Values.networking.auth.oAuthSecret }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.networking.auth.oAuthClientName = "{{ .Values.networking.auth.oAuthClientName }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
yq -riY '.spec.networking.auth.identityProviderURL = "{{ .Values.networking.auth.identityProviderURL }}"' $${HELMCHARTS_TEMPLATES}/org_v2_checluster.yaml
fi

echo "[INFO] HelmCharts updated $${HELM_DIR}"
Expand Down Expand Up @@ -463,12 +463,12 @@ create-checluster-cr: ## Creates CheCluster Custom Resource V2
CHECLUSTER_CR_2_APPLY=/tmp/checluster_cr.yaml
cp $(CHECLUSTER_CR_PATH) $${CHECLUSTER_CR_2_APPLY}

# Update ingress.domain field with an actual value
# Update networking.domain field with an actual value
if [[ $(PLATFORM) == "kubernetes" ]]; then
# kubectl does not have `whoami` command
CLUSTER_API_URL=$$(oc whoami --show-server=true) || true;
CLUSTER_DOMAIN=$$(echo $${CLUSTER_API_URL} | sed -E 's/https:\/\/(.*):.*/\1/g')
yq -riY '.spec.ingress.domain = "'$${CLUSTER_DOMAIN}'.nip.io"' $${CHECLUSTER_CR_2_APPLY}
yq -riY '.spec.networking.domain = "'$${CLUSTER_DOMAIN}'.nip.io"' $${CHECLUSTER_CR_2_APPLY}
fi
$(K8S_CLI) apply -f $${CHECLUSTER_CR_2_APPLY} -n $(ECLIPSE_CHE_NAMESPACE)
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ metadata:
"enable": true
}
},
"ingress": {
"devEnvironments": {
"defaultNamespace": {
"template": "<username>-che"
},
"storage": {
"pvcStrategy": "common"
}
},
"networking": {
"auth": {
"identityProviderURL": "",
"oAuthClientName": "",
"oAuthSecret": ""
},
"domain": "",
"tlsSecretName": ""
},
"workspaces": {
"defaultNamespace": {
"template": "<username>-che"
},
"storage": {
"pvcStrategy": "common"
}
}
}
}
Expand All @@ -97,7 +97,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.49.0-560.next
name: eclipse-che-preview-openshift.v7.49.0-561.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1410,7 +1410,7 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.49.0-560.next
version: 7.49.0-561.next
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
4 changes: 2 additions & 2 deletions config/samples/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
workspaces:
devEnvironments:
defaultNamespace:
template: '<username>-che'
storage:
Expand All @@ -26,7 +26,7 @@ spec:
externalDb: false
metrics:
enable: true
ingress:
networking:
domain: ''
tlsSecretName: ''
auth:
Expand Down
2 changes: 1 addition & 1 deletion controllers/che/checluster_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewCheClusterValidator() *CheClusterValidator {
func (v *CheClusterValidator) Reconcile(ctx *chetypes.DeployContext) (reconcile.Result, bool, error) {
if !infrastructure.IsOpenShift() {
if ctx.CheCluster.Spec.Networking.Domain == "" {
return reconcile.Result{}, false, fmt.Errorf("Required field \"spec.auth.gateway.ingress.domain\" is not set")
return reconcile.Result{}, false, fmt.Errorf("Required field \"spec.networking.domain\" is not set")
}
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/devworkspace/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (r *CheClusterReconciler) validate(cluster *chev2.CheCluster) error {

if !infrastructure.IsOpenShift() {
if cluster.Spec.Networking.Domain == "" {
validationErrors = append(validationErrors, "spec.ingress.domain must be specified")
validationErrors = append(validationErrors, "spec.networking.domain must be specified")
}
}

Expand Down
4 changes: 2 additions & 2 deletions deploy/deployment/kubernetes/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
workspaces:
devEnvironments:
defaultNamespace:
template: '<username>-che'
storage:
Expand All @@ -26,7 +26,7 @@ spec:
externalDb: false
metrics:
enable: true
ingress:
networking:
domain: ''
tlsSecretName: ''
auth:
Expand Down
4 changes: 2 additions & 2 deletions deploy/deployment/openshift/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
workspaces:
devEnvironments:
defaultNamespace:
template: '<username>-che'
storage:
Expand All @@ -26,7 +26,7 @@ spec:
externalDb: false
metrics:
enable: true
ingress:
networking:
domain: ''
tlsSecretName: ''
auth:
Expand Down
8 changes: 4 additions & 4 deletions helmcharts/next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Install the Helm Charts for Eclipse Che Operator
helm install che \
--create-namespace \
--namespace eclipse-che \
--set ingress.domain=<KUBERNETES_INGRESS_DOMAIN> \
--set ingress.auth.oAuthSecret=<OAUTH_SECRET> \
--set ingress.auth.oAuthClientName=<OAUTH_CLIENT_NAME> \
--set ingress.auth.identityProviderURL=<IDENTITY_PROVIDER_URL> .
--set networking.domain=<KUBERNETES_INGRESS_DOMAIN> \
--set networking.auth.oAuthSecret=<OAUTH_SECRET> \
--set networking.auth.oAuthClientName=<OAUTH_CLIENT_NAME> \
--set networking.auth.identityProviderURL=<IDENTITY_PROVIDER_URL> .
```
12 changes: 6 additions & 6 deletions helmcharts/next/templates/org_v2_checluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
name: eclipse-che
namespace: eclipse-che
spec:
workspaces:
devEnvironments:
defaultNamespace:
template: '<username>-che'
storage:
Expand All @@ -26,10 +26,10 @@ spec:
externalDb: false
metrics:
enable: true
ingress:
domain: '{{ .Values.ingress.domain }}'
networking:
domain: '{{ .Values.networking.domain }}'
tlsSecretName: 'che-tls'
auth:
identityProviderURL: '{{ .Values.ingress.auth.identityProviderURL }}'
oAuthClientName: '{{ .Values.ingress.auth.oAuthClientName }}'
oAuthSecret: '{{ .Values.ingress.auth.oAuthSecret }}'
identityProviderURL: '{{ .Values.networking.auth.identityProviderURL }}'
oAuthClientName: '{{ .Values.networking.auth.oAuthClientName }}'
oAuthSecret: '{{ .Values.networking.auth.oAuthSecret }}'
2 changes: 1 addition & 1 deletion helmcharts/next/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Red Hat, Inc. - initial API and implementation
#

ingress:
networking:
domain: ""
auth:
identityProviderURL: ""
Expand Down
8 changes: 4 additions & 4 deletions helmcharts/stable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ eclipse-che che-operator-554c564476-fl98z 1/1 Ru

Click `CRDS` button, select `CheCluster` template and copy custom resource Eclipse Che to file `org_v2_checluster.yaml`.
Set the following fields:
- `spec.ingress.domain`
- `spec.ingress.auth.identityProviderURL`
- `spec.ingress.auth.oAuthClientName`
- `spec.ingress.auth.oAuthSecret`
- `spec.networking.domain`
- `spec.networking.auth.identityProviderURL`
- `spec.networking.auth.oAuthClientName`
- `spec.networking.auth.oAuthSecret`

4. Apply CR:
```bash
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/migration/on-reconcile-one-time-migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (m *Migrator) migrate(ctx *chetypes.DeployContext) (bool, error) {
// - spec.server.serverTrustStoreConfigMapName
// - spec.server.proxy.credentialssecretname
// - spec.database.credentialssecretname
// - spec.ingress.tlsSecretName
// - spec.networking.tlsSecretName
// Note, most of the objects above are autogenerated and do not require any migration,
// but to handle the case when some were created manually or operator updated, the check is done here.
func addPartOfCheLabeltoUserDefinedObjects(ctx *chetypes.DeployContext) error {
Expand Down

0 comments on commit f379e5c

Please sign in to comment.