Skip to content

Commit e4db000

Browse files
hossainemruztamalsaha
authored andcommitted
Add support for OpenShift DeploymentConfig (#714)
Fix: stashed/stash#161
1 parent 3fa7bdb commit e4db000

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/options.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import (
1313
"github.com/spf13/pflag"
1414
crd_cs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"
1515
"k8s.io/client-go/kubernetes"
16+
"kmodules.xyz/client-go/discovery"
1617
appcatalog_cs "kmodules.xyz/custom-resources/client/clientset/versioned"
18+
ocapps "kmodules.xyz/openshift/apis/apps/v1"
19+
oc_cs "kmodules.xyz/openshift/client/clientset/versioned"
1720
)
1821

1922
type ExtraOptions struct {
@@ -91,5 +94,13 @@ func (s *ExtraOptions) ApplyTo(cfg *controller.Config) error {
9194
if cfg.AppCatalogClient, err = appcatalog_cs.NewForConfig(cfg.ClientConfig); err != nil {
9295
return err
9396
}
97+
98+
// if cluster has OpenShift DeploymentConfig then generate OcClient
99+
if discovery.IsPreferredAPIResource(cfg.KubeClient.Discovery(), ocapps.GroupVersion.String(), apis.KindDeploymentConfig) {
100+
if cfg.OcClient, err = oc_cs.NewForConfig(cfg.ClientConfig); err != nil {
101+
return err
102+
}
103+
}
104+
94105
return nil
95106
}

0 commit comments

Comments
 (0)