Skip to content

Commit

Permalink
Simplify version extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
pbochynski committed Nov 15, 2023
1 parent 0d9e478 commit f4366ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 51 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ kubectl proxy -w='.'
Open Web UI with this link: [http://127.0.0.1:8001/static/kyma.html](http://127.0.0.1:8001/static/kyma.html)


## Architecture

## Contribute your module

Checkout the community-modules repository and add your own module by adding an entry in the [channels.json](app/channels.json) file. Example:
Expand All @@ -33,6 +31,8 @@ Checkout the community-modules repository and add your own module by adding an e
"name": "api-gateway",
"deploymentYaml": "https://github.com/kyma-project/api-gateway/releases/latest/download/api-gateway-manager.yaml",
"crYaml": "https://github.com/kyma-project/api-gateway/releases/latest/download/apigateway-default-cr.yaml",
"documentation": "https://kyma-project.io/#/api-gateway/user/README",
"repository": "https://github.com/kyma-project/api-gateway.git",
"managedResources": [
"/apis/operator.kyma-project.io/v1alpha1/apigateways",
"/apis/gateway.kyma-project.io/v1beta1/apirules"
Expand All @@ -43,6 +43,8 @@ Mandatory fields:
- **name** - name of your module (keep it short)
- **deploymentYaml** - URL of your module deployment YAML (usually the artifact of your module release)
- **crYaml** - URL of your module default configuration (custom resource)
- **documentatio** - documentation URL
- **repository** - main source code repository
- **managedResources** - list of api server resources (paths) that are managed by your module (including the configuration resource)

The channels.json file is processed by the build process and generates release channels files (right now only latest release is generated: [https://kyma-project.github.io/community-modules/latest.json](https://kyma-project.github.io/community-modules/latest.json)
Expand Down
44 changes: 7 additions & 37 deletions app/channels.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"crYaml": "https://github.com/kyma-project/istio/releases/latest/download/istio-default-cr.yaml",
"documentation": "https://kyma-project.io/#/istio/user/00-overview/README",
"repository": "https://github.com/kyma-project/istio.git",
"managerSelector": {
"app.kubernetes.io/component": "istio-operator.kyma-project.io"
},
"managedResources": [
"/apis/extensions.istio.io/v1alpha1/wasmplugins",
"/apis/install.istio.io/v1alpha1/istiooperators",
Expand Down Expand Up @@ -49,10 +46,7 @@
"managedResources": [
"/apis/operator.kyma-project.io/v1alpha1/apigateways",
"/apis/gateway.kyma-project.io/v1beta1/apirules"
],
"managerSelector": {
"app.kubernetes.io/component": "api-gateway-operator.kyma-project.io"
}
]
},
{
"name": "serverless",
Expand All @@ -63,10 +57,7 @@
"managedResources": [
"/apis/serverless.kyma-project.io/v1alpha2/functions",
"/apis/operator.kyma-project.io/v1alpha1/serverlesses"
],
"managerSelector": {
"app.kubernetes.io/component": "serverless-operator.kyma-project.io"
}
]
},
{
"name": "btp-operator",
Expand Down Expand Up @@ -96,10 +87,7 @@
"/apis/telemetry.kyma-project.io/v1alpha1/logparsers",
"/apis/telemetry.kyma-project.io/v1alpha1/logpipelines",
"/apis/telemetry.kyma-project.io/v1alpha1/tracepipelines"
],
"managerSelector": {
"app.kubernetes.io/instance": "telemetry"
}
]
},
{
"name": "nats",
Expand All @@ -109,10 +97,7 @@
"repository": "https://github.com/kyma-project/nats-manager.git",
"managedResources": [
"/apis/operator.kyma-project.io/v1alpha1/nats"
],
"managerSelector": {
"control-plane": "manager"
}
]
},
{
"name": "eventing",
Expand All @@ -124,10 +109,7 @@
"/apis/eventing.kyma-project.io/v1alpha1/subscriptions",
"/apis/eventing.kyma-project.io/v1alpha2/subscriptions",
"/apis/operator.kyma-project.io/v1alpha1/eventings"
],
"managerSelector": {
"app.kubernetes.io/component": "eventing-manager"
}
]
},
{
"name": "application-connector",
Expand All @@ -137,10 +119,7 @@
"repository": "https://github.com/kyma-project/application-connector-manager.git",
"managedResources": [
"/apis/operator.kyma-project.io/v1alpha1/applicationconnectors"
],
"managerSelector": {
"control-plane": "controller-manager"
}
]
},
{
"name": "keda",
Expand All @@ -154,10 +133,7 @@
"/apis/keda.sh/v1alpha1/scaledjobs",
"/apis/keda.sh/v1alpha1/scaledobjects",
"/apis/keda.sh/v1alpha1/triggerauthentications"
],
"managerSelector": {
"app.kubernetes.io/component": "keda-manager.kyma-project.io"
}
]
},
{
"name": "cap-operator",
Expand All @@ -168,9 +144,6 @@
"managedResources": [
"/apis/operator.sme.sap.com/v1alpha1/capoperators"
],
"managerSelector": {
"app.kubernetes.io/component": "cap-operator.sme.sap.com"
},
"community": true
},
{
Expand All @@ -180,9 +153,6 @@
"documentation": "https://github.com/pbochynski/cluster-ip#readme",
"repository": "https://github.com/pbochynski/cluster-ip.git",
"managedResources": [],
"managerSelector": {
"app.kubernetes.io/component": "cluster-ip.kyma-project.io"
},
"community": true
}
]
Expand Down
20 changes: 8 additions & 12 deletions script/release-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ async function loadModules(modules) {
m.resources = []
jsyaml.loadAll(body, (doc) => {
m.resources.push({ resource: doc })
if (doc.kind == 'Deployment' && m.managerSelector) {
let labels = doc.spec.template.metadata.labels
let miss = Object.keys(m.managerSelector).some(key => m.managerSelector[key]!=labels[key])
if (!miss) {
m.version='unknown'
for (let c of doc.spec.template.spec.containers) {
m.version=c.image
}
if (doc.kind == 'Deployment' && m.managerSelector) {
m.version = 'unknown'
for (let c of doc.spec.template.spec.containers) {
m.version = c.image
}
}
});
Expand All @@ -26,15 +22,15 @@ async function loadModules(modules) {
response = await fetch(url)
body = await response.text()
m.cr = { resource: jsyaml.load(body) }
m.cr.resource.metadata.namespace='kyma-system'
m.cr.resource.metadata.namespace = 'kyma-system'
}
}

async function releaseChannels(){
for(let ch of channels) {
async function releaseChannels() {
for (let ch of channels) {
await loadModules(ch.modules)
console.log("channel loaded")
fs.writeFileSync(`${ch.name}.json`,JSON.stringify(ch.modules,null,2))
fs.writeFileSync(`${ch.name}.json`, JSON.stringify(ch.modules, null, 2))
console.log("channel written")
}
}
Expand Down

0 comments on commit f4366ca

Please sign in to comment.