Skip to content

Commit

Permalink
Update .yaml apps/v1 and Update Vendor to Fix DaemonSet Issue (#1410)
Browse files Browse the repository at this point in the history
* Updated to apps/v1 in yaml

* Update webhook-runtime to apps/v1
  • Loading branch information
kfoozminus authored and tamalsaha committed Jul 17, 2019
1 parent 48a96ee commit 4739aa5
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/examples/monitoring/coreos-operator/demo-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ subjects:
name: prometheus-operator
namespace: demo
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus-operator
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ingress/configuration/config-volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace/demo created
Deploy a TLS enabled test server.

```yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ingress/configuration/health-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ First deploy and expose a test server:
```yaml
$ kubectl apply -f test-server.yaml

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/ingress/configuration/http-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace/demo created
### Deploy gRPC Test Server

```yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -204,7 +204,7 @@ $ kubectl create secret tls haproxy-secret -n demo --cert=bundle.crt --key=serve
Deploy the gRPC server and mount the `server-secret`.

```yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/ingress/http/blue-green-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ section_menu_id: guides
Voayger supports Blue Green deployments using weighted loadbalancing for backend pods. Following example illustrates a weighted loadbalance scenario.

```yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -54,7 +54,7 @@ spec:
name: http-1
protocol: TCP
---
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ingress/http/statefulset-pod.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There is the usual way of forwarding traffic to a Service matching a StatefulSet
selector, and use the service name as Backend ServiceName.

```yaml
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: http
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ingress/scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ metadata:
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
name: voyager-my-app
minReplicas: 2
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ingress/security/oauth-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Set `Authorization callback URL` to `https://<host:port>/oauth2/callback`. In th
```yaml
$ kubectl apply -f oauth2-proxy.yaml

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/ingress/security/oauth-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Configure, deploy and expose oauth2-proxy:
```yaml
$ kubectl apply -f oauth2-proxy.yaml

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -163,7 +163,7 @@ Configure, deploy and expose oauth2-proxy:
```yaml
$ kubectl apply -f oauth2-proxy.yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/ingress/security/oauth-google.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Configure, deploy and expose oauth2-proxy:
```yaml
$ kubectl apply -f oauth2-proxy.yaml

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -165,7 +165,7 @@ Configure, deploy and expose oauth2-proxy:
```yaml
$ kubectl apply -f oauth2-proxy.yaml
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ require (
kmodules.xyz/client-go v0.0.0-20190508091620-0d215c04352f
kmodules.xyz/monitoring-agent-api v0.0.0-20190508125842-489150794b9b
kmodules.xyz/openshift v0.0.0-20190508141315-99ec9fc946bf // indirect
kmodules.xyz/webhook-runtime v0.0.0-20190508093950-b721b4eba5e5
kmodules.xyz/webhook-runtime v0.0.0-20190624053948-102161a0392e
sigs.k8s.io/yaml v1.1.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ kmodules.xyz/openshift v0.0.0-20190508141315-99ec9fc946bf h1:UyVK/KyL2O7XNV+1c7Z
kmodules.xyz/openshift v0.0.0-20190508141315-99ec9fc946bf/go.mod h1:5l0No0OizfJ55sjDDpi0TgtGYWgmhy+F+i4+6DN61Ak=
kmodules.xyz/webhook-runtime v0.0.0-20190508093950-b721b4eba5e5 h1:40MH6o6EshW4z/8W2W5GEd56qzSpPrxVgpmZL+tsVPQ=
kmodules.xyz/webhook-runtime v0.0.0-20190508093950-b721b4eba5e5/go.mod h1:/8Kc9q3fttdmMwzxuQkiUJ1UNhvRbLDxNWwXgsaMUgU=
kmodules.xyz/webhook-runtime v0.0.0-20190624053948-102161a0392e h1:0AZeh0iTO+CSAQwFrMtVgvC15Nlzxof+JcKK4j3sCk8=
kmodules.xyz/webhook-runtime v0.0.0-20190624053948-102161a0392e/go.mod h1:/8Kc9q3fttdmMwzxuQkiUJ1UNhvRbLDxNWwXgsaMUgU=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/structured-merge-diff v0.0.0-20190302045857-e85c7b244fd2 h1:9r5DY45ef9LtcA6BnkhW8MPV7OKAfbf2AUwUhq3LeRk=
Expand Down
74 changes: 65 additions & 9 deletions vendor/kmodules.xyz/webhook-runtime/client/workload/v1/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v1

import (
"fmt"

appsv1 "k8s.io/api/apps/v1"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2"
Expand Down Expand Up @@ -57,23 +56,23 @@ func NewObject(kindOrResource string, name, ns string) (runtime.Object, error) {
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
}, nil
case v1.KindDeployment, v1.ResourceDeployments, v1.ResourceDeployment:
return &appsv1beta1.Deployment{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1beta1.SchemeGroupVersion.String(), Kind: v1.KindDeployment},
return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1.SchemeGroupVersion.String(), Kind: v1.KindDeployment},
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
}, nil
case v1.KindDaemonSet, v1.ResourceDaemonSets, v1.ResourceDaemonSet:
return &extensions.DaemonSet{
TypeMeta: metav1.TypeMeta{APIVersion: extensions.SchemeGroupVersion.String(), Kind: v1.KindDaemonSet},
return &appsv1.DaemonSet{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1.SchemeGroupVersion.String(), Kind: v1.KindDaemonSet},
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
}, nil
case v1.KindReplicaSet, v1.ResourceReplicaSets, v1.ResourceReplicaSet:
return &extensions.ReplicaSet{
TypeMeta: metav1.TypeMeta{APIVersion: extensions.SchemeGroupVersion.String(), Kind: v1.KindReplicaSet},
return &appsv1.ReplicaSet{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1.SchemeGroupVersion.String(), Kind: v1.KindReplicaSet},
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
}, nil
case v1.KindStatefulSet, v1.ResourceStatefulSets, v1.ResourceStatefulSet:
return &appsv1beta1.StatefulSet{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1beta1.SchemeGroupVersion.String(), Kind: v1.KindStatefulSet},
return &appsv1.StatefulSet{
TypeMeta: metav1.TypeMeta{APIVersion: appsv1.SchemeGroupVersion.String(), Kind: v1.KindStatefulSet},
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: ns},
}, nil
case v1.KindJob, v1.ResourceJobs, v1.ResourceJob:
Expand Down Expand Up @@ -185,94 +184,151 @@ func ApplyWorkload(obj runtime.Object, w *v1.Workload) error {
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
if len(w.Spec.Selector.MatchExpressions) > 0 {
return fmt.Errorf("selector.matchExpressions is not supported for ReplicationController %s/%s", w.Namespace, w.Name)
}
t.Spec.Selector = w.Spec.Selector.MatchLabels
}
// Deployment
case *extensions.Deployment:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1beta1.Deployment:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1beta2.Deployment:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1.Deployment:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
// DaemonSet
case *extensions.DaemonSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1beta2.DaemonSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1.DaemonSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
// ReplicaSet
case *extensions.ReplicaSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1beta2.ReplicaSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1.ReplicaSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
// StatefulSet
case *appsv1beta1.StatefulSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1beta2.StatefulSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
case *appsv1.StatefulSet:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = w.Spec.Replicas
}
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
// Job
case *batchv1.Job:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = w.Spec.Template
if w.Spec.Selector != nil {
t.Spec.Selector = w.Spec.Selector
}
// CronJob
case *batchv1beta1.CronJob:
t.ObjectMeta = w.ObjectMeta
t.Spec.JobTemplate.Spec.Template = w.Spec.Template
if w.Spec.Selector != nil {
t.Spec.JobTemplate.Spec.Selector = w.Spec.Selector
}
// DeploymentConfig
case *ocapps.DeploymentConfig:
t.ObjectMeta = w.ObjectMeta
t.Spec.Template = &w.Spec.Template
if w.Spec.Replicas != nil {
t.Spec.Replicas = *w.Spec.Replicas
}
if w.Spec.Selector != nil {
if len(w.Spec.Selector.MatchExpressions) > 0 {
return fmt.Errorf("selector.matchExpressions is not supported for DeploymentConfig %s/%s", w.Namespace, w.Name)
}
t.Spec.Selector = w.Spec.Selector.MatchLabels
}
default:
return fmt.Errorf("the object is not a pod or does not have a pod template")
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ kmodules.xyz/openshift/client/clientset/versioned/typed/apps/v1
kmodules.xyz/openshift/client/clientset/versioned/typed/security/v1
kmodules.xyz/openshift/client/clientset/versioned/scheme
kmodules.xyz/openshift/apis/security/v1
# kmodules.xyz/webhook-runtime v0.0.0-20190508093950-b721b4eba5e5
# kmodules.xyz/webhook-runtime v0.0.0-20190624053948-102161a0392e
kmodules.xyz/webhook-runtime/apis/workload/v1
kmodules.xyz/webhook-runtime/admission/v1beta1
kmodules.xyz/webhook-runtime/client/workload/v1
Expand Down

0 comments on commit 4739aa5

Please sign in to comment.