support helm repo secret (#1943)

This commit is contained in:
chival
2021-07-21 14:52:43 +08:00
committed by GitHub
parent 5e064219e7
commit 0b46895211
3 changed files with 13 additions and 7 deletions

View File

@@ -4488,7 +4488,7 @@ data:
spec:
schematic:
cue:
template: "output: {\n\tapiVersion: \"source.toolkit.fluxcd.io/v1beta1\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tif parameter.repoType == \"git\" {\n\t\tkind: \"GitRepository\"\n\t\tspec: {\n\t\t\turl: parameter.repoUrl\n\t\t\tref:\n\t\t\t\tbranch: parameter.branch\n\t\t\tinterval: parameter.pullInterval\n\t\t}\n\t}\n\tif parameter.repoType == \"helm\" {\n\t\tkind: \"HelmRepository\"\n\t\tspec: {\n\t\t\tinterval: parameter.pullInterval\n\t\t\turl: parameter.repoUrl\n\t\t}\n\t}\n}\n\noutputs: release: {\n\tapiVersion: \"helm.toolkit.fluxcd.io/v2beta1\"\n\tkind: \"HelmRelease\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tspec: {\n\t\tinterval: parameter.pullInterval\n\t\tchart: {\n\t\t\tspec: {\n\t\t\t\tchart: parameter.chart\n\t\t\t\tsourceRef: {\n\t\t\t\t\tif parameter.repoType == \"git\" {\n\t\t\t\t\t\tkind: \"GitRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.repoType == \"helm\" {\n\t\t\t\t\t\tkind: \"HelmRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tname: context.name\n\t\t\t\t\tnamespace: context.namespace\n\t\t\t\t}\n\t\t\t\tinterval: parameter.pullInterval\n\t\t\t}\n\t\t}\n\t}\n}\n\nparameter: {\n\trepoType: \"git\" | \"helm\"\n\t//+usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.\n\trepoUrl: string\n\t//+usage=The interval at which to check for repository and relese updates.\n\tpullInterval: *\"5m\" | string\n\t//+usage=1.The relative path to helm chart for git source. 2. chart name for helm resource\n\tchart: string\n //+usage=The Git reference to checkout and monitor for changes, defaults to master branch.\n branch: *\"master\" | string\n}\n"
template: "output: {\n\tapiVersion: \"source.toolkit.fluxcd.io/v1beta1\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tif parameter.repoType == \"git\" {\n\t\tkind: \"GitRepository\"\n\t\tspec: {\n\t\t\turl: parameter.repoUrl\n\t\t\tref:\n\t\t\t\tbranch: parameter.branch\n\t\t\tinterval: parameter.pullInterval\n\t\t}\n\t}\n\tif parameter.repoType == \"helm\" {\n\t\tkind: \"HelmRepository\"\n\t\tspec: {\n\t\t\tinterval: parameter.pullInterval\n\t\t\turl: parameter.repoUrl\n\t\t\tif parameter.secretRef != _|_ {\n\t\t\t\tsecretRef: {\n\t\t\t\t\tname: parameter.secretRef\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\noutputs: release: {\n\tapiVersion: \"helm.toolkit.fluxcd.io/v2beta1\"\n\tkind: \"HelmRelease\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tspec: {\n\t\tinterval: parameter.pullInterval\n\t\tchart: {\n\t\t\tspec: {\n\t\t\t\tchart: parameter.chart\n\t\t\t\tsourceRef: {\n\t\t\t\t\tif parameter.repoType == \"git\" {\n\t\t\t\t\t\tkind: \"GitRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.repoType == \"helm\" {\n\t\t\t\t\t\tkind: \"HelmRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tname: context.name\n\t\t\t\t\tnamespace: context.namespace\n\t\t\t\t}\n\t\t\t\tinterval: parameter.pullInterval\n\t\t\t}\n\t\t}\n\t}\n}\n\nparameter: {\n\trepoType: \"git\" | \"helm\"\n\t// +usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.\n\trepoUrl: string\n\t// +usage=The interval at which to check for repository and relese updates.\n\tpullInterval: *\"5m\" | string\n\t// +usage=1.The relative path to helm chart for git source. 2. chart name for helm resource\n\tchart: string\n // +usage=The Git reference to checkout and monitor for changes, defaults to master branch.\n branch: *\"master\" | string\n // +usage=The name of the secret containing authentication credentials for the Helm repository.\n\tsecretRef?: string\n}\n"
workload:
type: autodetects.core.oam.dev
type: raw

View File

@@ -4485,7 +4485,7 @@ spec:
spec:
schematic:
cue:
template: "output: {\n\tapiVersion: \"source.toolkit.fluxcd.io/v1beta1\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tif parameter.repoType == \"git\" {\n\t\tkind: \"GitRepository\"\n\t\tspec: {\n\t\t\turl: parameter.repoUrl\n\t\t\tref:\n\t\t\t\tbranch: parameter.branch\n\t\t\tinterval: parameter.pullInterval\n\t\t}\n\t}\n\tif parameter.repoType == \"helm\" {\n\t\tkind: \"HelmRepository\"\n\t\tspec: {\n\t\t\tinterval: parameter.pullInterval\n\t\t\turl: parameter.repoUrl\n\t\t}\n\t}\n}\n\noutputs: release: {\n\tapiVersion: \"helm.toolkit.fluxcd.io/v2beta1\"\n\tkind: \"HelmRelease\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tspec: {\n\t\tinterval: parameter.pullInterval\n\t\tchart: {\n\t\t\tspec: {\n\t\t\t\tchart: parameter.chart\n\t\t\t\tsourceRef: {\n\t\t\t\t\tif parameter.repoType == \"git\" {\n\t\t\t\t\t\tkind: \"GitRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.repoType == \"helm\" {\n\t\t\t\t\t\tkind: \"HelmRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tname: context.name\n\t\t\t\t\tnamespace: context.namespace\n\t\t\t\t}\n\t\t\t\tinterval: parameter.pullInterval\n\t\t\t}\n\t\t}\n\t}\n}\n\nparameter: {\n\trepoType: \"git\" | \"helm\"\n\t//+usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.\n\trepoUrl: string\n\t//+usage=The interval at which to check for repository and relese updates.\n\tpullInterval: *\"5m\" | string\n\t//+usage=1.The relative path to helm chart for git source. 2. chart name for helm resource\n\tchart: string\n //+usage=The Git reference to checkout and monitor for changes, defaults to master branch.\n branch: *\"master\" | string\n}\n"
template: "output: {\n\tapiVersion: \"source.toolkit.fluxcd.io/v1beta1\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tif parameter.repoType == \"git\" {\n\t\tkind: \"GitRepository\"\n\t\tspec: {\n\t\t\turl: parameter.repoUrl\n\t\t\tref:\n\t\t\t\tbranch: parameter.branch\n\t\t\tinterval: parameter.pullInterval\n\t\t}\n\t}\n\tif parameter.repoType == \"helm\" {\n\t\tkind: \"HelmRepository\"\n\t\tspec: {\n\t\t\tinterval: parameter.pullInterval\n\t\t\turl: parameter.repoUrl\n\t\t\tif parameter.secretRef != _|_ {\n\t\t\t\tsecretRef: {\n\t\t\t\t\tname: parameter.secretRef\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\noutputs: release: {\n\tapiVersion: \"helm.toolkit.fluxcd.io/v2beta1\"\n\tkind: \"HelmRelease\"\n\tmetadata: {\n\t\tname: context.name\n\t}\n\tspec: {\n\t\tinterval: parameter.pullInterval\n\t\tchart: {\n\t\t\tspec: {\n\t\t\t\tchart: parameter.chart\n\t\t\t\tsourceRef: {\n\t\t\t\t\tif parameter.repoType == \"git\" {\n\t\t\t\t\t\tkind: \"GitRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.repoType == \"helm\" {\n\t\t\t\t\t\tkind: \"HelmRepository\"\n\t\t\t\t\t}\n\t\t\t\t\tname: context.name\n\t\t\t\t\tnamespace: context.namespace\n\t\t\t\t}\n\t\t\t\tinterval: parameter.pullInterval\n\t\t\t}\n\t\t}\n\t}\n}\n\nparameter: {\n\trepoType: \"git\" | \"helm\"\n\t// +usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.\n\trepoUrl: string\n\t// +usage=The interval at which to check for repository and relese updates.\n\tpullInterval: *\"5m\" | string\n\t// +usage=1.The relative path to helm chart for git source. 2. chart name for helm resource\n\tchart: string\n // +usage=The Git reference to checkout and monitor for changes, defaults to master branch.\n branch: *\"master\" | string\n // +usage=The name of the secret containing authentication credentials for the Helm repository.\n\tsecretRef?: string\n}\n"
workload:
type: autodetects.core.oam.dev
type: raw

View File

@@ -30,6 +30,11 @@ spec:
spec: {
interval: parameter.pullInterval
url: parameter.repoUrl
if parameter.secretRef != _|_ {
secretRef: {
name: parameter.secretRef
}
}
}
}
}
@@ -63,13 +68,14 @@ spec:
parameter: {
repoType: "git" | "helm"
//+usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.
// +usage=The Git or Helm repository URL, accept HTTP/S or SSH address as git url.
repoUrl: string
//+usage=The interval at which to check for repository and relese updates.
// +usage=The interval at which to check for repository and relese updates.
pullInterval: *"5m" | string
//+usage=1.The relative path to helm chart for git source. 2. chart name for helm resource
// +usage=1.The relative path to helm chart for git source. 2. chart name for helm resource
chart: string
//+usage=The Git reference to checkout and monitor for changes, defaults to master branch.
// +usage=The Git reference to checkout and monitor for changes, defaults to master branch.
branch: *"master" | string
// +usage=The name of the secret containing authentication credentials for the Helm repository.
secretRef?: string
}