Skip to content

Commit

Permalink
Merge pull request #4 from maiqueb/claim-instead-of-lease
Browse files Browse the repository at this point in the history
model: rename CRD
  • Loading branch information
maiqueb authored Oct 4, 2023
2 parents 544ceb7 + 98122cc commit 76629ed
Show file tree
Hide file tree
Showing 17 changed files with 376 additions and 376 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: ipamleases.k8s.cni.cncf.io
name: ipamclaims.k8s.cni.cncf.io
spec:
group: k8s.cni.cncf.io
names:
kind: IPAMLease
listKind: IPAMLeaseList
plural: ipamleases
singular: ipamlease
kind: IPAMClaim
listKind: IPAMClaimList
plural: ipamclaims
singular: ipamclaim
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: IPAMLease is the Schema for the IPAMLease API
description: IPAMClaim is the Schema for the IPAMClaim API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down
18 changes: 9 additions & 9 deletions cmd/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ func main() {
}

// create a persistent IP allocation
pip := &v1alpha1.IPAMLease{
pip := &v1alpha1.IPAMClaim{
ObjectMeta: metav1.ObjectMeta{
Name: "example",
},
Spec: v1alpha1.IPAMLeaseSpec{
Spec: v1alpha1.IPAMClaimSpec{
Network: "tenantblue",
Interface: "iface321",
},
}

ipamLease, err := exampleClient.K8sV1alpha1().IPAMLeases("default").Create(
ipamClaim, err := exampleClient.K8sV1alpha1().IPAMClaims("default").Create(
context.Background(),
pip,
metav1.CreateOptions{},
Expand All @@ -54,24 +54,24 @@ func main() {

defer func() {
// teardown persistent IP
_ = exampleClient.K8sV1alpha1().IPAMLeases("default").Delete(
_ = exampleClient.K8sV1alpha1().IPAMClaims("default").Delete(
context.Background(),
pip.Name,
metav1.DeleteOptions{},
)
}()

ipamLease.Status.IPs = []string{"winner", "winner", "chicken", "dinner"}
_, err = exampleClient.K8sV1alpha1().IPAMLeases("default").UpdateStatus(
ipamClaim.Status.IPs = []string{"winner", "winner", "chicken", "dinner"}
_, err = exampleClient.K8sV1alpha1().IPAMClaims("default").UpdateStatus(
context.Background(),
ipamLease,
ipamClaim,
metav1.UpdateOptions{},
)
if err != nil {
glog.Fatalf("Error creating a dummy persistentIP object: %v", err)
}

allPersistentIPs, err := exampleClient.K8sV1alpha1().IPAMLeases(metav1.NamespaceAll).List(
allPersistentIPs, err := exampleClient.K8sV1alpha1().IPAMClaims(metav1.NamespaceAll).List(
context.Background(),
metav1.ListOptions{},
)
Expand All @@ -80,7 +80,7 @@ func main() {
}

for _, persistentIP := range allPersistentIPs.Items {
fmt.Printf("IPAM lease name: %q\n", persistentIP.Name)
fmt.Printf("IPAM claim name: %q\n", persistentIP.Name)
fmt.Printf(" - spec: %v\n", persistentIP.Spec)
fmt.Printf(" - status: %v\n", persistentIP.Status)
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76629ed

Please sign in to comment.