-
Notifications
You must be signed in to change notification settings - Fork 0
Home
How can I check if my manifest is correct when I have different input parameters for the chart?
console.log() gives no output when called inside an addDeployment()
function.
How do you log? Is there a right way?
Answer: ts-node src/main.ts
Can we get the source mappings from somewhere to look up implementation?
Answer: actual source code is not available but exceptions and errors should be linked to source
we were looking at the definition of the constructor to find out how to use it:
export class KubeDaemonSet extends ApiObject {
// some stuff
public constructor(scope: Construct, id: string, props: KubeDaemonSetProps = {}) {
super(scope, id, {
...KubeDaemonSet.GVK,
...props,
});
}
// some more stuff
}
but we tried this:
private addDaemonset() {
// doing some stuff here
new KubeDaemonSet(this.scope, 'node-exporter', {
// specs and template
});
}
but we needed this:
private addDaemonset() {
// doing some stuff here
new KubeDaemonSet(this, 'node-exporter', {
// specs and template
});
}
tl;dr: we passed an object to the constructor that we thought it expected but it didn't and it didn't tell us.
- SecurityContexts
- Resources / Limits
Update 2022-02-23
targetPort
does not support Strings but Strings are valid according to K8s docs.
Port definitions in Pods have names, and you can reference these names in the
targetPort
attribute of a Service.
https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
Problem encountered in this manifest: https://github.com/prometheus-operator/kube-prometheus/blob/main/manifests/kubeStateMetrics-service.yaml
Same Manifest has another unexpected behaviour. type:
defaults to ClusterIP
and therefore is not written in the original manifest file. cdk8s does generate it though. How is cdk8s handling defaults? When do they get generated and when not?
Update 2022-03-03
Can't seem to be able to add automountServiceAccountToken: false
to a service account in cdk8s plus, encountered in https://github.com/prometheus-operator/kube-prometheus/blob/main/manifests/nodeExporter-serviceAccount.yaml
cdk8s import
for multiple files with the same group does not seem to work properly or only "inconvenient".
I tried to import *CustomResourceDefinition.yaml
files from https://github.com/prometheus-operator/kube-prometheus/tree/main/manifests/setup.
❯ cdk8s import --language typescript ../../../prometheus-operator/kube-prometheus/manifests/setup/*CustomResourceDefinition.yaml
Importing resources, this may take a few moments...
monitoring.coreos.com
monitoring.coreos.com/alertmanagerconfig
Also importing the YAML files one by one always overwrote the generated monitoring.coreos.com.ts
file.
I had to make a multi manifest file first:
~/src/github.com/prometheus-operator/kube-prometheus/manifests/setup on main
❯ for f in `ls -1 *CustomRe*`; do cat $f >> all.yaml; echo "---" >> all.yaml; done
~/src/github.com/prometheus-operator/kube-prometheus/manifests/setup on main ?1
❯ -
~/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/src
~/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/src on main ?1
❯ cdk8s import --language typescript ../../../prometheus-operator/kube-prometheus/manifests/setup/all.yaml
Importing resources, this may take a few moments...
monitoring.coreos.com
monitoring.coreos.com/alertmanager
monitoring.coreos.com/alertmanagerconfig
monitoring.coreos.com/podmonitor
monitoring.coreos.com/probe
monitoring.coreos.com/prometheus
monitoring.coreos.com/prometheusrule
monitoring.coreos.com/servicemonitor
monitoring.coreos.com/thanosruler
EDIT: does not seem to work since i get an error:
~/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/src on main +2 !1 ?1
❯ npm run synth
> [email protected] synth
> npx projen synth
👾 synth | cdk8s synth
------------------------------------------------------------------------------------------------
A new version 1.0.120 of cdk8s-cli is available (current 1.0.89).
Run "npm install -g cdk8s-cli" to install the latest version on your system.
For additional installation methods, see https://cdk8s.io/docs/latest/getting-started
------------------------------------------------------------------------------------------------
/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:750
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14061,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14063,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14065,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14077,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14079,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(14081,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15787,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15789,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
src/imports/monitoring.coreos.com.ts(15791,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.
at createTSError (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:750:12)
at reportTSError (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:754:19)
at getOutput (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:941:36)
at Object.compile (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:1243:30)
at Module.m._compile (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19) {
diagnosticText: "src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14061,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14063,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14059,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14065,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14077,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14079,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14075,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(14081,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15787,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15789,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15785,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n" +
"src/imports/monitoring.coreos.com.ts(15791,3): error TS2300: Duplicate identifier 'STRIPPED_BY_CDK8S'.\n",
diagnosticCodes: [
2300, 2300, 2300, 2300,
2300, 2300, 2300, 2300,
2300, 2300, 2300, 2300,
2300, 2300, 2300, 2300,
2300, 2300
]
}
Error: command "ts-node src/main.ts " at /Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus returned a non-zero exit code 1
at ChildProcess.<anonymous> (/Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus/node_modules/cdk8s-cli/lib/util.js:46:27)
at Object.onceWrapper (node:events:642:26)
at ChildProcess.emit (node:events:527:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
👾 Task "synth" failed when executing "cdk8s synth" (cwd: /Users/d.aberger/src/github.com/Liquid-Reply/cdk8s-kube-prometheus)
When imported as single YAML it works...
How is this supposed to work with multiple CRDs?