Skip to content

Commit

Permalink
feat: Add knative-eventing, knative-serving and triggermesh CRDs (#387)
Browse files Browse the repository at this point in the history
* feat: Add knative-eventing and knative-serving CRDs

* fix: config errors

* feat: add mapContainers patch for service resource

* chore: add patch dir

* feat: add triggermesh CRDs

* feat: update workflow

---------

Co-authored-by: Giles Rapkin <[email protected]>
  • Loading branch information
gilesrapkin and Giles Rapkin authored Mar 19, 2024
1 parent 38a92f1 commit 81b00ff
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 0 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,86 @@
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
"if": "steps.filter.outputs.workflows == 'true'"
"run": "make libs/keda"
"knative-eventing":
"name": "Generate knative-eventing Jsonnet library and docs"
"needs":
- "build"
- "repos"
"runs-on": "ubuntu-latest"
"steps":
- "uses": "actions/checkout@v3"
- "id": "filter"
"uses": "dorny/paths-filter@v2"
"with":
"filters": |
workflows:
- '.github/**'
- 'bin/**'
- 'Dockerfile'
- 'go.mod'
- 'go.sum'
- 'jsonnet/**'
- 'main.go'
- 'Makefile'
- 'pkg/**'
- 'scripts/**'
- 'tf/**'
- 'libs/knative-eventing/**'
- "if": "steps.filter.outputs.workflows == 'true'"
"uses": "actions/download-artifact@v2"
"with":
"name": "docker-artifact"
"path": "artifacts"
- "if": "steps.filter.outputs.workflows == 'true'"
"run": "make load"
- "env":
"DIFF": "true"
"GEN_COMMIT": "${{ github.ref == 'refs/heads/master' && github.repository == 'jsonnet-libs/k8s' }}"
"GIT_COMMITTER_EMAIL": "[email protected]"
"GIT_COMMITTER_NAME": "jsonnet-libs-bot"
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
"if": "steps.filter.outputs.workflows == 'true'"
"run": "make libs/knative-eventing"
"knative-serving":
"name": "Generate knative-serving Jsonnet library and docs"
"needs":
- "build"
- "repos"
"runs-on": "ubuntu-latest"
"steps":
- "uses": "actions/checkout@v3"
- "id": "filter"
"uses": "dorny/paths-filter@v2"
"with":
"filters": |
workflows:
- '.github/**'
- 'bin/**'
- 'Dockerfile'
- 'go.mod'
- 'go.sum'
- 'jsonnet/**'
- 'main.go'
- 'Makefile'
- 'pkg/**'
- 'scripts/**'
- 'tf/**'
- 'libs/knative-serving/**'
- "if": "steps.filter.outputs.workflows == 'true'"
"uses": "actions/download-artifact@v2"
"with":
"name": "docker-artifact"
"path": "artifacts"
- "if": "steps.filter.outputs.workflows == 'true'"
"run": "make load"
- "env":
"DIFF": "true"
"GEN_COMMIT": "${{ github.ref == 'refs/heads/master' && github.repository == 'jsonnet-libs/k8s' }}"
"GIT_COMMITTER_EMAIL": "[email protected]"
"GIT_COMMITTER_NAME": "jsonnet-libs-bot"
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
"if": "steps.filter.outputs.workflows == 'true'"
"run": "make libs/knative-serving"
"kube-prometheus":
"name": "Generate kube-prometheus Jsonnet library and docs"
"needs":
Expand Down Expand Up @@ -2015,6 +2095,8 @@
- "k8s"
- "karpenter"
- "keda"
- "knative-eventing"
- "knative-serving"
- "kube-prometheus"
- "kubernetes-nmstate"
- "kubernetes-secret-generator"
Expand All @@ -2031,6 +2113,7 @@
- "strimzi"
- "teleport-operator"
- "traefik"
- "triggermesh"
- "vault-secrets-operator"
- "vertical-pod-autoscaler"
- "zalando-postgres-operator"
Expand Down Expand Up @@ -2268,6 +2351,46 @@
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
"if": "steps.filter.outputs.workflows == 'true'"
"run": "make libs/traefik"
"triggermesh":
"name": "Generate triggermesh Jsonnet library and docs"
"needs":
- "build"
- "repos"
"runs-on": "ubuntu-latest"
"steps":
- "uses": "actions/checkout@v3"
- "id": "filter"
"uses": "dorny/paths-filter@v2"
"with":
"filters": |
workflows:
- '.github/**'
- 'bin/**'
- 'Dockerfile'
- 'go.mod'
- 'go.sum'
- 'jsonnet/**'
- 'main.go'
- 'Makefile'
- 'pkg/**'
- 'scripts/**'
- 'tf/**'
- 'libs/triggermesh/**'
- "if": "steps.filter.outputs.workflows == 'true'"
"uses": "actions/download-artifact@v2"
"with":
"name": "docker-artifact"
"path": "artifacts"
- "if": "steps.filter.outputs.workflows == 'true'"
"run": "make load"
- "env":
"DIFF": "true"
"GEN_COMMIT": "${{ github.ref == 'refs/heads/master' && github.repository == 'jsonnet-libs/k8s' }}"
"GIT_COMMITTER_EMAIL": "[email protected]"
"GIT_COMMITTER_NAME": "jsonnet-libs-bot"
"SSH_KEY": "${{ secrets.DEPLOY_KEY }}"
"if": "steps.filter.outputs.workflows == 'true'"
"run": "make libs/triggermesh"
"vault-secrets-operator":
"name": "Generate vault-secrets-operator Jsonnet library and docs"
"needs":
Expand Down
16 changes: 16 additions & 0 deletions libs/knative-eventing/config.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local config = import 'jsonnet/config.jsonnet';

local versions = ['1.13.1', '1.12.4', '1.11.10'];

config.new(
name='knative-eventing',
specs=[
{
output: v,
crds: ['https://github.com/knative/eventing/releases/download/knative-v%s/eventing-crds.yaml' % v],
prefix: '^dev\\.knative\\..*',
localName: 'knative-eventing',
},
for v in versions
]
)
17 changes: 17 additions & 0 deletions libs/knative-serving/config.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local config = import 'jsonnet/config.jsonnet';

local versions = ['1.13.1', '1.12.3', '1.11.6'];

config.new(
name='knative-serving',
specs=[
{
output: v,
crds: ['https://github.com/knative/serving/releases/download/knative-v%s/serving-crds.yaml' % v],
prefix: '^dev\\.knative\\..*',
patchDir: 'custom/serving',
localName: 'knative-serving',
},
for v in versions
]
)
42 changes: 42 additions & 0 deletions libs/knative-serving/custom/serving/mapContainers.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
local d = import 'doc-util/main.libsonnet';

local patch = {
'#mapContainers': d.fn(
|||
`mapContainers` applies the function f to each container.
It works exactly as `std.map`, but on the containers of this object.
**Signature of `f`**:
```ts
f(container: Object) Object
```
|||,
[d.arg('f', d.T.func)]
),
mapContainers(f, includeInitContainers=false):: {
local podContainers = super.spec.template.spec.containers,
local podInitContainers = super.spec.template.spec.initContainers,
spec+: {
template+: {
spec+: {
containers: std.map(f, podContainers),
[if includeInitContainers then 'initContainers']: std.map(f, podInitContainers),
},
},
},
},

'#mapContainersWithName': d.fn('`mapContainersWithName` is like `mapContainers`, but only applies to those containers in the `names` array',
[d.arg('names', d.T.array), d.arg('f', d.T.func)]),
mapContainersWithName(names, f, includeInitContainers=false)::
local nameSet = if std.type(names) == 'array' then std.set(names) else std.set([names]);
local inNameSet(name) = std.length(std.setInter(nameSet, std.set([name]))) > 0;

self.mapContainers(function(c) if std.objectHas(c, 'name') && inNameSet(c.name) then f(c) else c, includeInitContainers),
};

{
serving+: { v1+: {
service+: patch,
} },
}
16 changes: 16 additions & 0 deletions libs/triggermesh/config.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local config = import 'jsonnet/config.jsonnet';

local versions = ['1.27.0'];

config.new(
name='triggermesh',
specs=[
{
output: v,
crds: ['https://github.com/triggermesh/triggermesh/releases/download/v%s/triggermesh-crds.yaml' % v],
prefix: '^io\\.triggermesh\\..*',
localName: 'triggermesh',
},
for v in versions
]
)

0 comments on commit 81b00ff

Please sign in to comment.