Skip to content

Commit 8bc4d49

Browse files
authored
[Maintenance] Generate README Platforms (#1257)
1 parent b9aed8e commit 8bc4d49

File tree

6 files changed

+212
-17
lines changed

6 files changed

+212
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- (Feature) Optional JSON logger format
1919
- (Improvement) Change Operator default ReplicasCount to 1
2020
- (Maintenance) Change MD content injection method
21+
- (Maintenance) Generate README Platforms
2122

2223
## [1.2.24](https://github.com/arangodb/kube-arangodb/tree/1.2.24) (2023-01-25)
2324
- (Bugfix) Fix deployment creation on ARM64

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ Kubernetes versions starting from 1.18 are supported and tested, charts and mani
2929
The following table has the general readiness state, the table below
3030
covers individual newer features separately.
3131

32-
| Platform | Kubernetes Version | ArangoDB Version | State | Remarks | Provider Remarks |
33-
|---------------------|--------------------|------------------|------------|------------------------------------------------------------------|------------------------------------|
34-
| Google GKE | 1.22-1.25 | >= 3.6.0 | Production | Don't use micro nodes | |
35-
| Azure AKS | 1.21-1.24 | >= 3.6.0 | Production | | |
36-
| Amazon EKS | 1.21-1.24 | >= 3.6.0 | Production | | [Amazon EKS](./docs/providers/eks) |
37-
| IBM Cloud | 1.17 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
38-
| IBM Cloud | 1.18 | >= 3.6.0 | Production | | |
39-
| IBM Cloud | 1.19 | >= 3.6.0 | Production | | |
40-
| IBM Cloud | 1.20 | >= 3.6.0 | Production | | |
41-
| IBM Cloud | 1.21 | >= 3.6.0 | Production | | |
42-
| OpenShift | 3.11 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
43-
| OpenShift | 4.2-4.11 | >= 3.6.0 | Production | | |
44-
| BareMetal (kubeadm) | 1.16-1.17 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
45-
| BareMetal (kubeadm) | 1.18-1.25 | >= 3.6.0 | Production | | |
46-
| Minikube | 1.18+ | >= 3.6.0 | Devel Only | | |
47-
| Other | 1.18+ | >= 3.6.0 | Devel Only | | |
32+
<!-- START(metricsTable) -->
33+
| Platform | Kubernetes Version | ArangoDB Version | State | Remarks | Provider Remarks |
34+
|:--------------------|:-------------------|:-----------------|:-----------|:------------------------------------------|:-----------------------------------|
35+
| Google GKE | 1.21-1.25 | >= 3.6.0 | Production | Don't use micro nodes | |
36+
| Azure AKS | 1.21-1.24 | >= 3.6.0 | Production | | |
37+
| Amazon EKS | 1.21-1.24 | >= 3.6.0 | Production | | [Amazon EKS](./docs/providers/eks) |
38+
| IBM Cloud | 1.17 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
39+
| IBM Cloud | 1.18-1.21 | >= 3.6.0 | Production | | |
40+
| OpenShift | 3.11 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
41+
| OpenShift | 4.2-4.11 | >= 3.6.0 | Production | | |
42+
| BareMetal (kubeadm) | <= 1.20 | >= 3.6.0 | Deprecated | Support will be dropped in Operator 1.5.0 | |
43+
| BareMetal (kubeadm) | 1.21-1.25 | >= 3.6.0 | Production | | |
44+
| Minikube | 1.21-1.25 | >= 3.6.0 | Devel Only | | |
45+
| Other | 1.21-1.25 | >= 3.6.0 | Devel Only | | |
46+
47+
<!-- END(metricsTable) -->
4848

4949
Feature-wise production readiness table:
5050

internal/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.

internal/platforms.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
platforms:
2+
- name: "Google GKE"
3+
versions:
4+
- kubernetesVersion: "1.21-1.25"
5+
arangoDBVersion: ">= 3.6.0"
6+
state: "Production"
7+
remarks: "Don't use micro nodes "
8+
- name: "Azure AKS"
9+
versions:
10+
- kubernetesVersion: "1.21-1.24"
11+
arangoDBVersion: ">= 3.6.0"
12+
state: "Production"
13+
- name: "Amazon EKS"
14+
versions:
15+
- kubernetesVersion: "1.21-1.24"
16+
arangoDBVersion: ">= 3.6.0"
17+
state: "Production"
18+
providerRemarks: "[Amazon EKS](./docs/providers/eks)"
19+
- name: "IBM Cloud"
20+
versions:
21+
- kubernetesVersion: "1.17"
22+
arangoDBVersion: ">= 3.6.0"
23+
state: "Deprecated"
24+
remarks: "Support will be dropped in Operator 1.5.0"
25+
- kubernetesVersion: "1.18-1.21"
26+
arangoDBVersion: ">= 3.6.0"
27+
state: "Production"
28+
- name: "OpenShift"
29+
versions:
30+
- kubernetesVersion: "3.11"
31+
arangoDBVersion: ">= 3.6.0"
32+
state: "Deprecated"
33+
remarks: "Support will be dropped in Operator 1.5.0"
34+
- kubernetesVersion: "4.2-4.11"
35+
arangoDBVersion: ">= 3.6.0"
36+
state: "Production"
37+
- name: "BareMetal (kubeadm)"
38+
versions:
39+
- kubernetesVersion: "<= 1.20"
40+
arangoDBVersion: ">= 3.6.0"
41+
state: "Deprecated"
42+
remarks: "Support will be dropped in Operator 1.5.0"
43+
- kubernetesVersion: "1.21-1.25"
44+
arangoDBVersion: ">= 3.6.0"
45+
state: "Production"
46+
- name: "Minikube"
47+
versions:
48+
- kubernetesVersion: "1.21-1.25"
49+
arangoDBVersion: ">= 3.6.0"
50+
state: "Devel Only"
51+
- name: "Other"
52+
versions:
53+
- kubernetesVersion: "1.21-1.25"
54+
arangoDBVersion: ">= 3.6.0"
55+
state: "Devel Only"

internal/readme.go

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package internal
22+
23+
import (
24+
"os"
25+
"path"
26+
27+
"gopkg.in/yaml.v3"
28+
29+
"github.com/arangodb/kube-arangodb/internal/md"
30+
"github.com/arangodb/kube-arangodb/pkg/util"
31+
)
32+
33+
type PlatformsDoc struct {
34+
Platforms Platforms `json:"platforms,omitempty" yaml:"platforms,omitempty"`
35+
}
36+
37+
type Platforms []Platform
38+
39+
type Platform struct {
40+
Name string `json:"name,omitempty" yaml:"name,omitempty"`
41+
Versions []PlatformVersion `json:"versions,omitempty" yaml:"versions,omitempty"`
42+
}
43+
44+
type PlatformVersion struct {
45+
KubernetesVersion *string `json:"kubernetesVersion,omitempty" yaml:"kubernetesVersion,omitempty"`
46+
ArangoDBVersion *string `json:"arangoDBVersion,omitempty" yaml:"arangoDBVersion,omitempty"`
47+
State *string `json:"state,omitempty" yaml:"state,omitempty"`
48+
Remarks *string `json:"remarks,omitempty" yaml:"remarks,omitempty"`
49+
ProviderRemarks *string `json:"providerRemarks,omitempty" yaml:"providerRemarks,omitempty"`
50+
}
51+
52+
func GenerateReadme(root string) error {
53+
readmeSections := map[string]string{}
54+
55+
{
56+
platform := md.NewColumn("Platform", md.ColumnLeftAlign)
57+
kVersion := md.NewColumn("Kubernetes Version", md.ColumnLeftAlign)
58+
aVersion := md.NewColumn("ArangoDB Version", md.ColumnLeftAlign)
59+
state := md.NewColumn("State", md.ColumnLeftAlign)
60+
remarks := md.NewColumn("Remarks", md.ColumnLeftAlign)
61+
pRemarks := md.NewColumn("Provider Remarks", md.ColumnLeftAlign)
62+
t := md.NewTable(
63+
platform,
64+
kVersion,
65+
aVersion,
66+
state,
67+
remarks,
68+
pRemarks,
69+
)
70+
71+
var d PlatformsDoc
72+
73+
data, err := os.ReadFile(path.Join(root, "internal", "platforms.yaml"))
74+
if err != nil {
75+
return err
76+
}
77+
78+
if err := yaml.Unmarshal(data, &d); err != nil {
79+
return err
80+
}
81+
82+
for _, p := range d.Platforms {
83+
for _, v := range p.Versions {
84+
if err := t.AddRow(map[md.Column]string{
85+
platform: p.Name,
86+
kVersion: util.StringOrDefault(v.KubernetesVersion, ""),
87+
aVersion: util.StringOrDefault(v.ArangoDBVersion, ""),
88+
state: util.StringOrDefault(v.State, ""),
89+
remarks: util.StringOrDefault(v.Remarks, ""),
90+
pRemarks: util.StringOrDefault(v.ProviderRemarks, ""),
91+
}); err != nil {
92+
return err
93+
}
94+
}
95+
}
96+
97+
readmeSections["metricsTable"] = md.WrapWithNewLines(t.Render())
98+
}
99+
100+
if err := md.ReplaceSectionsInFile(path.Join(root, "README.md"), readmeSections); err != nil {
101+
return err
102+
}
103+
104+
return nil
105+
}

internal/readme_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package internal
22+
23+
import (
24+
"os"
25+
"testing"
26+
27+
"github.com/stretchr/testify/require"
28+
)
29+
30+
func Test_GenerateReadme(t *testing.T) {
31+
root := os.Getenv("ROOT")
32+
33+
require.NoError(t, GenerateReadme(root))
34+
}

0 commit comments

Comments
 (0)