-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GC registry for deferred IP removal (#25)
This patch adds mechanisms to record IPs returned and released when using the skipDeallocate mode of the IPAM plugin. A systemd service or cron job can be used with the -tool to allow delayed removal of these IPs from the system if they are not reused within a certain period of time. This is extremely helpful in cases where a large number of pods are created and removed in the system to avoid running into AWS rate limits.
- Loading branch information
Showing
18 changed files
with
561 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cniipvlanvpck8s | ||
package freeip | ||
|
||
import ( | ||
"github.com/lyft/cni-ipvlan-vpc-k8s/aws" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package lib | ||
|
||
import ( | ||
"encoding/json" | ||
"time" | ||
) | ||
|
||
// JSONTime is a RFC3339 encoded time with JSON marshallers | ||
type JSONTime struct { | ||
time.Time | ||
} | ||
|
||
// MarshalJSON marshals a JSONTime to an RFC3339 string | ||
func (j *JSONTime) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(j.Time.Format(time.RFC3339)) | ||
} | ||
|
||
// UnmarshalJSON unmarshals a JSONTime to a time.Time | ||
func (j *JSONTime) UnmarshalJSON(js []byte) error { | ||
var rawString string | ||
err := json.Unmarshal(js, &rawString) | ||
if err != nil { | ||
return err | ||
} | ||
t, err := time.Parse(time.RFC3339, rawString) | ||
if err != nil { | ||
return err | ||
} | ||
j.Time = t | ||
return nil | ||
} |
Oops, something went wrong.