Skip to content

Commit 850c8f3

Browse files
committed
docs: fix incorrect links in docs
1 parent fdb736f commit 850c8f3

File tree

12 files changed

+1416
-10
lines changed

12 files changed

+1416
-10
lines changed

charts/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ keywords:
1616
- iks
1717
- nodepool
1818
- custom-resources
19-
home: https://github.com/pfeifferj/karpenter-ibm-cloud
19+
home: https://github.com/pfeifferj/karpenter-provider-ibm-cloud
2020
icon: https://repository-images.githubusercontent.com/278480393/dab059c8-caa1-4b55-aaa7-3d30e47a5616
2121
sources:
22-
- https://github.com/pfeifferj/karpenter-ibm-cloud
22+
- https://github.com/pfeifferj/karpenter-provider-ibm-cloud
2323
annotations:
2424
"helm.sh/resource-policy": keep

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ helm install karpenter karpenter-ibm/karpenter-ibm \
100100
--namespace karpenter \
101101
--create-namespace \
102102
--set credentials.region="us-south" \
103-
--set credentials.ibm_api_key="your-general-api-key" \
104-
--set credentials.vpc_api_key="your-vpc-api-key"
103+
--set credentials.ibmApiKey="your-general-api-key" \
104+
--set credentials.vpcApiKey="your-vpc-api-key"
105105
```
106106

107107
### Step 2: Verify Installation

docs/iks-integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ ibmcloud ks cluster get --cluster <cluster-id>
3535
kubectl create namespace karpenter
3636

3737
kubectl create secret generic karpenter-ibm-credentials \
38-
--from-literal=api-key="your-general-api-key" \
39-
--from-literal=vpc-api-key="your-vpc-api-key" \
38+
--from-literal=ibmApiKey="your-general-api-key" \
39+
--from-literal=vpcApiKey="your-vpc-api-key" \
4040
--namespace karpenter
4141

4242
# Install via Helm
43-
helm repo add karpenter-ibm https://pfeifferj.github.io/karpenter-provider-ibm-cloud
43+
helm repo add karpenter-ibm https://karpenter-ibm.sh
4444
helm repo update
4545
helm install karpenter karpenter-ibm/karpenter-ibm \
4646
--namespace karpenter \

docs/vpc-integration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ ibmcloud is images --visibility public --status available | grep ubuntu
4343
kubectl create namespace karpenter
4444

4545
kubectl create secret generic karpenter-ibm-credentials \
46-
--from-literal=api-key="your-general-api-key" \
47-
--from-literal=vpc-api-key="your-vpc-api-key" \
46+
--from-literal=ibmApiKey="your-general-api-key" \
47+
--from-literal=vpcApiKey="your-vpc-api-key" \
4848
--namespace karpenter
4949

5050
# Install via Helm
51-
helm repo add karpenter-ibm https://pfeifferj.github.io/karpenter-provider-ibm-cloud
51+
helm repo add karpenter-ibm https://karpenter-ibm.sh
5252
helm repo update
5353
helm install karpenter karpenter-ibm/karpenter-ibm \
5454
--namespace karpenter \
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package constants
18+
19+
import (
20+
"testing"
21+
)
22+
23+
func TestGroupConstant(t *testing.T) {
24+
expected := "karpenter.ibm.sh"
25+
if Group != expected {
26+
t.Errorf("Group constant = %v, want %v", Group, expected)
27+
}
28+
}
29+
30+
func TestGroupConstantNotEmpty(t *testing.T) {
31+
if Group == "" {
32+
t.Error("Group constant should not be empty")
33+
}
34+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
"strings"
21+
"testing"
22+
)
23+
24+
func TestIBMNodeClassHashVersion(t *testing.T) {
25+
if IBMNodeClassHashVersion != "1" {
26+
t.Errorf("IBMNodeClassHashVersion = %v, want %v", IBMNodeClassHashVersion, "1")
27+
}
28+
}
29+
30+
func TestAnnotationIBMNodeClassHash(t *testing.T) {
31+
expected := Group + "/nodeclass-hash"
32+
if AnnotationIBMNodeClassHash != expected {
33+
t.Errorf("AnnotationIBMNodeClassHash = %v, want %v", AnnotationIBMNodeClassHash, expected)
34+
}
35+
36+
if !strings.HasPrefix(AnnotationIBMNodeClassHash, Group) {
37+
t.Errorf("AnnotationIBMNodeClassHash should start with Group prefix: %v", Group)
38+
}
39+
}
40+
41+
func TestAnnotationIBMNodeClassHashVersion(t *testing.T) {
42+
expected := Group + "/nodeclass-hash-version"
43+
if AnnotationIBMNodeClassHashVersion != expected {
44+
t.Errorf("AnnotationIBMNodeClassHashVersion = %v, want %v", AnnotationIBMNodeClassHashVersion, expected)
45+
}
46+
47+
if !strings.HasPrefix(AnnotationIBMNodeClassHashVersion, Group) {
48+
t.Errorf("AnnotationIBMNodeClassHashVersion should start with Group prefix: %v", Group)
49+
}
50+
}
51+
52+
func TestAnnotationConstants(t *testing.T) {
53+
annotations := []string{
54+
AnnotationIBMNodeClassHash,
55+
AnnotationIBMNodeClassHashVersion,
56+
}
57+
58+
for _, annotation := range annotations {
59+
if annotation == "" {
60+
t.Error("Annotation constant should not be empty")
61+
}
62+
if !strings.Contains(annotation, "/") {
63+
t.Errorf("Annotation %v should contain '/' separator", annotation)
64+
}
65+
}
66+
}

pkg/apis/v1alpha1/labels_test.go

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
"strings"
21+
"testing"
22+
23+
"github.com/pfeifferj/karpenter-provider-ibm-cloud/pkg/apis/constants"
24+
v1 "sigs.k8s.io/karpenter/pkg/apis/v1"
25+
)
26+
27+
func TestLabelConstants(t *testing.T) {
28+
tests := []struct {
29+
name string
30+
label string
31+
expected string
32+
}{
33+
{"InstanceSizeLabelKey", InstanceSizeLabelKey, constants.Group + "/instance-size"},
34+
{"InstanceFamilyLabelKey", InstanceFamilyLabelKey, constants.Group + "/instance-family"},
35+
{"InstanceMemoryLabelKey", InstanceMemoryLabelKey, constants.Group + "/instance-memory"},
36+
{"InstanceCPULabelKey", InstanceCPULabelKey, constants.Group + "/instance-cpu"},
37+
}
38+
39+
for _, tt := range tests {
40+
t.Run(tt.name, func(t *testing.T) {
41+
if tt.label != tt.expected {
42+
t.Errorf("%s = %v, want %v", tt.name, tt.label, tt.expected)
43+
}
44+
})
45+
}
46+
}
47+
48+
func TestInternalLabelConstants(t *testing.T) {
49+
tests := []struct {
50+
name string
51+
label string
52+
expected string
53+
}{
54+
{"IbmLabelKey", IbmLabelKey, "ibm.x-k8s.io/node"},
55+
{"IbmLabelValue", IbmLabelValue, "fake"},
56+
{"NodeViewerLabelKey", NodeViewerLabelKey, "eks-node-viewer/instance-price"},
57+
{"IbmPartitionLabelKey", IbmPartitionLabelKey, "ibm-partition"},
58+
}
59+
60+
for _, tt := range tests {
61+
t.Run(tt.name, func(t *testing.T) {
62+
if tt.label != tt.expected {
63+
t.Errorf("%s = %v, want %v", tt.name, tt.label, tt.expected)
64+
}
65+
})
66+
}
67+
}
68+
69+
func TestInstanceLabelsHaveGroupPrefix(t *testing.T) {
70+
instanceLabels := []string{
71+
InstanceSizeLabelKey,
72+
InstanceFamilyLabelKey,
73+
InstanceMemoryLabelKey,
74+
InstanceCPULabelKey,
75+
}
76+
77+
for _, label := range instanceLabels {
78+
if !strings.HasPrefix(label, constants.Group) {
79+
t.Errorf("Instance label %v should start with group prefix %v", label, constants.Group)
80+
}
81+
}
82+
}
83+
84+
func TestLabelsNotEmpty(t *testing.T) {
85+
labels := []string{
86+
InstanceSizeLabelKey,
87+
InstanceFamilyLabelKey,
88+
InstanceMemoryLabelKey,
89+
InstanceCPULabelKey,
90+
IbmLabelKey,
91+
IbmLabelValue,
92+
NodeViewerLabelKey,
93+
IbmPartitionLabelKey,
94+
}
95+
96+
for _, label := range labels {
97+
if label == "" {
98+
t.Error("Label constant should not be empty")
99+
}
100+
}
101+
}
102+
103+
func TestInitFunctionRegistersLabels(t *testing.T) {
104+
// Test that the init function properly registers the group in RestrictedLabelDomains
105+
if !v1.RestrictedLabelDomains.Has(constants.Group) {
106+
t.Errorf("RestrictedLabelDomains should contain %v", constants.Group)
107+
}
108+
109+
// Test that instance labels are registered in WellKnownLabels
110+
expectedWellKnownLabels := []string{
111+
InstanceSizeLabelKey,
112+
InstanceFamilyLabelKey,
113+
InstanceCPULabelKey,
114+
InstanceMemoryLabelKey,
115+
}
116+
117+
for _, label := range expectedWellKnownLabels {
118+
if !v1.WellKnownLabels.Has(label) {
119+
t.Errorf("WellKnownLabels should contain %v", label)
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)