Skip to content

Commit 7bc7f30

Browse files
authored
add helm chart. (#5)
* add helm chart. Signed-off-by: morvencao <lcao@redhat.com> * add release workflow. Signed-off-by: morvencao <lcao@redhat.com> * update PAT TOKEN name. Signed-off-by: morvencao <lcao@redhat.com>
1 parent 971fccf commit 7bc7f30

10 files changed

Lines changed: 597 additions & 0 deletions

.github/workflows/go-release.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: GoRelease
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
env:
8+
# Common versions
9+
GO_VERSION: '1.17'
10+
GO_REQUIRED_MIN_VERSION: ''
11+
GOPATH: '/home/runner/work/multicluster-mesh-addon/go'
12+
GITHUB_REF: ${{ github.ref }}
13+
CHART_NAME: 'multicluster-mesh'
14+
15+
defaults:
16+
run:
17+
working-directory: go/src/open-cluster-management.io/multicluster-mesh-addon
18+
19+
jobs:
20+
env:
21+
name: prepare release env
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: checkout code
25+
uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 1
28+
path: go/src/open-cluster-management.io/multicluster-mesh-addon
29+
- name: get release version
30+
run: |
31+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
32+
- name: get major release version
33+
run: |
34+
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
35+
echo "TRIMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
36+
- name: verify chart version
37+
run: |
38+
cat ./charts/multicluster-mesh/Chart.yaml | grep -q 'version: ${{ env.TRIMED_RELEASE_VERSION }}'
39+
outputs:
40+
MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }}
41+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
42+
TRIMED_RELEASE_VERSION: ${{ env.TRIMED_RELEASE_VERSION }}
43+
images:
44+
name: images
45+
runs-on: ubuntu-latest
46+
needs: [ env ]
47+
strategy:
48+
matrix:
49+
arch: [ amd64, arm64 ]
50+
steps:
51+
- name: checkout code
52+
uses: actions/checkout@v2
53+
with:
54+
fetch-depth: 1
55+
path: go/src/open-cluster-management.io/multicluster-mesh-addon
56+
- name: install Go
57+
uses: actions/setup-go@v2
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
- name: install imagebuilder
61+
run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.1
62+
- name: pull base image
63+
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
64+
- name: images
65+
run: |
66+
IMAGE=quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \
67+
IMAGE_BUILD_EXTRA_FLAGS="--build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}" \
68+
make docker-build
69+
- name: push
70+
run: |
71+
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
72+
docker push quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
73+
image-manifest:
74+
name: image manifest
75+
runs-on: ubuntu-latest
76+
needs: [ env, images ]
77+
steps:
78+
- name: checkout code
79+
uses: actions/checkout@v2
80+
with:
81+
fetch-depth: 1
82+
path: go/src/open-cluster-management.io/multicluster-mesh-addon
83+
- name: create
84+
run: |
85+
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
86+
docker manifest create quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }} \
87+
quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
88+
quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
89+
- name: annotate
90+
run: |
91+
docker manifest annotate quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }} \
92+
quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
93+
docker manifest annotate quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }} \
94+
quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
95+
- name: push
96+
run: |
97+
docker manifest push quay.io/open-cluster-management/multicluster-mesh-addon:${{ needs.env.outputs.RELEASE_VERSION }}
98+
release:
99+
name: release
100+
runs-on: ubuntu-latest
101+
needs: [ env, image-manifest ]
102+
steps:
103+
- name: checkout code
104+
uses: actions/checkout@v2
105+
with:
106+
fetch-depth: 1
107+
path: go/src/open-cluster-management.io/multicluster-mesh-addon
108+
- name: setup helm
109+
uses: azure/setup-helm@v1
110+
- name: chart package
111+
run: |
112+
mkdir -p release
113+
pushd release
114+
helm package ../charts/${{ env.CHART_NAME }}/
115+
popd
116+
- name: publish release
117+
uses: ncipollo/release-action@v1
118+
with:
119+
tag: ${{ env.RELEASE_VERSION }}
120+
artifacts: "go/src/open-cluster-management.io/multicluster-mesh-addon/release/*.tgz"
121+
token: ${{ secrets.GITHUB_TOKEN }}
122+
- name: submit charts to OCM chart repo
123+
uses: actions/github-script@v6
124+
with:
125+
debug: ${{ secrets.ACTIONS_RUNNER_DEBUG }}
126+
github-token: ${{ secrets.OCM_BOT_PAT }}
127+
script: |
128+
try {
129+
const result = await github.rest.actions.createWorkflowDispatch({
130+
owner: 'open-cluster-management-io',
131+
repo: 'helm-charts',
132+
workflow_id: 'download-chart.yml',
133+
ref: 'main',
134+
inputs: {
135+
repo: "${{ github.repository }}",
136+
version: "${{ needs.env.outputs.TRIMED_RELEASE_VERSION }}",
137+
"chart-name": "${{ env.CHART_NAME }}",
138+
},
139+
})
140+
console.log(result);
141+
} catch(error) {
142+
console.error(error);
143+
core.setFailed(error);
144+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: multicluster-mesh
3+
description: A Helm chart for Multicluster Service Mesh OCM Addon
4+
type: application
5+
version: 0.0.1
6+
appVersion: 1.0.0
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.7.0
8+
creationTimestamp: null
9+
name: meshdeployments.mesh.open-cluster-management.io
10+
spec:
11+
group: mesh.open-cluster-management.io
12+
names:
13+
kind: MeshDeployment
14+
listKind: MeshDeploymentList
15+
plural: meshdeployments
16+
singular: meshdeployment
17+
scope: Namespaced
18+
versions:
19+
- additionalPrinterColumns:
20+
- description: Target clusters of the mesh deployment
21+
jsonPath: .spec.clusters
22+
name: CLUSTERS
23+
type: string
24+
- description: Version of the mesh
25+
jsonPath: .spec.controlPlane.version
26+
name: VERSION
27+
type: string
28+
- description: Provider of the mesh
29+
jsonPath: .spec.meshProvider
30+
name: PROVIDER
31+
type: string
32+
- jsonPath: .metadata.creationTimestamp
33+
name: AGE
34+
type: date
35+
name: v1alpha1
36+
schema:
37+
openAPIV3Schema:
38+
description: MeshDeployment is the Schema for the meshdeployments API
39+
properties:
40+
apiVersion:
41+
description: 'APIVersion defines the versioned schema of this representation
42+
of an object. Servers should convert recognized schemas to the latest
43+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
44+
type: string
45+
kind:
46+
description: 'Kind is a string value representing the REST resource this
47+
object represents. Servers may infer this from the endpoint the client
48+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
49+
type: string
50+
metadata:
51+
type: object
52+
spec:
53+
description: MeshDeploymentSpec defines the desired state of MeshDeployment
54+
properties:
55+
clusters:
56+
items:
57+
type: string
58+
type: array
59+
controlPlane:
60+
description: MeshControlPlane defines the mesh control plane
61+
properties:
62+
components:
63+
items:
64+
type: string
65+
type: array
66+
namespace:
67+
type: string
68+
peers:
69+
items:
70+
description: Peer defines mesh peer
71+
properties:
72+
cluster:
73+
type: string
74+
name:
75+
type: string
76+
type: object
77+
type: array
78+
profiles:
79+
items:
80+
type: string
81+
type: array
82+
revision:
83+
type: string
84+
version:
85+
type: string
86+
type: object
87+
meshConfig:
88+
description: MeshConfig defines the config for the mesh(data plane)
89+
properties:
90+
proxyConfig:
91+
description: ProxyConfig defines the config for the proxy(gateway
92+
proxy and proxy sidecars)
93+
properties:
94+
accessLogging:
95+
description: AccessLogging defines the config for the proxy
96+
access logs
97+
properties:
98+
encoding:
99+
type: string
100+
file:
101+
type: string
102+
format:
103+
type: string
104+
type: object
105+
type: object
106+
trustDomain:
107+
type: string
108+
type: object
109+
meshMemberRoll:
110+
items:
111+
type: string
112+
type: array
113+
meshProvider:
114+
type: string
115+
type: object
116+
status:
117+
description: MeshDeploymentStatus defines the observed state of MeshDeployment
118+
type: object
119+
type: object
120+
served: true
121+
storage: true
122+
subresources:
123+
status: {}
124+
status:
125+
acceptedNames:
126+
kind: ""
127+
plural: ""
128+
conditions: []
129+
storedVersions: []

0 commit comments

Comments
 (0)