Skip to content

Conversation

@huntergregory
Copy link
Contributor

@huntergregory huntergregory commented Sep 1, 2021

Reason for Change:

  • Encapsulates Prometheus metrics
  • Fixes Prometheus IPSet metrics:
    • we were not updating metrics for operations around sets with type list
    • we were not updating metrics when all NPM ipsets are destroyed
    • metrics were sometimes being updated after error code 1
  • Refactors unit testing for Prometheus metrics for ipsm, iptm, and networkPolicyController
  • Fixes a faulty Prometheus HTTP handler unit test
  • Updates a check for an empty response to ipset list when destroying NPM ipsets
  • Removes unused clientset variable in controllers
  • Fixes a copy paste error in an error message for cleanUpNetworkPolicy

Issue Fixed:

Requirements:

Notes:

@huntergregory huntergregory changed the title NPM Prometheus Update NPM Prometheus Update (DELETED) Sep 3, 2021
@huntergregory huntergregory changed the title NPM Prometheus Update (DELETED) NPM Prometheus Update Sep 3, 2021
@JungukCho JungukCho self-requested a review September 3, 2021 16:54
@huntergregory
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

return err
}
if err == nil {
metrics.IncNumIPSets()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to create setname entry in IpsetInventory

vakalapa
vakalapa previously approved these changes Sep 10, 2021
Copy link
Contributor

@vakalapa vakalapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Put a pin on ipset inventory creation for empty sets. I still think we will need to do it but at the moment it is not crucial.

Copy link
Contributor

@JungukCho JungukCho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Thank you for applying comments!

@huntergregory huntergregory merged commit 0dd10e4 into master Sep 10, 2021
@rbtr
Copy link
Collaborator

rbtr commented Sep 10, 2021

👎🏼 don't merge with failing checks.
resolve these in a follow-up PR:

npm/nameSpaceController.go:80:144: unexported-return: exported func NewNameSpaceController returns unexported type *npm.nameSpaceController, which can be annoying to use (revive)
func NewNameSpaceController(nameSpaceInformer coreinformer.NamespaceInformer, ipsMgr *ipsm.IpsetManager, npmNamespaceCache *npmNamespaceCache) *nameSpaceController {
                                                                                                                                               ^
npm/networkPolicyController.go:46:114: unexported-return: exported func NewNetworkPolicyController returns unexported type *npm.networkPolicyController, which can be annoying to use (revive)
func NewNetworkPolicyController(npInformer networkinginformers.NetworkPolicyInformer, ipsMgr *ipsm.IpsetManager) *networkPolicyController {
                                                                                                                 ^
npm/podController.go:93:126: unexported-return: exported func NewPodController returns unexported type *npm.podController, which can be annoying to use (revive)
func NewPodController(podInformer coreinformer.PodInformer, ipsMgr *ipsm.IpsetManager, npmNamespaceCache *npmNamespaceCache) *podController {

@JungukCho
Copy link
Contributor

👎🏼 don't merge with failing checks.
resolve these in a follow-up PR:

npm/nameSpaceController.go:80:144: unexported-return: exported func NewNameSpaceController returns unexported type *npm.nameSpaceController, which can be annoying to use (revive)
func NewNameSpaceController(nameSpaceInformer coreinformer.NamespaceInformer, ipsMgr *ipsm.IpsetManager, npmNamespaceCache *npmNamespaceCache) *nameSpaceController {
                                                                                                                                               ^
npm/networkPolicyController.go:46:114: unexported-return: exported func NewNetworkPolicyController returns unexported type *npm.networkPolicyController, which can be annoying to use (revive)
func NewNetworkPolicyController(npInformer networkinginformers.NetworkPolicyInformer, ipsMgr *ipsm.IpsetManager) *networkPolicyController {
                                                                                                                 ^
npm/podController.go:93:126: unexported-return: exported func NewPodController returns unexported type *npm.podController, which can be annoying to use (revive)
func NewPodController(podInformer coreinformer.PodInformer, ipsMgr *ipsm.IpsetManager, npmNamespaceCache *npmNamespaceCache) *podController {

@rbtr Thank you for reminder.
We will resolve them in a follow-up PR.

@huntergregory huntergregory deleted the npm-prometheus-update branch September 20, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants