Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Update Runtime Component operator to 0.4.1 (#244)
Browse files Browse the repository at this point in the history
* Update Runtime Component operator to 0.4.1

* Updates CHANGELOG.md

* Updates CHANGELOG.md
  • Loading branch information
navidsh authored Mar 20, 2020
1 parent b69be99 commit 4b63018
Show file tree
Hide file tree
Showing 18 changed files with 171 additions and 125 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ All notable changes to this project will be documented in this file.
- Added support for naming service port. ([#237](https://github.com/appsody/appsody-operator/pull/237))
- Added must-gather scripts for troubleshooting. ([#209](https://github.com/appsody/appsody-operator/pull/209))
- Added the shortnames `app` and `apps` to the AppsodyApplication CRD. ([#198](https://github.com/appsody/appsody-operator/issues/198))
- Added OpenShift specific annotations ([#54](https://github.com/application-stacks/runtime-component-operator/pull/54))
- Set port name for Knative service if specified ([#55](https://github.com/application-stacks/runtime-component-operator/pull/55))

### Changed

- Changed the match label of the ServiceMonitor created by operator from `app.appsody.dev/monitor` to `monitor.appsody.dev/enabled`
- **Breaking change:** When `service.consumes[].namespace` is not specified, injected name of environment variable follows `<SERVICE-NAME>_<KEY>` format and binding information are mounted at `<mountPath>/<service_name>`. ([#27](https://github.com/application-stacks/runtime-component-operator/pull/27) and [#46](https://github.com/application-stacks/runtime-component-operator/pull/46))

## [0.3.0]

Expand Down Expand Up @@ -62,7 +65,7 @@ All notable changes to this project will be documented in this file.
- Support for watching multiple namespaces by setting `WATCH_NAMESPACE` to a comma-separated list of namespaces. ([#114](https://github.com/appsody/appsody-operator/issues/114))
- Allow users to add new labels or override default labels for resources created by the operator via setting labels on `AppsodyApplication` CRs. ([#118](https://github.com/appsody/appsody-operator/issues/118))
- Support for automatically creating and configuring `ServiceMonitor` resource for integration with Prometheus Operator. ([#125](https://github.com/appsody/appsody-operator/issues/125))
- Automatically configure the `AppsodyApplication`'s Kubernetes resources to allow automatic creation of an application definition by [kAppNav](https://kappnav.io/), Kubernetes Application Navigator. ([#128](https://github.com/appsody/appsody-operator/issues/128),[#135](https://github.com/appsody/appsody-operator/issues/135))
- Automatically configure the `AppsodyApplication`'s Kubernetes resources to allow automatic creation of an application definition by [kAppNav](https://kappnav.io/), Kubernetes Application Navigator. ([#128](https://github.com/appsody/appsody-operator/issues/128) and [#135](https://github.com/appsody/appsody-operator/issues/135))

### Changed

Expand Down
4 changes: 3 additions & 1 deletion deploy/crds/appsody.dev_appsodyapplications_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ spec:
type: array
port:
format: int32
maximum: 65536
maximum: 65535
minimum: 1
type: integer
portName:
Expand Down Expand Up @@ -2217,6 +2217,8 @@ spec:
type: object
targetPort:
format: int32
maximum: 65535
minimum: 1
type: integer
type:
description: Service Type string describes ingress methods for a
Expand Down
4 changes: 3 additions & 1 deletion deploy/releases/0.4.0/appsody-app-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ spec:
type: array
port:
format: int32
maximum: 65536
maximum: 65535
minimum: 1
type: integer
portName:
Expand Down Expand Up @@ -2217,6 +2217,8 @@ spec:
type: object
targetPort:
format: int32
maximum: 65535
minimum: 1
type: integer
type:
description: Service Type string describes ingress methods for a
Expand Down
4 changes: 3 additions & 1 deletion deploy/releases/daily/appsody-app-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ spec:
type: array
port:
format: int32
maximum: 65536
maximum: 65535
minimum: 1
type: integer
portName:
Expand Down Expand Up @@ -2217,6 +2217,8 @@ spec:
type: object
targetPort:
format: int32
maximum: 65535
minimum: 1
type: integer
type:
description: Service Type string describes ingress methods for a
Expand Down
2 changes: 1 addition & 1 deletion doc/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Each `AppsodyApplication` CR must at least specify the `applicationImage` parame
| `service.consumes` | An array consisting of services to be consumed by the `AppsodyApplication`. |
| `service.consumes[].category` | The type of service binding to be consumed. At this time, the only allowed value is `openapi`. |
| `service.consumes[].name` | The name of the service to be consumed. If binding to an `AppsodyApplication`, then this would be the provider's CR name. |
| `service.consumes[].namespace` | The namespace of the service to be consumed. If binding to an `AppsodyApplication`, then this would be the provider's CR name. |
| `service.consumes[].namespace` | The namespace of the service to be consumed. If binding to an `AppsodyApplication`, then this would be the provider's CR namespace. |
| `service.consumes[].mountPath` | Optional field to specify which location in the pod, service binding secret should be mounted. If not specified, the secret keys would be injected as environment variables. |
| `createKnativeService` | A boolean to toggle the creation of Knative resources and usage of Knative serving. |
| `expose` | A boolean that toggles the external exposure of this deployment via a Route or a Knative Route resource. |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/appsody/appsody-operator
go 1.13

require (
github.com/application-stacks/runtime-component-operator v0.4.0
github.com/application-stacks/runtime-component-operator v0.4.1
github.com/coreos/prometheus-operator v0.34.0
github.com/go-openapi/spec v0.19.4
github.com/jetstack/cert-manager v0.12.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/ant31/crd-validation v0.0.0-20180702145049-30f8a35d0ac2/go.mod h1:X0noFIik9YqfhGYBLEHg8LJKEwy7QIitLQuFMpKLcPk=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/application-stacks/runtime-component-operator v0.4.0 h1:ofejdFzaDxu2rY4PUNVY6X1LBg7/LzK5kRiEPa/XHbw=
github.com/application-stacks/runtime-component-operator v0.4.0/go.mod h1:3TJa36rzYElnHB7MRA/2GCpEq4SbGmBVw5O7ueN/JeM=
github.com/application-stacks/runtime-component-operator v0.4.1 h1:EXrV+i6/2sgVt+OILH6kgpS0670MXycR+drIztdynPw=
github.com/application-stacks/runtime-component-operator v0.4.1/go.mod h1:3TJa36rzYElnHB7MRA/2GCpEq4SbGmBVw5O7ueN/JeM=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
Expand Down
11 changes: 7 additions & 4 deletions pkg/apis/appsody/v1beta1/appsodyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ type AppsodyApplicationAutoScaling struct {
type AppsodyApplicationService struct {
Type *corev1.ServiceType `json:"type,omitempty"`

// +kubebuilder:validation:Maximum=65536
// +kubebuilder:validation:Maximum=65535
// +kubebuilder:validation:Minimum=1
Port int32 `json:"port,omitempty"`
// +kubebuilder:validation:Maximum=65535
// +kubebuilder:validation:Minimum=1
Port int32 `json:"port,omitempty"`
PortName string `json:"portName,omitempty"`
TargetPort *int32 `json:"targetPort,omitempty"`

PortName string `json:"portName,omitempty"`

Annotations map[string]string `json:"annotations,omitempty"`
// +listType=atomic
Consumes []ServiceBindingConsumes `json:"consumes,omitempty"`
Expand Down Expand Up @@ -858,7 +861,7 @@ func (cr *AppsodyApplication) GetLabels() map[string]string {
"app.kubernetes.io/instance": cr.Name,
"app.kubernetes.io/name": cr.Name,
"app.kubernetes.io/managed-by": "appsody-operator",
"app.kubernetes.io/component": "backend",
"app.kubernetes.io/component": "backend",
"app.kubernetes.io/part-of": cr.Spec.ApplicationName,
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/appsody/v1beta1/zz_generated.openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,18 @@ func schema_pkg_apis_appsody_v1beta1_AppsodyApplicationService(ref common.Refere
Format: "int32",
},
},
"portName": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"targetPort": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
"portName": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"annotations": {
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Expand Down
38 changes: 6 additions & 32 deletions pkg/controller/appsodyapplication/appsodyapplication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

oputils "github.com/application-stacks/runtime-component-operator/pkg/utils"
appsodyv1beta1 "github.com/appsody/appsody-operator/pkg/apis/appsody/v1beta1"
autils "github.com/appsody/appsody-operator/pkg/utils"
prometheusv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
certmngrv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2"
servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1"
Expand Down Expand Up @@ -446,6 +445,12 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
reqLogger.V(1).Info(fmt.Sprintf("%s is not supported on the cluster", applicationsv1beta1.SchemeGroupVersion.String()))
}

if r.IsOpenShift() {
// The order of items passed to the MergeMaps matters here! Annotations from GetOpenShiftAnnotations have higher importance. Otherwise,
// it is not possible to override converted annotations.
instance.Annotations = oputils.MergeMaps(instance.Annotations, oputils.GetOpenShiftAnnotations(instance))
}

currentGen := instance.Generation
err = r.GetClient().Update(context.TODO(), instance)
if err != nil {
Expand Down Expand Up @@ -551,10 +556,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
ksvc := &servingv1alpha1.Service{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(ksvc, instance, func() error {
oputils.CustomizeKnativeService(ksvc, instance)
if r.IsOpenShift() {
ksvc.Annotations = oputils.MergeMaps(ksvc.Annotations, autils.GetOpenShiftAnnotations(instance))
ksvc.Spec.Template.ObjectMeta.Annotations = oputils.MergeMaps(oputils.GetConnectToAnnotation(instance), ksvc.Spec.Template.ObjectMeta.Annotations)
}
return nil
})

Expand All @@ -578,10 +579,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco

svc := &corev1.Service{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(svc, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(instance.Annotations, autils.GetOpenShiftAnnotations(instance))
}

oputils.CustomizeService(svc, ba)
svc.Annotations = oputils.MergeMaps(svc.Annotations, instance.Spec.Service.Annotations)

Expand Down Expand Up @@ -610,10 +607,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
}
svc := &corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: instance.Name + "-headless", Namespace: instance.Namespace}}
err = r.CreateOrUpdate(svc, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(instance.Annotations, autils.GetOpenShiftAnnotations(instance))
}

oputils.CustomizeService(svc, instance)
svc.Spec.ClusterIP = corev1.ClusterIPNone
svc.Spec.Type = corev1.ServiceTypeClusterIP
Expand All @@ -626,10 +619,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco

statefulSet := &appsv1.StatefulSet{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(statefulSet, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(autils.GetOpenShiftAnnotations(instance), instance.Annotations)
}

oputils.CustomizeStatefulSet(statefulSet, instance)
oputils.CustomizePodSpec(&statefulSet.Spec.Template, instance)
oputils.CustomizePersistence(statefulSet, instance)
Expand Down Expand Up @@ -659,9 +648,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
}
deploy := &appsv1.Deployment{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(deploy, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(autils.GetOpenShiftAnnotations(instance), instance.Annotations)
}
oputils.CustomizeDeployment(deploy, instance)
oputils.CustomizePodSpec(&deploy.Spec.Template, instance)
return nil
Expand All @@ -676,10 +662,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
if instance.Spec.Autoscaling != nil {
hpa := &autoscalingv1.HorizontalPodAutoscaler{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(hpa, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(autils.GetOpenShiftAnnotations(instance), instance.Annotations)
}

oputils.CustomizeHPA(hpa, instance)
return nil
})
Expand Down Expand Up @@ -709,10 +691,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
return err
}
oputils.CustomizeRoute(route, ba, key, cert, caCert, destCACert)
if r.IsOpenShift() {
route.Annotations = oputils.MergeMaps(autils.GetOpenShiftAnnotations(ba), route.Annotations)
}

return nil
})
if err != nil {
Expand All @@ -738,10 +716,6 @@ func (r *ReconcileAppsodyApplication) Reconcile(request reconcile.Request) (reco
if instance.Spec.Monitoring != nil && (instance.Spec.CreateKnativeService == nil || !*instance.Spec.CreateKnativeService) {
sm := &prometheusv1.ServiceMonitor{ObjectMeta: defaultMeta}
err = r.CreateOrUpdate(sm, instance, func() error {
if r.IsOpenShift() {
instance.Annotations = oputils.MergeMaps(autils.GetOpenShiftAnnotations(instance), instance.Annotations)
}

oputils.CustomizeServiceMonitor(sm, instance)
return nil
})
Expand Down
19 changes: 0 additions & 19 deletions pkg/utils/utils.go

This file was deleted.

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

0 comments on commit 4b63018

Please sign in to comment.