Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BackendConfig v1alpha1->v1beta1 #271

Merged
merged 1 commit into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
k8s.io/ingress-gce/pkg/backendconfig/client k8s.io/ingress-gce/pkg/apis \
backendconfig:v1alpha1 \
backendconfig:v1beta1 \
--output-base "$(dirname ${BASH_SOURCE})/../../.." \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ limitations under the License.

// +k8s:deepcopy-gen=package

// Package v1alpha1 is the v1alpha1 version of the API.
// Package v1beta1 is the v1beta1 version of the API.
// +groupName=cloud.google.com
package v1alpha1
package v1beta1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -25,7 +25,7 @@ import (
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: backendconfig.GroupName, Version: "v1alpha1"}
var SchemeGroupVersion = schema.GroupVersion{Group: backendconfig.GroupName, Version: "v1beta1"}

// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pkg/backendconfig/backendconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import (
"k8s.io/client-go/tools/cache"

"k8s.io/ingress-gce/pkg/annotations"
backendconfigv1alpha1 "k8s.io/ingress-gce/pkg/apis/backendconfig/v1alpha1"
backendconfigv1beta1 "k8s.io/ingress-gce/pkg/apis/backendconfig/v1beta1"
)

// GetServicesForBackendConfig returns all services that reference the given
// BackendConfig.
func GetServicesForBackendConfig(svcLister cache.Store, backendConfig *backendconfigv1alpha1.BackendConfig) []*apiv1.Service {
func GetServicesForBackendConfig(svcLister cache.Store, backendConfig *backendconfigv1beta1.BackendConfig) []*apiv1.Service {
svcs := []*apiv1.Service{}
for _, obj := range svcLister.List() {
svc := obj.(*apiv1.Service)
Expand Down Expand Up @@ -62,7 +62,7 @@ func GetServicesForBackendConfig(svcLister cache.Store, backendConfig *backendco

// GetBackendConfigForServicePort returns the corresponding BackendConfig for
// the given ServicePort if specified.
func GetBackendConfigForServicePort(backendConfigLister cache.Store, svc *apiv1.Service, svcPort *apiv1.ServicePort) (*backendconfigv1alpha1.BackendConfig, error) {
func GetBackendConfigForServicePort(backendConfigLister cache.Store, svc *apiv1.Service, svcPort *apiv1.ServicePort) (*backendconfigv1beta1.BackendConfig, error) {
backendConfigNames, err := annotations.FromService(svc).GetBackendConfigs()
if err != nil {
return nil, fmt.Errorf("failed to get BackendConfig names from service %s/%s: %v", svc.Namespace, svc.Name, err)
Expand All @@ -87,7 +87,7 @@ func GetBackendConfigForServicePort(backendConfigLister cache.Store, svc *apiv1.
}

obj, exists, err := backendConfigLister.Get(
&backendconfigv1alpha1.BackendConfig{
&backendconfigv1beta1.BackendConfig{
ObjectMeta: metav1.ObjectMeta{
Name: configName,
Namespace: svc.Namespace,
Expand All @@ -96,5 +96,5 @@ func GetBackendConfigForServicePort(backendConfigLister cache.Store, svc *apiv1.
if !exists || err != nil {
return nil, fmt.Errorf("failed to get BackendConfig %s for service %s/%s: %v", configName, svc.Namespace, svc.Name, err)
}
return obj.(*backendconfigv1alpha1.BackendConfig), nil
return obj.(*backendconfigv1beta1.BackendConfig), nil
}
6 changes: 3 additions & 3 deletions pkg/backendconfig/backendconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import (
"k8s.io/client-go/tools/cache"

"k8s.io/ingress-gce/pkg/annotations"
backendconfigv1alpha1 "k8s.io/ingress-gce/pkg/apis/backendconfig/v1alpha1"
backendconfigv1beta1 "k8s.io/ingress-gce/pkg/apis/backendconfig/v1beta1"
)

var (
testBackendConfig = &backendconfigv1alpha1.BackendConfig{
testBackendConfig = &backendconfigv1beta1.BackendConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "config-test",
Namespace: "test",
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestGetBackendConfigForServicePort(t *testing.T) {
svc *apiv1.Service
svcPort *apiv1.ServicePort
getFunc func(obj interface{}) (item interface{}, exists bool, err error)
expectedConfig *backendconfigv1alpha1.BackendConfig
expectedConfig *backendconfigv1beta1.BackendConfig
expectErr bool
}{
{
Expand Down
24 changes: 12 additions & 12 deletions pkg/backendconfig/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/backendconfig/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading