Skip to content

Conversation

@jbrette
Copy link
Contributor

@jbrette jbrette commented Oct 10, 2019

  • Remove vendor directory
  • Use go module
  • Use latest version of controller-tools, regenerate CRDs.
  • Use kustomize 3.x version
  • Add end2end examples based on kustomize and wordpress.
make deploy

hack/tools/bin/kustomize build config/default | kubectl apply -f -
namespace/application-system created
customresourcedefinition.apiextensions.k8s.io/applications.app.k8s.io created
clusterrole.rbac.authorization.k8s.io/application-manager-role created
clusterrolebinding.rbac.authorization.k8s.io/application-manager-rolebinding created
service/application-controller-manager-service created
statefulset.apps/application-controller-manager created
make deploy-wordpress

mkdir -p /tmp/data1 /tmp/data2
hack/tools/bin/kustomize build examples/wordpress | kubectl apply -f -
secret/mysql-pass-82fh56g7gf created
service/wordpress-mysql-hsvc created
service/wordpress-webserver-hsvc created
service/wordpress-webserver-svc created
statefulset.apps/wordpress-mysql created
statefulset.apps/wordpress-webserver created
application.app.k8s.io/wordpress-01 created
persistentvolume/pv-volume-1 created
persistentvolume/pv-volume-2 created
kubectl get application -o yaml
apiVersion: v1
items:
- apiVersion: app.k8s.io/v1beta1
  kind: Application
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"app.k8s.io/v1beta1","kind":"Application","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"wordpress-01"},"name":"wordpress-01","namespace":"default"},"spec":{"componentKinds":[{"group":"core","kind":"Service"},{"group":"apps","kind":"StatefulSet"}],"description":"WordPress is open source software you can use to create a beautiful website, blog, or app.","icons":[{"size":"1000x1000","src":"https://s.w.org/style/images/about/WordPress-logotype-wmark.png","type":"image/png"},{"size":"2000x680","src":"https://s.w.org/style/images/about/WordPress-logotype-standard.png","type":"image/png"}],"keywords":["cms","blog","wordpress"],"links":[{"description":"About","url":"https://wordpress.org/"},{"description":"Web Server Dashboard","url":"https://metrics/internal/wordpress-01/web-app"},{"description":"Mysql Dashboard","url":"https://metrics/internal/wordpress-01/mysql"}],"maintainers":[{"email":"[email protected]","name":"Kenneth Owens"}],"owners":[{"email":"[email protected]","name":"Kenneth Owens"}],"selector":{"matchLabels":{"app.kubernetes.io/name":"wordpress-01"}},"type":"wordpress","version":"4.9.4"}}
    creationTimestamp: "2019-10-10T04:43:00Z"
    generation: 8
    labels:
      app.kubernetes.io/name: wordpress-01
    name: wordpress-01
    namespace: default
    resourceVersion: "1359"
    selfLink: /apis/app.k8s.io/v1beta1/namespaces/default/applications/wordpress-01
    uid: 81a6555b-5590-4022-9c1d-bc93f4878321
  spec:
    componentKinds:
    - group: core
      kind: Service
    - group: apps
      kind: StatefulSet
    descriptor: {}
    selector:
      matchLabels:
        app.kubernetes.io/name: wordpress-01
  status:
    components:
    - group: apps/v1
      kind: StatefulSet
      link: /apis/apps/v1/namespaces/default/statefulsets/wordpress-mysql
      name: wordpress-mysql
      status: Ready
    - group: apps/v1
      kind: StatefulSet
      link: /apis/apps/v1/namespaces/default/statefulsets/wordpress-webserver
      name: wordpress-webserver
      status: Ready
    conditions:
    - lastTransitionTime: "2019-10-10T04:44:50Z"
      lastUpdateTime: "2019-10-10T04:44:50Z"
      message: all components ready
      reason: ComponentsReady
      status: "True"
      type: Ready
    - lastTransitionTime: "2019-10-10T04:43:00Z"
      lastUpdateTime: "2019-10-10T04:43:00Z"
      message: No error seen
      reason: NoError
      status: "False"
      type: Error
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

@k8s-ci-robot
Copy link
Contributor

Welcome @jbrette!

It looks like this is your first PR to kubernetes-sigs/application 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/application has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 10, 2019
@jbrette
Copy link
Contributor Author

jbrette commented Oct 10, 2019

/assign @mattfarina

@tamalsaha
Copy link
Contributor

cc: @janetkuo , @mortent can this pr be merged?

@barney-s
Copy link
Contributor

@jbrette Thanks for the changes. We are in the process of updating the code to use the latest kubebuilder and cleanup other parts.

part of that change is:
#133

Thanks for the patience. Would recommend you check the repo again in a few weeks and rebase your changes on top of that if needed.

@janetkuo
Copy link
Member

#133 was just merged. @jbrette would you rebase this change? Thanks!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 29, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2020
@jbrette
Copy link
Contributor Author

jbrette commented Feb 1, 2020

@janetkuo Done

xxx:~/go/src/sigs.k8s.io/application$ make deploy REGISTRY=keleustes
cd hack/tools; ./install_kustomize.sh
+ [[ -f bin/kustomize ]]
+ mkdir -p ./bin
+ curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/v3.2.0/kustomize_3.2.0_linux_amd64 -o ./bin/kustomize
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   618    0   618    0     0   2032      0 --:--:-- --:--:-- --:--:--  2032
100 25.3M  100 25.3M    0     0  3163k      0  0:00:08  0:00:08 --:--:-- 4207k
+ chmod +x ./bin/kustomize
hack/tools/bin/kustomize build config/default | kubectl apply -f -
namespace/application-system created
customresourcedefinition.apiextensions.k8s.io/applications.app.k8s.io created
clusterrole.rbac.authorization.k8s.io/application-manager-role created
clusterrolebinding.rbac.authorization.k8s.io/application-manager-rolebinding created
service/application-controller-manager-service created
statefulset.apps/application-controller-manager created
xxx:~/go/src/sigs.k8s.io/application$ kubectl get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   57m
xxx:~/go/src/sigs.k8s.io/application$ kubectl get all --all-namespaces
NAMESPACE            NAME                                           READY   STATUS    RESTARTS   AGE
application-system   pod/application-controller-manager-0           1/1     Running   0          12s
argo                 pod/argo-ui-5bf4fb7cc-h9qfd                    1/1     Running   0          56m
argo                 pod/argo-workflow-controller-dc4db947d-dxn4r   1/1     Running   0          56m
kube-system          pod/calico-etcd-jvr2x                          1/1     Running   0          56m
kube-system          pod/calico-kube-controllers-6944fb5984-7gq77   1/1     Running   0          56m
kube-system          pod/calico-node-9j4jc                          1/1     Running   0          56m
kube-system          pod/coredns-6955765f44-lbql7                   1/1     Running   0          56m
kube-system          pod/coredns-6955765f44-twwm6                   1/1     Running   0          56m
kube-system          pod/etcd-kubedgesdk                            1/1     Running   0          57m
kube-system          pod/kube-apiserver-kubedgesdk                  1/1     Running   0          57m
kube-system          pod/kube-controller-manager-kubedgesdk         1/1     Running   0          57m
kube-system          pod/kube-proxy-bngzx                           1/1     Running   0          56m
kube-system          pod/kube-scheduler-kubedgesdk                  1/1     Running   0          57m
kube-system          pod/tiller-deploy-68cff9d9cb-kknfr             1/1     Running   0          56m

NAMESPACE            NAME                                             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
application-system   service/application-controller-manager-service   ClusterIP   10.101.88.95     <none>        443/TCP                  12s
argo                 service/argo-ui                                  ClusterIP   10.110.5.212     <none>        80/TCP                   56m
default              service/kubernetes                               ClusterIP   10.96.0.1        <none>        443/TCP                  57m
kube-system          service/calico-etcd                              ClusterIP   10.96.232.136    <none>        6666/TCP                 57m
kube-system          service/kube-dns                                 ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP   57m
kube-system          service/tiller-deploy                            ClusterIP   10.100.115.208   <none>        44134/TCP                56m

NAMESPACE     NAME                         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                     AGE
kube-system   daemonset.apps/calico-etcd   1         1         1       1            1           node-role.kubernetes.io/master=   57m
kube-system   daemonset.apps/calico-node   1         1         1       1            1           beta.kubernetes.io/os=linux       57m
kube-system   daemonset.apps/kube-proxy    1         1         1       1            1           beta.kubernetes.io/os=linux       57m

NAMESPACE     NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
argo          deployment.apps/argo-ui                    1/1     1            1           56m
argo          deployment.apps/argo-workflow-controller   1/1     1            1           56m
kube-system   deployment.apps/calico-kube-controllers    1/1     1            1           57m
kube-system   deployment.apps/coredns                    2/2     2            2           57m
kube-system   deployment.apps/tiller-deploy              1/1     1            1           56m

NAMESPACE     NAME                                                 DESIRED   CURRENT   READY   AGE
argo          replicaset.apps/argo-ui-5bf4fb7cc                    1         1         1       56m
argo          replicaset.apps/argo-workflow-controller-dc4db947d   1         1         1       56m
kube-system   replicaset.apps/calico-kube-controllers-6944fb5984   1         1         1       56m
kube-system   replicaset.apps/coredns-6955765f44                   2         2         2       56m
kube-system   replicaset.apps/tiller-deploy-68cff9d9cb             1         1         1       56m

NAMESPACE            NAME                                              READY   AGE
application-system   statefulset.apps/application-controller-manager   1/1     12s
xxx:~/go/src/sigs.k8s.io/application$ make deploy-wordpress REGISTRY=keleustes
cd hack/tools; ./install_kustomize.sh
+ [[ -f bin/kustomize ]]
+ exit 0
mkdir -p /tmp/data1 /tmp/data2
hack/tools/bin/kustomize build examples/wordpress | kubectl apply -f -
secret/mysql-pass-82fh56g7gf created
service/wordpress-mysql-hsvc created
service/wordpress-webserver-hsvc created
service/wordpress-webserver-svc created
statefulset.apps/wordpress-mysql created
statefulset.apps/wordpress-webserver created
application.app.k8s.io/wordpress-01 created
persistentvolume/pv-volume-1 unchanged
persistentvolume/pv-volume-2 unchanged
xxx:~/go/src/sigs.k8s.io/application$ kubectl get crds
NAME                      CREATED AT
applications.app.k8s.io   2020-02-01T20:57:30Z
xxx:~/go/src/sigs.k8s.io/application$ kubectl get applications.app.k8s.io
NAME           AGE
wordpress-01   24s
xxx:~/go/src/sigs.k8s.io/application$ kubectl get applications.app.k8s.io wordpress-01 -o yaml
apiVersion: app.k8s.io/v1beta1
kind: Application
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"app.k8s.io/v1beta1","kind":"Application","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"wordpress-01"},"name":"wordpress-01","namespace":"default"},"spec":{"componentKinds":[{"group":"core","kind":"Service"},{"group":"apps","kind":"StatefulSet"}],"description":"WordPress is open source software you can use to create a beautiful website, blog, or app.","icons":[{"size":"1000x1000","src":"https://s.w.org/style/images/about/WordPress-logotype-wmark.png","type":"image/png"},{"size":"2000x680","src":"https://s.w.org/style/images/about/WordPress-logotype-standard.png","type":"image/png"}],"keywords":["cms","blog","wordpress"],"links":[{"description":"About","url":"https://wordpress.org/"},{"description":"Web Server Dashboard","url":"https://metrics/internal/wordpress-01/web-app"},{"description":"Mysql Dashboard","url":"https://metrics/internal/wordpress-01/mysql"}],"maintainers":[{"email":"[email protected]","name":"Kenneth Owens"}],"owners":[{"email":"[email protected]","name":"Kenneth Owens"}],"selector":{"matchLabels":{"app.kubernetes.io/name":"wordpress-01"}},"type":"wordpress","version":"4.9.4"}}
  creationTimestamp: "2020-02-01T20:58:05Z"
  generation: 2
  labels:
    app.kubernetes.io/name: wordpress-01
  name: wordpress-01
  namespace: default
  resourceVersion: "8367"
  selfLink: /apis/app.k8s.io/v1beta1/namespaces/default/applications/wordpress-01
  uid: 2b088029-4b1e-4b9b-8710-503a269f61b3
spec:
  componentKinds:
  - group: core
    kind: Service
  - group: apps
    kind: StatefulSet
  descriptor: {}
  selector:
    matchLabels:
      app.kubernetes.io/name: wordpress-01
status:
  components:
  - group: apps/v1
    kind: StatefulSet
    link: /apis/apps/v1/namespaces/default/statefulsets/wordpress-mysql
    name: wordpress-mysql
    status: Ready
  - group: apps/v1
    kind: StatefulSet
    link: /apis/apps/v1/namespaces/default/statefulsets/wordpress-webserver
    name: wordpress-webserver
    status: Ready
  conditions:
  - lastTransitionTime: "2020-02-01T20:58:07Z"
    lastUpdateTime: "2020-02-01T20:58:07Z"
    message: all components ready
    reason: ComponentsReady
    status: "True"
    type: Ready
  - lastTransitionTime: "2020-02-01T20:58:07Z"
    lastUpdateTime: "2020-02-01T20:58:07Z"
    message: No error seen
    reason: NoError
    status: "False"
    type: Error

Copy link
Contributor

@barney-s barney-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for rebasing. Minor comments.
PTAL


# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager sigs.k8s.io/application/cmd/manager
ARG ARCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you make amd64 default ARCH ?
ARG ARCH=amd64

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager sigs.k8s.io/application/cmd/manager
ARG ARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -a -ldflags '-extldflags "-static"' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we know what prompted static linker flag ?

$(KUSTOMIZE) build config/default | kubectl delete -f -

# Deploy wordpress
deploy-wordpress: $(KUSTOMIZE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a wonderful thing. Thanks. Do you think we could add this to e2e test ?
If not now may be later.

clean:
go clean --cache
rm -f $(COVER_FILE)
rm -f $(TOOLS_BIN_DIR)/kustomize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does existing .gitignore ignore the TOOLS_BIN_DIR ?

containers:
# Change the value of image field below to your controller image URL
- image: IMAGE_URL
- image: keleustes/application-controller-amd64:dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert this file.

matchLabels:
app.kubernetes.io/name: "wordpress-01"
componentKinds:
- group: core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you try without core in this. Does it work ?

type: "image/png"
size: "2000x680"
maintainers:
- name: Kenneth Owens
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change this to a generic name ?

@barney-s
Copy link
Contributor

barney-s commented Feb 2, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2020
@barney-s
Copy link
Contributor

barney-s commented Feb 2, 2020

@janetkuo Would you please approve this change.

@janetkuo
Copy link
Member

janetkuo commented Feb 4, 2020

/approve

@jbrette thank you!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janetkuo, jbrette

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 4, 2020
@k8s-ci-robot k8s-ci-robot merged commit 16359e8 into kubernetes-sigs:master Feb 4, 2020
@jbrette jbrette deleted the kube16 branch February 4, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants