Skip to content

Commit

Permalink
Merge pull request #530 from jorgemoralespou/lookup-svc-2
Browse files Browse the repository at this point in the history
Lookup service configuration.
  • Loading branch information
GrahamDumpleton authored Aug 8, 2024
2 parents 5a538c1 + 4e75876 commit 66e432e
Show file tree
Hide file tree
Showing 129 changed files with 2,210 additions and 46,204 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-and-publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ jobs:
infraProvider: custom
cert-manager:
enabled: true
settings: {}
external-dns:
enabled: true
settings:
Expand All @@ -541,6 +542,7 @@ jobs:
ca.key: "BB"
kyverno:
enabled: true
settings: {}
educates:
enabled: true
settings:
Expand All @@ -550,6 +552,8 @@ jobs:
host: "ghcr.io"
namespace: ${{env.REPOSITORY_OWNER}}
version: ${{env.REPOSITORY_TAG}}
lookupService:
enabled: true
EOF
- name: Publish educates-installer bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ workshopAnalytics:
websiteStyling:
#@overlay/remove
imagePuller:
#@overlay/remove
lookupService:
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("functions.star", "isClusterPackageEnableByDefault")

#! This file contains default values for the custom infrastructure provider.
#! These are the values that will be set if not overridden by the user.
Expand All @@ -8,23 +9,23 @@
#@overlay/replace
clusterPackages:
contour:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("contour")
settings: {}
cert-manager:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("cert-manager")
settings: {}
external-dns:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("external-dns")
settings: {}
certs:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("certs")
settings: {}
kyverno:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("kyverno")
settings: {}
kapp-controller:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("kapp-controller")
settings: {}
educates:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("educates")
settings: {}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("educates.lib.yaml", "copy_all_educates_values")

#! This copies user provided values for the custom infrastructure provider.
#! This enables packages based on the user input

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
Expand All @@ -27,4 +26,3 @@ clusterPackages:
educates:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "educates") and hasattr(data.values.clusterPackages.educates, "enabled"):
enabled: #@ data.values.clusterPackages.educates.enabled
settings: #@ copy_all_educates_values()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("educates.lib.yaml", "copy_all_educates_values")

#! This copies user provided values for the custom infrastructure provider.

#! #@overlay/match-child-defaults missing_ok=True
#! clusterPackages:
#! educates:
#! settings: #@ copy_all_educates_values()
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
contour:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "contour") and hasattr(data.values.clusterPackages.contour, "settings"):
settings: #@ data.values.clusterPackages.contour.settings
cert-manager:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "cert-manager") and hasattr(data.values.clusterPackages["cert-manager"], "settings"):
settings: #@ data.values.clusterPackages["cert-manager"].settings
external-dns:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "external-dns") and hasattr(data.values.clusterPackages["external-dns"], "settings"):
settings: #@ data.values.clusterPackages["external-dns"].settings
certs:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "certs") and hasattr(data.values.clusterPackages.certs, "settings"):
settings: #@ data.values.clusterPackages.certs.settings
kyverno:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "kyverno") and hasattr(data.values.clusterPackages.kyverno, "settings"):
settings: #@ data.values.clusterPackages.kyverno.settings
kapp-controller:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "kapp-controller") and hasattr(data.values.clusterPackages["kapp-controller"], "settings"):
settings: #@ data.values.clusterPackages["kapp-controller"].settings
educates:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "educates") and hasattr(data.values.clusterPackages["educates"], "settings"):
settings: #@ data.values.clusterPackages["educates"].settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("functions.star", "isClusterPackageExplicitDisabled")

#! This removes settings for disabled packages

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
contour:
#@ if/end isClusterPackageExplicitDisabled("contour"):
#@overlay/replace
settings: {}
cert-manager:
#@ if/end isClusterPackageExplicitDisabled("cert-manager"):
#@overlay/replace
settings: {}
external-dns:
#@ if/end isClusterPackageExplicitDisabled("external-dns"):
#@overlay/replace
settings: {}
certs:
#@ if/end isClusterPackageExplicitDisabled("certs"):
#@overlay/replace
settings: {}
kyverno:
#@ if/end isClusterPackageExplicitDisabled("kyverno"):
#@overlay/replace
settings: {}
kapp-controller:
#@ if/end isClusterPackageExplicitDisabled("kapp-controller"):
#@overlay/replace
settings: {}
educates:
#@ if/end isClusterPackageExplicitDisabled("educates"):
#@overlay/replace
settings: {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Custom
For custom we only accept the clusterPackages configuration.
All the other configuration will be discarded.
There's no default configuration being applied.
There's no default configuration being applied.
Whatever main config is provided it will be discarded
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@ytt:data", "data")

enabledByDefaultPackagesList = [
]
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,16 @@ websiteStyling:
#@ if/end hasattr(data.values.websiteStyling, "frameAncestors") and data.values.websiteStyling.frameAncestors != None:
frameAncestors: #@ data.values.websiteStyling.frameAncestors
#@ if/end hasattr(data.values, "imagePuller") and data.values.imagePuller != None:
imagePuller: #@ data.values.imagePuller
imagePuller:
enabled: #@ data.values.imagePuller.enabled
#@ if hasattr(data.values.imagePuller, "prePullImages") and data.values.imagePuller.prePullImages != None:
#@overlay/replace
prePullImages: #@ data.values.imagePuller.prePullImages
#@ end
#@ if/end hasattr(data.values, "lookupService") and data.values.lookupService != None:
lookupService:
#@ if/end hasattr(data.values.lookupService, "enabled") and data.values.lookupService.enabled != None:
enabled: #@ data.values.lookupService.enabled
#@ if/end hasattr(data.values.lookupService, "ingressPrefix") and data.values.lookupService.ingressPrefix != None:
ingressPrefix: #@ data.values.lookupService.ingressPrefix
#@ end
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@ytt:data", "data")
load("defaults.star", "enabledByDefaultPackagesList")

def isClusterPackageEnableByDefault(package):
return package in enabledByDefaultPackagesList
end

def isClusterPackageEnabled(package):
if hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, package) and hasattr(data.values.clusterPackages[package], "enabled"):
return data.values.clusterPackages[package].enabled
else:
return package in enabledByDefaultPackagesList
end
end

def isClusterPackageExplicitDisabled(package):
return not isClusterPackageEnabled(package)
end
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ workshopAnalytics:
websiteStyling:
#@overlay/remove
imagePuller:
#@overlay/remove
lookupService:
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:assert", "assert")
#@ load("functions.star", "isClusterPackageEnableByDefault", "xgetattr")

#@ (hasIrsaRoleExternalDns, _) = assert.try_to(lambda: len(data.values["clusterInfrastructure"]["aws"]["irsaRoles"]["external-dns"]) > 0)
#@ if hasIrsaRoleExternalDns:
Expand All @@ -21,7 +22,7 @@
#@overlay/replace
clusterPackages:
contour:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("contour")
settings:
infraProvider: aws
configFileContents:
Expand All @@ -33,13 +34,13 @@ clusterPackages:
domains:
- #@ data.values.clusterIngress.domain
cert-manager:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("cert-manager")
settings:
serviceaccount:
annotations:
eks.amazonaws.com/role-arn: #@ certManagerIrsaRole
external-dns:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("external-dns")
settings:
infraProvider: aws
serviceaccount:
Expand All @@ -50,25 +51,21 @@ clusterPackages:
domain_filter: #@ data.values.clusterInfrastructure.aws.route53.hostedZone if hasattr(data.values.clusterInfrastructure.aws.route53, "hostedZone") else data.values.clusterIngress.domain
txt_owner_id: "educates"
certs:
enabled: true
enabled: #@ isClusterPackageEnableByDefault("certs")
settings:
certProvider: acme-aws
domains:
- #@ data.values.clusterIngress.domain
- #@ data.values.clusterIngress.domain
acme:
aws:
certs:
region: #@ data.values.clusterInfrastructure.aws.region
kyverno:
enabled: #@ data.values.clusterSecurity.policyEngine == "kyverno"
enabled: #@ isClusterPackageEnableByDefault("kyverno")
settings: {}
kapp-controller:
enabled: false
enabled: #@ isClusterPackageEnableByDefault("kapp-controller")
settings: {}
educates:
enabled: true
settings:
clusterIngress:
tlsCertificateRef:
namespace: projectcontour
name: educateswildcard
enabled: #@ isClusterPackageEnableByDefault("educates")
settings: #@ xgetattr(data.values, "clusterPackages.educates.settings")
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#@ load("@ytt:overlay", "overlay")

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
educates:
settings:
clusterIngress:
tlsCertificateRef:
namespace: projectcontour
name: educateswildcard
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("educates.lib.yaml", "copy_all_educates_values")

#! This copies user provided values for the custom infrastructure provider.
#! This enables packages based on the user input

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
Expand All @@ -27,4 +26,3 @@ clusterPackages:
educates:
#@ if/end hasattr(data.values, "clusterPackages") and hasattr(data.values.clusterPackages, "educates") and hasattr(data.values.clusterPackages.educates, "enabled"):
enabled: #@ data.values.clusterPackages.educates.enabled
settings: #@ copy_all_educates_values()
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#@ load("@ytt:overlay", "overlay")
#@ load("educates.lib.yaml", "copy_all_educates_values")

#! This copies user provided values for the custom infrastructure provider.

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
educates:
settings: #@ copy_all_educates_values()

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("functions.star", "isClusterPackageExplicitDisabled")

#! This removes settings for disabled packages

#@overlay/match-child-defaults missing_ok=True
clusterPackages:
contour:
#@ if/end isClusterPackageExplicitDisabled("contour"):
#@overlay/replace
settings: {}
cert-manager:
#@ if/end isClusterPackageExplicitDisabled("cert-manager"):
#@overlay/replace
settings: {}
external-dns:
#@ if/end isClusterPackageExplicitDisabled("external-dns"):
#@overlay/replace
settings: {}
certs:
#@ if/end isClusterPackageExplicitDisabled("certs"):
#@overlay/replace
settings: {}
kyverno:
#@ if/end isClusterPackageExplicitDisabled("kyverno"):
#@overlay/replace
settings: {}
kapp-controller:
#@ if/end isClusterPackageExplicitDisabled("kapp-controller"):
#@overlay/replace
settings: {}
#! educates:
#! #@ if/end isClusterPackageExplicitDisabled("educates"):
#! #@overlay/replace
#! settings: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@ytt:data", "data")

enabledByDefaultPackagesList = [
"cert-manager",
"contour",
"external-dns",
"certs",
"kyverno",
"educates"
]
Loading

0 comments on commit 66e432e

Please sign in to comment.