Skip to content

Instantly share code, notes, and snippets.

@ecowden
Created September 13, 2018 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecowden/21750e2ec3957615183380d857acdafb to your computer and use it in GitHub Desktop.
Save ecowden/21750e2ec3957615183380d857acdafb to your computer and use it in GitHub Desktop.
// F5PoolSyncer is responsible for ensuring state on the F5 BigIP LTM. It is the glue
// that hides and abstracts the LTM from the rest of the code.
type F5PoolSyncer interface {
EnsurePoolPresent(k8sPool *bigipv1beta1.Pool) (*SyncResult, *bigip.Pool, error)
EnsurePoolAbsent(k8sPool *bigipv1beta1.Pool) (*SyncResult, error)
EnsureMembersPresent(k8sPool *bigipv1beta1.Pool, endpoints *corev1.Endpoints) (result *SyncResult, err error)
}
// realPoolSyncer is a concrete implementation of the PoolSyncer interface
// TODO this naming is awful; change it
type realPoolSyncer struct {
f5Syncer
}
// NewPoolSyncer creates a new F5PoolSyncer
func NewPoolSyncer() F5PoolSyncer {
return &realPoolSyncer{
f5Syncer: newF5Syncer(),
}
}
func newF5Syncer() f5Syncer {
return f5Syncer{
// TODO pull config from args or Secret
f5: bigip.NewSession("sndltm-int01.wwt.com", os.Getenv("LTM_USER"), os.Getenv("LTM_PW"), nil),
partition: "k8s",
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment