Skip to content

Commit

Permalink
Add network.k8s.io ingress api detection
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Apr 28, 2020
1 parent ad6a743 commit 14fd011
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/autodetect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (b *Background) autoDetectCapabilities() {

b.detectElasticsearch(ctx, apiList)
b.detectKafka(ctx, apiList)
b.detectIngressAPI()
}

b.detectClusterRoles(ctx)
Expand Down Expand Up @@ -133,6 +134,22 @@ func (b *Background) detectPlatform(ctx context.Context, apiList *metav1.APIGrou
}
}

func (b *Background) detectIngressAPI() {
apiRes, err := b.dcl.ServerResourcesForGroupVersion("networking.k8s.io/v1beta1")
if err != nil {
viper.Set("ingress-api", "extension")
log.WithField("ingress-api", viper.GetString("ingress-api")).Info("Auto-detected ingress api")
return
}

for _, r := range apiRes.APIResources {
if r.Name == "ingresses" {
viper.Set("ingress-api", "network")
log.WithField("ingress-api", viper.GetString("ingress-api")).Info("Auto-detected ingress api")
}
}
}

func (b *Background) detectElasticsearch(ctx context.Context, apiList *metav1.APIGroupList) {
// detect whether the Elasticsearch operator is available
if b.retryDetectEs {
Expand Down

0 comments on commit 14fd011

Please sign in to comment.