Add supports for stats in ACI provider

This adds a new, optional, interface for providers that want to provide
stats.
This commit is contained in:
Brian Goff
2018-08-02 17:06:50 -07:00
parent 6284757aa1
commit e8abca0ac9
11 changed files with 643 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import (
"os"
"reflect"
"strings"
"sync"
"time"
"github.com/Sirupsen/logrus"
@@ -26,6 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/remotecommand"
stats "k8s.io/kubernetes/pkg/kubelet/apis/stats/v1alpha1"
)
// The service account secret mount path.
@@ -47,6 +49,10 @@ type ACIProvider struct {
internalIP string
daemonEndpointPort int32
diagnostics *aci.ContainerGroupDiagnostics
metricsSync sync.Mutex
metricsSyncTime time.Time
lastMetric *stats.Summary
}
// AuthConfig is the secret returned from an ImageRegistryCredential
@@ -296,13 +302,17 @@ func (p *ACIProvider) CreatePod(pod *v1.Pod) error {
// TODO(BJK) containergrouprestartpolicy??
_, err = p.aciClient.CreateContainerGroup(
p.resourceGroup,
fmt.Sprintf("%s-%s", pod.Namespace, pod.Name),
containerGroupName(pod),
containerGroup,
)
return err
}
func containerGroupName(pod *v1.Pod) string {
return fmt.Sprintf("%s-%s", pod.Namespace, pod.Name)
}
// UpdatePod is a noop, ACI currently does not support live updates of a pod.
func (p *ACIProvider) UpdatePod(pod *v1.Pod) error {
return nil