Update EKS Cluster Type(s)
This commit is contained in:
parent
a27852eea8
commit
17d597d0cc
|
|
@ -15,4 +15,4 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package container contains GCP container API versions
|
// Package container contains GCP container API versions
|
||||||
package container
|
package compute
|
||||||
|
|
@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package v1alpha1 contains API Schema definitions for the container v1alpha1 API group
|
// Package v1alpha1 contains API Schema definitions for the compute v1alpha1 API group
|
||||||
// +k8s:openapi-gen=true
|
// +k8s:openapi-gen=true
|
||||||
// +k8s:deepcopy-gen=package,register
|
// +k8s:deepcopy-gen=package,register
|
||||||
// +k8s:conversion-gen=github.com/upbound/conductor/pkg/apis/aws/container
|
// +k8s:conversion-gen=github.com/upbound/conductor/pkg/apis/aws/compute
|
||||||
// +k8s:defaulter-gen=TypeMeta
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
// +groupName=container.aws.conductor.io
|
// +groupName=compute.aws.conductor.io
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
@ -16,12 +16,12 @@ limitations under the License.
|
||||||
|
|
||||||
// NOTE: Boilerplate only. Ignore this file.
|
// NOTE: Boilerplate only. Ignore this file.
|
||||||
|
|
||||||
// Package v1alpha1 contains API Schema definitions for the container v1alpha1 API group
|
// Package v1alpha1 contains API Schema definitions for the compute v1alpha1 API group
|
||||||
// +k8s:openapi-gen=true
|
// +k8s:openapi-gen=true
|
||||||
// +k8s:deepcopy-gen=package,register
|
// +k8s:deepcopy-gen=package,register
|
||||||
// +k8s:conversion-gen=github.com/upbound/conductor/pkg/aws/apis/aws/container
|
// +k8s:conversion-gen=github.com/upbound/conductor/pkg/aws/apis/aws/compute
|
||||||
// +k8s:defaulter-gen=TypeMeta
|
// +k8s:defaulter-gen=TypeMeta
|
||||||
// +groupName=container.aws.conductor.io
|
// +groupName=compute.aws.conductor.io
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -30,7 +30,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Group = "container.aws.conductor.io"
|
Group = "compute.aws.conductor.io"
|
||||||
Version = "v1alpha1"
|
Version = "v1alpha1"
|
||||||
APIVersion = Group + "/" + Version
|
APIVersion = Group + "/" + Version
|
||||||
)
|
)
|
||||||
|
|
@ -41,17 +41,12 @@ type EKSClusterSpec struct {
|
||||||
// specify up to 5 security groups, but we recommend that you use a
|
// specify up to 5 security groups, but we recommend that you use a
|
||||||
// dedicated security group for your cluster control plane.
|
// dedicated security group for your cluster control plane.
|
||||||
//
|
//
|
||||||
// Shorthand Syntax:
|
// Syntax:
|
||||||
//
|
// subnetIds=string,string,
|
||||||
// subnetIds=string,string,securityGroupIds=string,string
|
SubnetIds []string `json:"subnetIds"`
|
||||||
//
|
// Syntax:
|
||||||
// JSON Syntax:
|
// securityGroupsIdsIds=string,string,
|
||||||
//
|
SecurityGroups []string `json:"securityGroups"`
|
||||||
// {
|
|
||||||
// "subnetIds": ["string", ...],
|
|
||||||
// "securityGroupIds": ["string", ...]
|
|
||||||
// }
|
|
||||||
ResourcesVPCConfig string `json:"resourcesVPCConfig"`
|
|
||||||
|
|
||||||
// ClientRequestToken
|
// ClientRequestToken
|
||||||
// --client-request-token (string)
|
// --client-request-token (string)
|
||||||
|
|
@ -100,7 +95,7 @@ type EKSClusterStatus struct {
|
||||||
|
|
||||||
// EKSCluster is the Schema for the instances API
|
// EKSCluster is the Schema for the instances API
|
||||||
// +k8s:openapi-gen=true
|
// +k8s:openapi-gen=true
|
||||||
// +groupName=container.gcp
|
// +groupName=compute.aws
|
||||||
type EKSCluster struct {
|
type EKSCluster struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018 The Conductor Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"log"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
corev1alpha1 "github.com/upbound/conductor/pkg/apis/core/v1alpha1"
|
||||||
|
"github.com/upbound/conductor/pkg/test"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
namespace = "default"
|
||||||
|
name = "test-cluster"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
cfg *rest.Config
|
||||||
|
c client.Client
|
||||||
|
ctx = context.TODO()
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
err := SchemeBuilder.AddToScheme(scheme.Scheme)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
t := test.NewTestEnv(namespace, test.CRDs())
|
||||||
|
cfg = t.Start()
|
||||||
|
|
||||||
|
if c, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.StopAndExit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestEKSCluster(t *testing.T) {
|
||||||
|
key := types.NamespacedName{Name: name, Namespace: namespace}
|
||||||
|
created := &EKSCluster{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: namespace},
|
||||||
|
Spec: EKSClusterSpec{
|
||||||
|
ClusterVersion: "1.1.1",
|
||||||
|
RoleARN: "test-arn",
|
||||||
|
SubnetIds: []string{"one", "two"},
|
||||||
|
SecurityGroups: []string{"sg-1", "sg-2"},
|
||||||
|
ReclaimPolicy: corev1alpha1.ReclaimRetain,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
g := NewGomegaWithT(t)
|
||||||
|
|
||||||
|
// Test Create
|
||||||
|
fetched := &EKSCluster{}
|
||||||
|
g.Expect(c.Create(ctx, created)).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
g.Expect(c.Get(ctx, key, fetched)).NotTo(HaveOccurred())
|
||||||
|
g.Expect(fetched).To(Equal(created))
|
||||||
|
|
||||||
|
// Test Updating the Labels
|
||||||
|
updated := fetched.DeepCopy()
|
||||||
|
updated.Labels = map[string]string{"hello": "world"}
|
||||||
|
g.Expect(c.Update(ctx, updated)).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
g.Expect(c.Get(ctx, key, fetched)).NotTo(HaveOccurred())
|
||||||
|
g.Expect(fetched).To(Equal(updated))
|
||||||
|
|
||||||
|
// Test Delete
|
||||||
|
g.Expect(c.Delete(ctx, fetched)).NotTo(HaveOccurred())
|
||||||
|
g.Expect(c.Get(ctx, key, fetched)).To(HaveOccurred())
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
|
@ -28,7 +28,7 @@ func (in *EKSCluster) DeepCopyInto(out *EKSCluster) {
|
||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.Spec = in.Spec
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
out.Status = in.Status
|
out.Status = in.Status
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -87,6 +87,16 @@ func (in *EKSClusterList) DeepCopyObject() runtime.Object {
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *EKSClusterSpec) DeepCopyInto(out *EKSClusterSpec) {
|
func (in *EKSClusterSpec) DeepCopyInto(out *EKSClusterSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.SubnetIds != nil {
|
||||||
|
in, out := &in.SubnetIds, &out.SubnetIds
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
if in.SecurityGroups != nil {
|
||||||
|
in, out := &in.SecurityGroups, &out.SecurityGroups
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
out.ProviderRef = in.ProviderRef
|
out.ProviderRef = in.ProviderRef
|
||||||
out.ConnectionSecretRef = in.ConnectionSecretRef
|
out.ConnectionSecretRef = in.ConnectionSecretRef
|
||||||
return
|
return
|
||||||
Loading…
Reference in New Issue