provider/kubernetes: Change imports and references after upgrade
This commit is contained in:
parent
59c8c1d020
commit
2a16352463
|
@ -9,10 +9,10 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
"k8s.io/kubernetes/pkg/client/restclient"
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func Provider() terraform.ResourceProvider {
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesConfigMap() *schema.Resource {
|
||||
|
@ -57,7 +58,7 @@ func resourceKubernetesConfigMapRead(d *schema.ResourceData, meta interface{}) e
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading config map %s", name)
|
||||
cfgMap, err := conn.CoreV1().ConfigMaps(namespace).Get(name)
|
||||
cfgMap, err := conn.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -103,7 +104,7 @@ func resourceKubernetesConfigMapDelete(d *schema.ResourceData, meta interface{})
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting config map: %#v", name)
|
||||
err := conn.CoreV1().ConfigMaps(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().ConfigMaps(namespace).Delete(name, &metav1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ func resourceKubernetesConfigMapExists(d *schema.ResourceData, meta interface{})
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking config map %s", name)
|
||||
_, err := conn.CoreV1().ConfigMaps(namespace).Get(name)
|
||||
_, err := conn.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -9,8 +9,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesConfigMap_basic(t *testing.T) {
|
||||
|
@ -187,7 +188,7 @@ func testAccCheckKubernetesConfigMapDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().ConfigMaps(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().ConfigMaps(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Name == rs.Primary.ID {
|
||||
return fmt.Errorf("Config Map still exists: %s", rs.Primary.ID)
|
||||
|
@ -207,7 +208,7 @@ func testAccCheckKubernetesConfigMapExists(n string, obj *api.ConfigMap) resourc
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().ConfigMaps(namespace).Get(name)
|
||||
out, err := conn.CoreV1().ConfigMaps(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
api_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesHorizontalPodAutoscaler() *schema.Resource {
|
||||
|
@ -105,7 +105,7 @@ func resourceKubernetesHorizontalPodAutoscalerRead(d *schema.ResourceData, meta
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading horizontal pod autoscaler %s", name)
|
||||
svc, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name)
|
||||
svc, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -156,7 +156,7 @@ func resourceKubernetesHorizontalPodAutoscalerDelete(d *schema.ResourceData, met
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting horizontal pod autoscaler: %#v", name)
|
||||
err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Delete(name, &api_v1.DeleteOptions{})
|
||||
err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ func resourceKubernetesHorizontalPodAutoscalerExists(d *schema.ResourceData, met
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking horizontal pod autoscaler %s", name)
|
||||
_, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name)
|
||||
_, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesHorizontalPodAutoscaler_basic(t *testing.T) {
|
||||
|
@ -161,7 +162,7 @@ func testAccCheckKubernetesHorizontalPodAutoscalerDestroy(s *terraform.State) er
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name)
|
||||
resp, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Namespace == namespace && resp.Name == name {
|
||||
return fmt.Errorf("Horizontal Pod Autoscaler still exists: %s", rs.Primary.ID)
|
||||
|
@ -181,7 +182,7 @@ func testAccCheckKubernetesHorizontalPodAutoscalerExists(n string, obj *api.Hori
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name)
|
||||
out, err := conn.AutoscalingV1().HorizontalPodAutoscalers(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesLimitRange() *schema.Resource {
|
||||
|
@ -106,7 +107,7 @@ func resourceKubernetesLimitRangeRead(d *schema.ResourceData, meta interface{})
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading limit range %s", name)
|
||||
limitRange, err := conn.CoreV1().LimitRanges(namespace).Get(name)
|
||||
limitRange, err := conn.CoreV1().LimitRanges(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -161,7 +162,7 @@ func resourceKubernetesLimitRangeDelete(d *schema.ResourceData, meta interface{}
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting limit range: %#v", name)
|
||||
err := conn.CoreV1().LimitRanges(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().LimitRanges(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ func resourceKubernetesLimitRangeExists(d *schema.ResourceData, meta interface{}
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking limit range %s", name)
|
||||
_, err := conn.CoreV1().LimitRanges(namespace).Get(name)
|
||||
_, err := conn.CoreV1().LimitRanges(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesLimitRange_basic(t *testing.T) {
|
||||
|
@ -263,7 +264,7 @@ func testAccCheckKubernetesLimitRangeDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().LimitRanges(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().LimitRanges(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Namespace == namespace && resp.Name == name {
|
||||
return fmt.Errorf("Limit Range still exists: %s", rs.Primary.ID)
|
||||
|
@ -283,7 +284,7 @@ func testAccCheckKubernetesLimitRangeExists(n string, obj *api.LimitRange) resou
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().LimitRanges(namespace).Get(name)
|
||||
out, err := conn.CoreV1().LimitRanges(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesNamespace() *schema.Resource {
|
||||
|
@ -53,7 +54,7 @@ func resourceKubernetesNamespaceRead(d *schema.ResourceData, meta interface{}) e
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Reading namespace %s", name)
|
||||
namespace, err := conn.CoreV1().Namespaces().Get(name)
|
||||
namespace, err := conn.CoreV1().Namespaces().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -92,7 +93,7 @@ func resourceKubernetesNamespaceDelete(d *schema.ResourceData, meta interface{})
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Deleting namespace: %#v", name)
|
||||
err := conn.CoreV1().Namespaces().Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().Namespaces().Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ func resourceKubernetesNamespaceDelete(d *schema.ResourceData, meta interface{})
|
|||
Pending: []string{"Terminating"},
|
||||
Timeout: 5 * time.Minute,
|
||||
Refresh: func() (interface{}, string, error) {
|
||||
out, err := conn.CoreV1().Namespaces().Get(name)
|
||||
out, err := conn.CoreV1().Namespaces().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return nil, "", nil
|
||||
|
@ -131,7 +132,7 @@ func resourceKubernetesNamespaceExists(d *schema.ResourceData, meta interface{})
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Checking namespace %s", name)
|
||||
_, err := conn.CoreV1().Namespaces().Get(name)
|
||||
_, err := conn.CoreV1().Namespaces().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -9,8 +9,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesNamespace_basic(t *testing.T) {
|
||||
|
@ -155,7 +156,7 @@ func TestAccKubernetesNamespace_importGeneratedName(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccCheckMetaAnnotations(om *api.ObjectMeta, expected map[string]string) resource.TestCheckFunc {
|
||||
func testAccCheckMetaAnnotations(om *meta_v1.ObjectMeta, expected map[string]string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if len(expected) == 0 && len(om.Annotations) == 0 {
|
||||
return nil
|
||||
|
@ -168,7 +169,7 @@ func testAccCheckMetaAnnotations(om *api.ObjectMeta, expected map[string]string)
|
|||
}
|
||||
}
|
||||
|
||||
func testAccCheckMetaLabels(om *api.ObjectMeta, expected map[string]string) resource.TestCheckFunc {
|
||||
func testAccCheckMetaLabels(om *meta_v1.ObjectMeta, expected map[string]string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
if len(expected) == 0 && len(om.Labels) == 0 {
|
||||
return nil
|
||||
|
@ -189,7 +190,7 @@ func testAccCheckKubernetesNamespaceDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
|
||||
resp, err := conn.CoreV1().Namespaces().Get(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().Namespaces().Get(rs.Primary.ID, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Name == rs.Primary.ID {
|
||||
return fmt.Errorf("Namespace still exists: %s", rs.Primary.ID)
|
||||
|
@ -208,7 +209,7 @@ func testAccCheckKubernetesNamespaceExists(n string, obj *api.Namespace) resourc
|
|||
}
|
||||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
out, err := conn.CoreV1().Namespaces().Get(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().Namespaces().Get(rs.Primary.ID, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesPersistentVolume() *schema.Resource {
|
||||
|
@ -91,7 +92,7 @@ func resourceKubernetesPersistentVolumeCreate(d *schema.ResourceData, meta inter
|
|||
Pending: []string{"Pending"},
|
||||
Timeout: 5 * time.Minute,
|
||||
Refresh: func() (interface{}, string, error) {
|
||||
out, err := conn.CoreV1().PersistentVolumes().Get(metadata.Name)
|
||||
out, err := conn.CoreV1().PersistentVolumes().Get(metadata.Name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Received error: %#v", err)
|
||||
return out, "Error", err
|
||||
|
@ -118,7 +119,7 @@ func resourceKubernetesPersistentVolumeRead(d *schema.ResourceData, meta interfa
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Reading persistent volume %s", name)
|
||||
volume, err := conn.CoreV1().PersistentVolumes().Get(name)
|
||||
volume, err := conn.CoreV1().PersistentVolumes().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -168,7 +169,7 @@ func resourceKubernetesPersistentVolumeDelete(d *schema.ResourceData, meta inter
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Deleting persistent volume: %#v", name)
|
||||
err := conn.CoreV1().PersistentVolumes().Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().PersistentVolumes().Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -184,7 +185,7 @@ func resourceKubernetesPersistentVolumeExists(d *schema.ResourceData, meta inter
|
|||
|
||||
name := d.Id()
|
||||
log.Printf("[INFO] Checking persistent volume %s", name)
|
||||
_, err := conn.CoreV1().PersistentVolumes().Get(name)
|
||||
_, err := conn.CoreV1().PersistentVolumes().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -7,10 +7,11 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesPersistentVolumeClaim() *schema.Resource {
|
||||
|
@ -169,7 +170,7 @@ func resourceKubernetesPersistentVolumeClaimCreate(d *schema.ResourceData, meta
|
|||
Pending: []string{"Pending"},
|
||||
Timeout: d.Timeout(schema.TimeoutCreate),
|
||||
Refresh: func() (interface{}, string, error) {
|
||||
out, err := conn.CoreV1().PersistentVolumeClaims(metadata.Namespace).Get(name)
|
||||
out, err := conn.CoreV1().PersistentVolumeClaims(metadata.Namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Received error: %#v", err)
|
||||
return out, "", err
|
||||
|
@ -195,7 +196,7 @@ func resourceKubernetesPersistentVolumeClaimRead(d *schema.ResourceData, meta in
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading persistent volume claim %s", name)
|
||||
claim, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name)
|
||||
claim, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -239,7 +240,7 @@ func resourceKubernetesPersistentVolumeClaimDelete(d *schema.ResourceData, meta
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting persistent volume claim: %#v", name)
|
||||
err := conn.CoreV1().PersistentVolumeClaims(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().PersistentVolumeClaims(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ func resourceKubernetesPersistentVolumeClaimExists(d *schema.ResourceData, meta
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking persistent volume claim %s", name)
|
||||
_, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name)
|
||||
_, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesPersistentVolumeClaim_basic(t *testing.T) {
|
||||
|
@ -314,7 +315,7 @@ func testAccCheckKubernetesPersistentVolumeClaimDestroy(s *terraform.State) erro
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Namespace == namespace && resp.Name == name {
|
||||
return fmt.Errorf("Persistent Volume still exists: %s", rs.Primary.ID)
|
||||
|
@ -334,7 +335,7 @@ func testAccCheckKubernetesPersistentVolumeClaimExists(n string, obj *api.Persis
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name)
|
||||
out, err := conn.CoreV1().PersistentVolumeClaims(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesPersistentVolume_basic(t *testing.T) {
|
||||
|
@ -211,7 +212,7 @@ func testAccCheckKubernetesPersistentVolumeDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
name := rs.Primary.ID
|
||||
resp, err := conn.CoreV1().PersistentVolumes().Get(name)
|
||||
resp, err := conn.CoreV1().PersistentVolumes().Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Name == rs.Primary.ID {
|
||||
return fmt.Errorf("Persistent Volume still exists: %s", rs.Primary.ID)
|
||||
|
@ -231,7 +232,7 @@ func testAccCheckKubernetesPersistentVolumeExists(n string, obj *api.PersistentV
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
name := rs.Primary.ID
|
||||
out, err := conn.CoreV1().PersistentVolumes().Get(name)
|
||||
out, err := conn.CoreV1().PersistentVolumes().Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesResourceQuota() *schema.Resource {
|
||||
|
@ -76,7 +77,7 @@ func resourceKubernetesResourceQuotaCreate(d *schema.ResourceData, meta interfac
|
|||
d.SetId(buildId(out.ObjectMeta))
|
||||
|
||||
err = resource.Retry(1*time.Minute, func() *resource.RetryError {
|
||||
quota, err := conn.CoreV1().ResourceQuotas(out.Namespace).Get(out.Name)
|
||||
quota, err := conn.CoreV1().ResourceQuotas(out.Namespace).Get(out.Name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return resource.NonRetryableError(err)
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ func resourceKubernetesResourceQuotaRead(d *schema.ResourceData, meta interface{
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading resource quota %s", name)
|
||||
resQuota, err := conn.CoreV1().ResourceQuotas(namespace).Get(name)
|
||||
resQuota, err := conn.CoreV1().ResourceQuotas(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -160,7 +161,7 @@ func resourceKubernetesResourceQuotaUpdate(d *schema.ResourceData, meta interfac
|
|||
|
||||
if waitForChangedSpec {
|
||||
err = resource.Retry(1*time.Minute, func() *resource.RetryError {
|
||||
quota, err := conn.CoreV1().ResourceQuotas(namespace).Get(name)
|
||||
quota, err := conn.CoreV1().ResourceQuotas(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return resource.NonRetryableError(err)
|
||||
}
|
||||
|
@ -184,7 +185,7 @@ func resourceKubernetesResourceQuotaDelete(d *schema.ResourceData, meta interfac
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting resource quota: %#v", name)
|
||||
err := conn.CoreV1().ResourceQuotas(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().ResourceQuotas(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -200,7 +201,7 @@ func resourceKubernetesResourceQuotaExists(d *schema.ResourceData, meta interfac
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking resource quota %s", name)
|
||||
_, err := conn.CoreV1().ResourceQuotas(namespace).Get(name)
|
||||
_, err := conn.CoreV1().ResourceQuotas(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -7,8 +7,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesResourceQuota_basic(t *testing.T) {
|
||||
|
@ -205,7 +206,7 @@ func testAccCheckKubernetesResourceQuotaDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().ResourceQuotas(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().ResourceQuotas(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Namespace == namespace && resp.Name == name {
|
||||
return fmt.Errorf("Resource Quota still exists: %s", rs.Primary.ID)
|
||||
|
@ -225,7 +226,7 @@ func testAccCheckKubernetesResourceQuotaExists(n string, obj *api.ResourceQuota)
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().ResourceQuotas(namespace).Get(name)
|
||||
out, err := conn.CoreV1().ResourceQuotas(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
|
||||
"fmt"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesSecret() *schema.Resource {
|
||||
|
@ -72,7 +73,7 @@ func resourceKubernetesSecretRead(d *schema.ResourceData, meta interface{}) erro
|
|||
namespace, name := idParts(d.Id())
|
||||
|
||||
log.Printf("[INFO] Reading secret %s", name)
|
||||
secret, err := conn.CoreV1().Secrets(namespace).Get(name)
|
||||
secret, err := conn.CoreV1().Secrets(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -129,7 +130,7 @@ func resourceKubernetesSecretDelete(d *schema.ResourceData, meta interface{}) er
|
|||
namespace, name := idParts(d.Id())
|
||||
|
||||
log.Printf("[INFO] Deleting secret: %q", name)
|
||||
err := conn.CoreV1().Secrets(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().Secrets(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ func resourceKubernetesSecretExists(d *schema.ResourceData, meta interface{}) (b
|
|||
namespace, name := idParts(d.Id())
|
||||
|
||||
log.Printf("[INFO] Checking secret %s", name)
|
||||
_, err := conn.CoreV1().Secrets(namespace).Get(name)
|
||||
_, err := conn.CoreV1().Secrets(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -9,8 +9,9 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesSecret_basic(t *testing.T) {
|
||||
|
@ -209,7 +210,7 @@ func testAccCheckKubernetesSecretDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().Secrets(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().Secrets(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Name == rs.Primary.ID {
|
||||
return fmt.Errorf("Secret still exists: %s", rs.Primary.ID)
|
||||
|
@ -229,7 +230,7 @@ func testAccCheckKubernetesSecretExists(n string, obj *api.Secret) resource.Test
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().Secrets(namespace).Get(name)
|
||||
out, err := conn.CoreV1().Secrets(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
pkgApi "k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgApi "k8s.io/apimachinery/pkg/types"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func resourceKubernetesService() *schema.Resource {
|
||||
|
@ -147,7 +148,7 @@ func resourceKubernetesServiceRead(d *schema.ResourceData, meta interface{}) err
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Reading service %s", name)
|
||||
svc, err := conn.CoreV1().Services(namespace).Get(name)
|
||||
svc, err := conn.CoreV1().Services(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
log.Printf("[DEBUG] Received error: %#v", err)
|
||||
return err
|
||||
|
@ -198,7 +199,7 @@ func resourceKubernetesServiceDelete(d *schema.ResourceData, meta interface{}) e
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Deleting service: %#v", name)
|
||||
err := conn.CoreV1().Services(namespace).Delete(name, &api.DeleteOptions{})
|
||||
err := conn.CoreV1().Services(namespace).Delete(name, &meta_v1.DeleteOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ func resourceKubernetesServiceExists(d *schema.ResourceData, meta interface{}) (
|
|||
|
||||
namespace, name := idParts(d.Id())
|
||||
log.Printf("[INFO] Checking service %s", name)
|
||||
_, err := conn.CoreV1().Services(namespace).Get(name)
|
||||
_, err := conn.CoreV1().Services(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
if statusErr, ok := err.(*errors.StatusError); ok && statusErr.ErrStatus.Code == 404 {
|
||||
return false, nil
|
||||
|
|
|
@ -9,9 +9,10 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
)
|
||||
|
||||
func TestAccKubernetesService_basic(t *testing.T) {
|
||||
|
@ -328,7 +329,7 @@ func testAccCheckKubernetesServiceDestroy(s *terraform.State) error {
|
|||
continue
|
||||
}
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
resp, err := conn.CoreV1().Services(namespace).Get(name)
|
||||
resp, err := conn.CoreV1().Services(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err == nil {
|
||||
if resp.Name == rs.Primary.ID {
|
||||
return fmt.Errorf("Service still exists: %s", rs.Primary.ID)
|
||||
|
@ -348,7 +349,7 @@ func testAccCheckKubernetesServiceExists(n string, obj *api.Service) resource.Te
|
|||
|
||||
conn := testAccProvider.Meta().(*kubernetes.Clientset)
|
||||
namespace, name := idParts(rs.Primary.ID)
|
||||
out, err := conn.CoreV1().Services(namespace).Get(name)
|
||||
out, err := conn.CoreV1().Services(namespace).Get(name, meta_v1.GetOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package kubernetes
|
|||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
// Flatteners
|
||||
|
||||
func flattenLabelSelector(in *unversioned.LabelSelector) []interface{} {
|
||||
func flattenLabelSelector(in *metav1.LabelSelector) []interface{} {
|
||||
att := make(map[string]interface{})
|
||||
if len(in.MatchLabels) > 0 {
|
||||
att["match_labels"] = in.MatchLabels
|
||||
|
@ -19,7 +19,7 @@ func flattenLabelSelector(in *unversioned.LabelSelector) []interface{} {
|
|||
return []interface{}{att}
|
||||
}
|
||||
|
||||
func flattenLabelSelectorRequirement(in []unversioned.LabelSelectorRequirement) []interface{} {
|
||||
func flattenLabelSelectorRequirement(in []metav1.LabelSelectorRequirement) []interface{} {
|
||||
att := make([]interface{}, len(in), len(in))
|
||||
for i, n := range in {
|
||||
m := make(map[string]interface{})
|
||||
|
@ -57,12 +57,12 @@ func flattenResourceRequirements(in v1.ResourceRequirements) []interface{} {
|
|||
|
||||
// Expanders
|
||||
|
||||
func expandLabelSelector(l []interface{}) *unversioned.LabelSelector {
|
||||
func expandLabelSelector(l []interface{}) *metav1.LabelSelector {
|
||||
if len(l) == 0 || l[0] == nil {
|
||||
return &unversioned.LabelSelector{}
|
||||
return &metav1.LabelSelector{}
|
||||
}
|
||||
in := l[0].(map[string]interface{})
|
||||
obj := &unversioned.LabelSelector{}
|
||||
obj := &metav1.LabelSelector{}
|
||||
if v, ok := in["match_labels"].(map[string]interface{}); ok && len(v) > 0 {
|
||||
obj.MatchLabels = expandStringMap(v)
|
||||
}
|
||||
|
@ -72,16 +72,16 @@ func expandLabelSelector(l []interface{}) *unversioned.LabelSelector {
|
|||
return obj
|
||||
}
|
||||
|
||||
func expandLabelSelectorRequirement(l []interface{}) []unversioned.LabelSelectorRequirement {
|
||||
func expandLabelSelectorRequirement(l []interface{}) []metav1.LabelSelectorRequirement {
|
||||
if len(l) == 0 || l[0] == nil {
|
||||
return []unversioned.LabelSelectorRequirement{}
|
||||
return []metav1.LabelSelectorRequirement{}
|
||||
}
|
||||
obj := make([]unversioned.LabelSelectorRequirement, len(l), len(l))
|
||||
obj := make([]metav1.LabelSelectorRequirement, len(l), len(l))
|
||||
for i, n := range l {
|
||||
in := n.(map[string]interface{})
|
||||
obj[i] = unversioned.LabelSelectorRequirement{
|
||||
obj[i] = metav1.LabelSelectorRequirement{
|
||||
Key: in["key"].(string),
|
||||
Operator: unversioned.LabelSelectorOperator(in["operator"].(string)),
|
||||
Operator: metav1.LabelSelectorOperator(in["operator"].(string)),
|
||||
Values: sliceOfString(in["values"].(*schema.Set).List()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package kubernetes
|
|||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
)
|
||||
|
||||
// Flatteners
|
||||
|
|
|
@ -7,7 +7,8 @@ import (
|
|||
|
||||
"encoding/base64"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
|
@ -16,12 +17,12 @@ func idParts(id string) (string, string) {
|
|||
return parts[0], parts[1]
|
||||
}
|
||||
|
||||
func buildId(meta api.ObjectMeta) string {
|
||||
func buildId(meta metav1.ObjectMeta) string {
|
||||
return meta.Namespace + "/" + meta.Name
|
||||
}
|
||||
|
||||
func expandMetadata(in []interface{}) api.ObjectMeta {
|
||||
meta := api.ObjectMeta{}
|
||||
func expandMetadata(in []interface{}) metav1.ObjectMeta {
|
||||
meta := metav1.ObjectMeta{}
|
||||
if len(in) < 1 {
|
||||
return meta
|
||||
}
|
||||
|
@ -74,7 +75,7 @@ func expandStringSlice(s []interface{}) []string {
|
|||
return result
|
||||
}
|
||||
|
||||
func flattenMetadata(meta api.ObjectMeta) []map[string]interface{} {
|
||||
func flattenMetadata(meta metav1.ObjectMeta) []map[string]interface{} {
|
||||
m := make(map[string]interface{})
|
||||
m["annotations"] = filterAnnotations(meta.Annotations)
|
||||
if meta.GenerateName != "" {
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
apiValidation "k8s.io/kubernetes/pkg/api/validation"
|
||||
utilValidation "k8s.io/kubernetes/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
apiValidation "k8s.io/apimachinery/pkg/api/validation"
|
||||
utilValidation "k8s.io/apimachinery/pkg/util/validation"
|
||||
)
|
||||
|
||||
func validateAnnotations(value interface{}, key string) (ws []string, es []error) {
|
||||
|
|
Loading…
Reference in New Issue