Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ That is, if you pass a param via CLI, for example, it will overwrite the corresp
| `--output-config-file` | `application.outputConfigFile` | `false` | Boolean | Output configuration file |
| `-v, --version` | `application.versionInfoRequested` | `false` | Boolean | Display version and license info |
| `-h, --help` | `application.usageHelpRequested` | `false` | Boolean | Display help message |
| `--remote` | `application.remote` | `false` | Boolean | Expose services as LoadBalancers |
| `--insecure` | `application.insecure` | `false` | Boolean | Sets insecure-mode in cURL which skips cert validation |
| `--openshift` | `application.openshift` | `false` | Boolean | When set, openshift specific resources and configurations are applied |
| `--username` | `application.username` | `'admin'` | String | Set initial admin username |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ argo-cd:
</#if>

service:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
metrics:
enabled: true
<#if config.features.monitoring.active == true>
Expand Down
2 changes: 1 addition & 1 deletion argocd/cluster-resources/apps/jenkins/values.ftl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ controller:
# to prevent the jenkins-ui-test pod being created
testEnabled: false

serviceType: <#if config.application.remote>LoadBalancer<#else>NodePort</#if>
serviceType: NodePort
servicePort: 80

jenkinsUrl: ${config.jenkins.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ imagePullSecrets:
- name: proxy-registry
</#if>
service:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
port:
http: 80
auth:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ grafana:
adminUser: ${config.application["username"]}
adminPassword: ${config.application["password"]}
service:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
<#if monitoring?? && monitoring?is_hash && monitoring.grafana?? && monitoring.grafana.host?has_content>
ingress:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ extraEnv: |
- name: SCM_WEBAPP_INITIALPASSWORD
value: "${password}"

<#if remote?? && !remote>
service:
type: NodePort
</#if>


<#if host?has_content>
ingress:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
ui:
enabled: true
externalPort: 80
<#if config.application.remote>
serviceType: LoadBalancer
<#else>
serviceType: ClusterIP
</#if>
injector:
injector:
enabled: false
<#if config.registry.createImagePullSecrets == true>
global:
Expand Down
4 changes: 0 additions & 4 deletions docs/configuration.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@
"type" : [ "boolean", "null" ],
"description" : "Write kubernetes resource requests and limits on each pod"
},
"remote" : {
"type" : [ "boolean", "null" ],
"description" : "Expose services as LoadBalancers"
},
"skipCrds" : {
"type" : [ "boolean", "null" ],
"description" : "Skip installation of CRDs. This requires prior installation of CRDs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extraEnv: |
value: Europe/Berlin

service:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP

ingress:
enabled: <#if config.features.exampleApps.petclinic.baseDomain?has_content>true<#else>false</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: spring-petclinic-plain
spec:
type: <#if config.application.remote>LoadBalancer<#else>NodePort</#if>
type: NodePort
ports:
- name: http
port: 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: spring-petclinic-plain
spec:
type: <#if config.application.remote>LoadBalancer<#else>NodePort</#if>
type: NodePort
ports:
- name: http
port: 80
Expand Down
7 changes: 3 additions & 4 deletions docs/gke.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ gcloud container clusters get-credentials ${cluster_name} --zone ${gce_location}

Now you're ready to apply the apps to the cluster.

Note that to be able to access the services remotely you either need to pass the
* `--remote` flag (exposes alls services as `LoadBalancer` with external IP) or
* `--ingress --base-url=$yourdomain` and either set a DNS record or `/etc/hosts` entries to the external IP of the
ingress-nginx service.
Note that to be able to access the services remotely you need to pass the
`--ingress --base-url=$yourdomain` and either set a DNS record or `/etc/hosts` entries to the external IP of the
ingress service.

##### Clean up

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ global:
service:
ports:
http: 80
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
# We don't use staticSiteConfigmap, so this is extensible for our secret example. See ArgoCD.groovy
extraVolumes:
- name: index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extraEnv: |
value: Europe/Berlin

service:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP

ingress:
enabled: <#if config.content.variables.petclinic.baseDomain?has_content>true<#else>false</#if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: spring-petclinic-plain
spec:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
ports:
- name: http
port: 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: spring-petclinic-plain
spec:
type: <#if config.application.remote>LoadBalancer<#else>ClusterIP</#if>
type: ClusterIP
ports:
- name: http
port: 80
Expand Down
7 changes: 0 additions & 7 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,4 @@ function setExternalHostnameIfNecessary() {
local variablePrefix="$1"
local serviceName="$2"
local namespace="$3"

if [[ $REMOTE_CLUSTER == true ]]; then
# Update SCMM_URL or JENKINS_URL
# Only if apps are not external
# Our apps are configured to use port 80 on remote clusters
declare -g "${variablePrefix}_URL"="http://$(getExternalIP "${serviceName}" "${namespace}")"
fi
}
6 changes: 2 additions & 4 deletions src/main/groovy/com/cloudogu/gitops/config/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper
import groovy.transform.CompileStatic
import groovy.transform.MapConstructor
import jakarta.inject.Singleton
import picocli.CommandLine.Command
Expand Down Expand Up @@ -45,6 +46,7 @@ import static picocli.CommandLine.ScopeType
@Singleton
@MapConstructor(noArg = true, includeSuperProperties = true, includeFields = true)
@Command(name = BINARY_NAME, description = APP_DESCRIPTION)
@CompileStatic
class Config {

// When updating please also update in Dockerfile
Expand Down Expand Up @@ -333,10 +335,6 @@ class Config {
@Option(names = ["-h", "--help"], usageHelp = true, description = "Display this help message")
Boolean usageHelpRequested = false

@Option(names = ['--remote'], description = REMOTE_DESCRIPTION)
@JsonPropertyDescription(REMOTE_DESCRIPTION)
Boolean remote = false

@Option(names = ['--insecure'], description = INSECURE_DESCRIPTION)
@JsonPropertyDescription(INSECURE_DESCRIPTION)
Boolean insecure = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ interface ConfigConstants {
String MULTITENANT_DESCRIPTION = 'Multi Tenant Configs'

// group remote
String REMOTE_DESCRIPTION = 'Expose services as LoadBalancers'
String INSECURE_DESCRIPTION = 'Sets insecure-mode in cURL which skips cert validation'

// group tool configuration
Expand Down
2 changes: 0 additions & 2 deletions src/main/groovy/com/cloudogu/gitops/features/Jenkins.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ class Jenkins extends Feature {
JENKINS_URL : config.jenkins.url,
JENKINS_USERNAME : config.jenkins.username,
JENKINS_PASSWORD : config.jenkins.password,
// Used indirectly in utils.sh 😬
REMOTE_CLUSTER : config.application.remote,
SCM_URL : this.gitHandler.tenant.url,
PREFIXED_SCM_URL : this.gitHandler.tenant.repoPrefix(),
SCM_PASSWORD : this.gitHandler.tenant.credentials.password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class ScmManagerSetup {

def templatedMap = TemplatingEngine.templateToMap(HELM_VALUES_PATH, [
host : this.scmManager.scmmConfig.ingress,
remote : this.scmManager.config.application.remote,
username : this.scmManager.scmmConfig.credentials.username,
password : this.scmManager.scmmConfig.credentials.password,
helm : this.scmManager.scmmConfig.helm,
Expand Down
10 changes: 0 additions & 10 deletions src/test/groovy/com/cloudogu/gitops/features/JenkinsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,8 @@ me:x:1000:''')
assertThat(parseActualYaml()['controller']['ingress']['hostName']).isEqualTo('jenkins.localhost')
}

@Test
void "service type LoadBalancer when run remotely"() {
config.application.remote = true
createJenkins().install()

assertThat(parseActualYaml()['controller']['serviceType']).isEqualTo('LoadBalancer')
}

@Test
void 'Maps config properly'() {
config.application.remote = true
config.application.trace = true
config.features.argocd.active = true
config.content.examples = true
Expand Down Expand Up @@ -207,7 +198,6 @@ me:x:1000:''')
assertThat(env['JENKINS_USERNAME']).isEqualTo('jenusr')
assertThat(env['JENKINS_PASSWORD']).isEqualTo('jenpw')
assertThat(env['JENKINS_USERNAME']).isEqualTo('jenusr')
assertThat(env['REMOTE_CLUSTER']).isEqualTo('true')
assertThat(env['NAME_PREFIX']).isEqualTo('my-prefix-')
assertThat(env['INSECURE']).isEqualTo('false')

Expand Down
16 changes: 0 additions & 16 deletions src/test/groovy/com/cloudogu/gitops/features/MailTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,6 @@ class MailTest {
assertThat(temporaryYamlFile).isNull()
}

@Test
void 'service type LoadBalancer when run remotely'() {
config.application.remote = true
createMail().install()

assertThat(parseActualYaml()['service']['type']).isEqualTo('LoadBalancer')
}

@Test
void 'service type ClusterIP when not run remotely'() {
config.application.remote = false
createMail().install()

assertThat(parseActualYaml()['service']['type']).isEqualTo('ClusterIP')
}

@Test
void 'uses ingress if enabled'() {
config.features.mail.mailUrl = 'http://mail.local'
Expand Down
18 changes: 0 additions & 18 deletions src/test/groovy/com/cloudogu/gitops/features/MonitoringTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class MonitoringTest {
application: [
username : 'abc',
password : '123',
remote : false,
openshift : false,
namePrefix : 'foo-',
mirrorRepos : false,
Expand Down Expand Up @@ -265,15 +264,6 @@ policies:
assertThat(contactPointsYaml['grafana']['alerting']).isNull()
}

@Test
void "service type LoadBalancer when run remotely"() {
config.application.remote = true
createStack(scmManagerMock).install()

assertThat(parseActualYaml()['grafana']['service']['type']).isEqualTo('LoadBalancer')
assertThat(parseActualYaml()['grafana']['service']['nodePort']).isNull()
}

@Test
void "configures admin user if requested"() {
config.application.username = "my-user"
Expand All @@ -284,14 +274,6 @@ policies:
assertThat(parseActualYaml()['grafana']['adminPassword']).isEqualTo('hunter2')
}

@Test
void 'service type ClusterIP when not run remotely'() {
config.application.remote = false
createStack(scmManagerMock).install()

assertThat(parseActualYaml()['grafana']['service']['type']).isEqualTo('ClusterIP')
}

@Test
void 'uses ingress if enabled'() {
config.features.monitoring.grafanaUrl = 'http://grafana.local'
Expand Down
16 changes: 0 additions & 16 deletions src/test/groovy/com/cloudogu/gitops/features/VaultTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ class VaultTest {
assertThat(k8sClient.commandExecutorForTest.actualCommands).isEmpty()
}

@Test
void 'when not run remotely, set type ClusterIP'() {
createVault().install()

assertThat(parseActualYaml()['ui']['serviceType']).isEqualTo('ClusterIP')
}

@Test
void 'when run remotely, use service type loadbalancer'() {
config.application.remote = true
createVault().install()

assertThat(parseActualYaml()['ui']['serviceType']).isEqualTo('LoadBalancer')
assertThat(parseActualYaml()['ui'] as Map).doesNotContainKey('serviceNodePort')
}

@Test
void 'uses ingress if enabled'() {
config.features.secrets.vault.url = 'http://vault.local'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ArgoCDTest {
Config config = Config.fromMap(
application: [
openshift : false,
remote : false,
insecure : false,
password : '123',
username : 'something',
Expand Down Expand Up @@ -194,34 +193,6 @@ class ArgoCDTest {
.isIn('apps/argocd/argocd', 'apps/argocd/argocd/')
}

@Test
void 'Installs argoCD for remote and external Scmm'() {
config.application.remote = true
config.scm.scmManager.internal = false
config.scm.scmManager.url = "https://abc"
config.features.argocd.url = 'https://argo.cd'
String scmmUrlInternal = "http://scmm.${config.application.namePrefix}scm-manager.svc.cluster.local/scm"

def argocd = createArgoCD()
argocd.install()
repoLayout = argocd.repoLayout()
// check values.yaml
List filesWithInternalSCMM = findFilesContaining(
new File(repoLayout.rootDir()),
scmmUrlInternal
)
assertThat(filesWithInternalSCMM).isEmpty()
List filesWithExternalSCMM = findFilesContaining(new File(repoLayout.rootDir()), "https://abc")
assertThat(filesWithExternalSCMM).isNotEmpty()

this.actualHelmValuesFile = "${repoLayout.helmDir()}/values.yaml"
def valuesYaml = parseActualYaml(actualHelmValuesFile)
assertThat(valuesYaml['argo-cd']['server']['service']['type']).isEqualTo('LoadBalancer')
assertThat(valuesYaml['argo-cd']['notifications']['argocdUrl']).isEqualTo('https://argo.cd')
assertThat(valuesYaml['argo-cd']['server']['ingress']['enabled']).isEqualTo(true)
assertThat(valuesYaml['argo-cd']['server']['ingress']['hostname']).isEqualTo('argo.cd')
}

@Test
void 'Installs Argo CD with custom values'() {
config.features.argocd.values = ['argo-cd': [key: 'value']]
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/testMainConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ scm:
repoURL: "https://packages.scm-manager.org/repository/helm-v2-releases/"
version: "3.2.1"
application:
remote: false
insecure: false
openshift: false
username: "admin"
Expand Down