@@ -11,7 +11,7 @@ import (
1111
1212 "github.com/pkg/errors"
1313
14- "github.com/mongodb/mongodb-kubernetes-operator/pkg/agenthealth "
14+ "github.com/mongodb/mongodb-kubernetes-operator/pkg/agent "
1515 "go.uber.org/zap"
1616 corev1 "k8s.io/api/core/v1"
1717 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -91,7 +91,7 @@ func setupLogger() *zap.SugaredLogger {
9191// waitForAgentHealthStatus will poll the health status file and wait for it to be updated.
9292// The agent doesn't write the plan to the file right away and hence we need to wait for the
9393// latest plan to be written.
94- func waitForAgentHealthStatus () (agenthealth .Health , error ) {
94+ func waitForAgentHealthStatus () (agent .Health , error ) {
9595 ticker := time .NewTicker (pollingInterval )
9696 defer ticker .Stop ()
9797
@@ -104,12 +104,12 @@ func waitForAgentHealthStatus() (agenthealth.Health, error) {
104104
105105 health , err := getAgentHealthStatus ()
106106 if err != nil {
107- return agenthealth .Health {}, err
107+ return agent .Health {}, err
108108 }
109109
110110 status , ok := health .Healthiness [getHostname ()]
111111 if ! ok {
112- return agenthealth .Health {}, errors .Errorf ("couldn't find status for hostname %s" , getHostname ())
112+ return agent .Health {}, errors .Errorf ("couldn't find status for hostname %s" , getHostname ())
113113 }
114114
115115 // We determine if the file has been updated by checking if the process is not in goal state.
@@ -118,30 +118,30 @@ func waitForAgentHealthStatus() (agenthealth.Health, error) {
118118 return health , nil
119119 }
120120 }
121- return agenthealth .Health {}, errors .Errorf ("agent health status not ready after waiting %s" , pollingDuration .String ())
121+ return agent .Health {}, errors .Errorf ("agent health status not ready after waiting %s" , pollingDuration .String ())
122122
123123}
124124
125- // getAgentHealthStatus returns an instance of agenthealth .Health read
125+ // getAgentHealthStatus returns an instance of agent .Health read
126126// from the health file on disk
127- func getAgentHealthStatus () (agenthealth .Health , error ) {
127+ func getAgentHealthStatus () (agent .Health , error ) {
128128 f , err := os .Open (os .Getenv (agentStatusFilePathEnv ))
129129 if err != nil {
130- return agenthealth .Health {}, errors .Errorf ("could not open file: %s" , err )
130+ return agent .Health {}, errors .Errorf ("could not open file: %s" , err )
131131 }
132132 defer f .Close ()
133133
134134 h , err := readAgentHealthStatus (f )
135135 if err != nil {
136- return agenthealth .Health {}, errors .Errorf ("could not read health status file: %s" , err )
136+ return agent .Health {}, errors .Errorf ("could not read health status file: %s" , err )
137137 }
138138 return h , err
139139}
140140
141141// readAgentHealthStatus reads an instance of health.Health from the provided
142142// io.Reader
143- func readAgentHealthStatus (reader io.Reader ) (agenthealth .Health , error ) {
144- var h agenthealth .Health
143+ func readAgentHealthStatus (reader io.Reader ) (agent .Health , error ) {
144+ var h agent .Health
145145 data , err := ioutil .ReadAll (reader )
146146 if err != nil {
147147 return h , err
@@ -157,7 +157,7 @@ func getHostname() string {
157157// shouldDeletePod returns a boolean value indicating if this pod should be deleted
158158// this would be the case if the agent is currently trying to upgrade the version
159159// of mongodb.
160- func shouldDeletePod (health agenthealth .Health ) (bool , error ) {
160+ func shouldDeletePod (health agent .Health ) (bool , error ) {
161161 status , ok := health .ProcessPlans [getHostname ()]
162162 if ! ok {
163163 return false , errors .Errorf ("hostname %s was not in the process plans" , getHostname ())
@@ -169,7 +169,7 @@ func shouldDeletePod(health agenthealth.Health) (bool, error) {
169169// on the mongod pod to be restarted. In order to do this, we need to check the agent
170170// status file and determine if the mongod has been stopped and if we are in the process
171171// of a version change.
172- func isWaitingToBeDeleted (healthStatus agenthealth .MmsDirectorStatus ) bool {
172+ func isWaitingToBeDeleted (healthStatus agent .MmsDirectorStatus ) bool {
173173 if len (healthStatus .Plans ) == 0 {
174174 return false
175175 }
@@ -223,7 +223,7 @@ func getThisPod() (corev1.Pod, error) {
223223func inClusterClient () (client.Client , error ) {
224224 config , err := rest .InClusterConfig ()
225225 if err != nil {
226- return nil , errors .Errorf ("could not get cluster config: %% s" , err )
226+ return nil , errors .Errorf ("could not get cluster config: %s" , err )
227227 }
228228
229229 k8sClient , err := client .New (config , client.Options {})
0 commit comments