本文整理汇总了Golang中github.com/openshift/origin/pkg/client.Interface.DeploymentConfigs方法的典型用法代码示例。如果您正苦于以下问题:Golang Interface.DeploymentConfigs方法的具体用法?Golang Interface.DeploymentConfigs怎么用?Golang Interface.DeploymentConfigs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/client.Interface
的用法示例。
在下文中一共展示了Interface.DeploymentConfigs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: deleteDeploymentConfigs
func deleteDeploymentConfigs(client osclient.Interface, ns string) error {
items, err := client.DeploymentConfigs(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
for i := range items.Items {
err := client.DeploymentConfigs(ns).Delete(items.Items[i].Name)
if err != nil && !errors.IsNotFound(err) {
return err
}
}
return nil
}
示例2: deleteDeploymentConfigs
func deleteDeploymentConfigs(client osclient.Interface, ns string) error {
items, err := client.DeploymentConfigs(ns).List(kapi.ListOptions{})
if err != nil {
return err
}
for i := range items.Items {
err := client.DeploymentConfigs(ns).Delete(items.Items[i].Name)
if err != nil && !errors.IsNotFound(err) {
return err
}
}
return nil
}
示例3: newHelper
// newHelper makes a hew helper using real clients.
func newHelper(oClient client.Interface, kClient kclient.Interface) *helper {
return &helper{
generateRollback: func(namespace string, config *deployapi.DeploymentConfigRollback) (*deployapi.DeploymentConfig, error) {
return oClient.DeploymentConfigs(namespace).Rollback(config)
},
describe: func(config *deployapi.DeploymentConfig) (string, error) {
describer := describe.NewDeploymentConfigDescriberForConfig(oClient, kClient, config)
return describer.Describe(config.Namespace, config.Name)
},
updateConfig: func(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
return oClient.DeploymentConfigs(namespace).Update(config)
},
}
}
示例4: unloadDeploymentConfigLabel
func unloadDeploymentConfigLabel(client osclient.Interface, application *api.Application, labelSelector labels.Selector) error {
resourceList, _ := client.DeploymentConfigs(application.Namespace).List(kapi.ListOptions{LabelSelector: labelSelector, FieldSelector: fields.Everything()})
errs := []error{}
for _, resource := range resourceList.Items {
if !hasItem(application.Spec.Items, api.Item{Kind: "DeploymentConfig", Name: resource.Name}) {
delete(resource.Labels, fmt.Sprintf("%s.application.%s", application.Namespace, application.Name))
if _, err := client.DeploymentConfigs(application.Namespace).Update(&resource); err != nil {
errs = append(errs, err)
}
}
}
return nil
}
示例5: loadDeploymentConfigs
func loadDeploymentConfigs(g osgraph.Graph, graphLock sync.Mutex, namespace string, kclient kclient.Interface, client client.Interface) error {
dcs, err := client.DeploymentConfigs(namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
graphLock.Lock()
defer graphLock.Unlock()
for i := range dcs.Items {
deploygraph.EnsureDeploymentConfigNode(g, &dcs.Items[i])
}
return nil
}
示例6: testPodNodeConstraintsObjectCreationWithPodTemplate
// testPodNodeConstraintsObjectCreationWithPodTemplate attempts to create different object types that contain pod templates
// using the passed in nodeName and nodeSelector. It will use the expectError flag to determine if an error should be returned or not
func testPodNodeConstraintsObjectCreationWithPodTemplate(t *testing.T, name string, kclientset kclientset.Interface, client client.Interface, nodeName string, nodeSelector map[string]string, expectError bool) {
checkForbiddenErr := func(objType string, err error) {
if err == nil && expectError {
t.Errorf("%s (%s): expected forbidden error but did not receive one", name, objType)
return
}
if err != nil && !expectError {
t.Errorf("%s (%s): got error but did not expect one: %v", name, objType, err)
return
}
if err != nil && expectError && !kapierrors.IsForbidden(err) {
t.Errorf("%s (%s): did not get an expected forbidden error: %v", name, objType, err)
return
}
}
// Pod
pod := testPodNodeConstraintsPod(nodeName, nodeSelector)
_, err := kclientset.Core().Pods(testutil.Namespace()).Create(pod)
checkForbiddenErr("pod", err)
// ReplicationController
rc := testPodNodeConstraintsReplicationController(nodeName, nodeSelector)
_, err = kclientset.Core().ReplicationControllers(testutil.Namespace()).Create(rc)
checkForbiddenErr("rc", err)
// TODO: Enable when the deployments endpoint is supported in Origin
// Deployment
// d := testPodNodeConstraintsDeployment(nodeName, nodeSelector)
// _, err = kclientset.Extensions().Deployments(testutil.Namespace()).Create(d)
// checkForbiddenErr("deployment", err)
// ReplicaSet
rs := testPodNodeConstraintsReplicaSet(nodeName, nodeSelector)
_, err = kclientset.Extensions().ReplicaSets(testutil.Namespace()).Create(rs)
checkForbiddenErr("replicaset", err)
// Job
job := testPodNodeConstraintsJob(nodeName, nodeSelector)
_, err = kclientset.Batch().Jobs(testutil.Namespace()).Create(job)
checkForbiddenErr("job", err)
// DeploymentConfig
dc := testPodNodeConstraintsDeploymentConfig(nodeName, nodeSelector)
_, err = client.DeploymentConfigs(testutil.Namespace()).Create(dc)
checkForbiddenErr("dc", err)
}
示例7: NewDeploymentConfigDescriber
// NewDeploymentConfigDescriber returns a new DeploymentConfigDescriber
func NewDeploymentConfigDescriber(client client.Interface, kclient kclient.Interface) *DeploymentConfigDescriber {
return &DeploymentConfigDescriber{
client: &genericDeploymentDescriberClient{
getDeploymentConfigFunc: func(namespace, name string) (*deployapi.DeploymentConfig, error) {
return client.DeploymentConfigs(namespace).Get(name)
},
getDeploymentFunc: func(namespace, name string) (*kapi.ReplicationController, error) {
return kclient.ReplicationControllers(namespace).Get(name)
},
listDeploymentsFunc: func(namespace string, selector labels.Selector) (*kapi.ReplicationControllerList, error) {
return kclient.ReplicationControllers(namespace).List(kapi.ListOptions{LabelSelector: selector})
},
listPodsFunc: func(namespace string, selector labels.Selector) (*kapi.PodList, error) {
return kclient.Pods(namespace).List(kapi.ListOptions{LabelSelector: selector})
},
listEventsFunc: func(deploymentConfig *deployapi.DeploymentConfig) (*kapi.EventList, error) {
return kclient.Events(deploymentConfig.Namespace).Search(deploymentConfig)
},
},
}
}
示例8: NewLatestDeploymentsDescriber
// NewLatestDeploymentsDescriber lists the latest deployments limited to "count". In case count == -1, list back to the last successful.
func NewLatestDeploymentsDescriber(client client.Interface, kclient kclient.Interface, count int) *LatestDeploymentsDescriber {
return &LatestDeploymentsDescriber{
count: count,
client: &genericDeploymentDescriberClient{
getDeploymentConfigFunc: func(namespace, name string) (*deployapi.DeploymentConfig, error) {
return client.DeploymentConfigs(namespace).Get(name)
},
getDeploymentFunc: func(namespace, name string) (*kapi.ReplicationController, error) {
return kclient.ReplicationControllers(namespace).Get(name)
},
listDeploymentsFunc: func(namespace string, selector labels.Selector) (*kapi.ReplicationControllerList, error) {
return kclient.ReplicationControllers(namespace).List(selector, fields.Everything())
},
listPodsFunc: func(namespace string, selector labels.Selector) (*kapi.PodList, error) {
return kclient.Pods(namespace).List(selector, fields.Everything())
},
listEventsFunc: func(deploymentConfig *deployapi.DeploymentConfig) (*kapi.EventList, error) {
return kclient.Events(deploymentConfig.Namespace).Search(deploymentConfig)
},
},
}
}