Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM docker.io/openshift/origin-release:golang-1.13 AS builder
WORKDIR /go/src/github.com/openshift/cincinnati-operator/
COPY . .
RUN go build -mod=vendor -o /tmp/build/cincinnati-operator github.com/openshift/cincinnati-operator/cmd/manager
RUN go build -mod=vendor -o /tmp/build/updateservice-operator github.com/openshift/cincinnati-operator
Copy link
Member

Choose a reason for hiding this comment

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

No external consumers, so we can always change this post-pivot, but in #78 I used update-service-operator instead of updateservice-operator as the binary name.


FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

COPY --from=builder /tmp/build/cincinnati-operator /usr/bin/cincinnati-operator
ENTRYPOINT ["/usr/bin/cincinnati-operator"]
COPY --from=builder /tmp/build/updateservice-operator /usr/bin/updateservice-operator
ENTRYPOINT ["/usr/bin/updateservice-operator"]
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
clean \
deploy \
func-test \
unit-test
unit-test \
build

SOURCES := $(shell find . -name '*.go' -not -path "*/vendor/*")
IMG ?= quay.io/updateservice/updateservice-operator:latest

clean:
@echo "Cleaning previous outputs"
rm functests/functests.test

deploy:
@echo "Deploying Cincinnati operator"
@echo "Deploying Update Service operator"
hack/deploy.sh

func-test: deploy
Expand All @@ -18,4 +22,7 @@ func-test: deploy

unit-test:
@echo "Executing unit tests"
go test -v ./pkg/...
go test -v ./controllers/...

build: $(SOURCES)
go build -i -ldflags="-s -w" -mod=vendor -o ./updateservice-operator ./
11 changes: 11 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
domain: openshift.io
Copy link
Member

@wking wking Nov 11, 2020

Choose a reason for hiding this comment

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

You split updateservice.operator.openshift.io into an updateservice.operator group and an openshift.io domain, but the SDK docs say:

The domain is everything after the first DNS segment. Using cache.example.com as an example, the --domain would be example.com.

So I suspect we want an updateservice group, and then either operator.openshift.io as the domain, or just openshift.io (updateservice seems sufficiently specific without the operator scoping).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I based the group name on what we decided on in https://issues.redhat.com/browse/OTA-258 which was updateservice.operator. I specifically tested this out first with a generate as well before committing to it and it did cause any issues.

layout: go.kubebuilder.io/v2
repo: github.com/openshift/cincinnati-operator
resources:
- group: updateservice.operator
kind: UpdateService
version: v1
version: 3-alpha
projectName: updateservice-operator
Copy link
Member

Choose a reason for hiding this comment

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

In #79 I've gone with update-service-operator here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can change this as well afterwards if we want.

plugins:
go.sdk.operatorframework.io/v2-alpha: {}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# cincinnati-operator
# updateservice-operator

This operator is developed using the [operator SDK][operator-sdk], version 0.18.
This operator is developed using the [operator SDK][operator-sdk], version 1.0.0.
Installation docs are [here][operator-sdk-installation].

## Run locally

To run locally, you must set the operand image as shown below.

```
export OPERAND_IMAGE="quay.io/app-sre/cincinnati:2873c6b"
export OPERAND_IMAGE="quay.io/app-sre/updateservice:2873c6b"
operator-sdk run --local
```

## Using an init container to load graph data

The Cincinnati graph data is loaded from an init container. Before deploying
the cincinnati-operator, you will need to [build and push an init container containing the graph data](docs/graph-data-init-container.md).
The UpdateService graph data is loaded from an init container. Before deploying
the updateservice-operator, you will need to [build and push an init container containing the graph data](docs/graph-data-init-container.md).

## Deploy operator

```
make deploy
```

By default, operator will be deployed using the default operator image `quay.io/cincinnati/cincinnati-operator:latest`. If you want to override the default operator image with your image, set
By default, operator will be deployed using the default operator image `quay.io/updateservice/updateservice-operator:latest`. If you want to override the default operator image with your image, set

```
export OPERATOR_IMAGE="your-registry/your-repo/your-cincinnati-opertor-image:tag"
export OPERATOR_IMAGE="your-registry/your-repo/your-updateservice-opertor-image:tag"
```

## Run functional tests
Expand All @@ -49,4 +49,4 @@ make unit-test
```

[operator-sdk]: https://sdk.operatorframework.io/docs/
[operator-sdk-installation]: https://v0-18-x.sdk.operatorframework.io/docs/install-operator-sdk/
[operator-sdk-installation]: https://v1-0-x.sdk.operatorframework.io/docs/installation/install-operator-sdk/
20 changes: 20 additions & 0 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Package v1 contains API Schema definitions for the updateservice v1 API group
// +kubebuilder:object:generate=true
// +groupName=updateservice.operator.openshift.io
package v1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "updateservice.operator.openshift.io", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
47 changes: 25 additions & 22 deletions ...is/cincinnati/v1beta1/cincinnati_types.go → api/v1/updateservice_types.go
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1beta1
package v1

import (
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
Expand All @@ -7,8 +7,8 @@ import (

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// CincinnatiSpec defines the desired state of Cincinnati
type CincinnatiSpec struct {
// UpdateServiceSpec defines the desired state of UpdateService.
type UpdateServiceSpec struct {
// replicas is the number of pods to run. When >=2, a PodDisruptionBudget
// will ensure that voluntary disruption leaves at least one Pod running at
// all times.
Expand All @@ -25,15 +25,15 @@ type CincinnatiSpec struct {
// +kubebuilder:validation:Required
Repository string `json:"repository"`

// graphDataImage is a container image that contains the Cincinnati graph
// graphDataImage is a container image that contains the UpdateService graph
// data.
// +kubebuilder:validation:Required
GraphDataImage string `json:"graphDataImage"`
}

// CincinnatiStatus defines the observed state of Cincinnati
type CincinnatiStatus struct {
// Conditions describe the state of the Cincinnati resource.
// UpdateServiceStatus defines the observed state of UpdateService.
type UpdateServiceStatus struct {
// Conditions describe the state of the UpdateService resource.
// +patchMergeKey=type
// +patchStrategy=merge
// +kubebuilder:validation:Optional
Expand All @@ -46,43 +46,46 @@ const (
// in the cluster and reflect the specified state.
ConditionReconcileCompleted conditionsv1.ConditionType = "ReconcileCompleted"

// ConditionRegistryCACertFound reports whether the cincinnati registry CA cert had been found
// ConditionRegistryCACertFound reports whether the updateservice registry CA cert had been found
ConditionRegistryCACertFound conditionsv1.ConditionType = "RegistryCACertFound"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// replaces k8s:deepcopy-gen:interfaces= in v1.0
// +kubebuilder:object:root=true

// Cincinnati is the Schema for a Cincinnati service.
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=cincinnatis,scope=Namespaced
type Cincinnati struct {
metav1.TypeMeta `json:",inline"`
// +kubebuilder:resource:path=updateservices,scope=Namespaced

// UpdateService is the Schema for the updateservices API.
type UpdateService struct {
metav1.TypeMeta `json:",inline"`

// metadata is standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +kubebuilder:validation:Required
metav1.ObjectMeta `json:"metadata"`

// spec is the desired state of the Cincinnati service. The
// spec is the desired state of the UpdateService service. The
// operator will work to ensure that the desired configuration is
// applied to the cluster.
// +kubebuilder:validation:Required
Spec CincinnatiSpec `json:"spec"`
Spec UpdateServiceSpec `json:"spec"`

// status contains information about the current state of the
// Cincinnati service.
// UpdateService service.
// +kubebuilder:validation:Optional
Status CincinnatiStatus `json:"status"`
Status UpdateServiceStatus `json:"status"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// replaces k8s:deepcopy-gen:interfaces= in v1.0
// +kubebuilder:object:root=true

// CincinnatiList contains a list of Cincinnati
type CincinnatiList struct {
// UpdateServiceList contains a list of UpdateService.
type UpdateServiceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Cincinnati `json:"items"`
Items []UpdateService `json:"items"`
}

func init() {
SchemeBuilder.Register(&Cincinnati{}, &CincinnatiList{})
SchemeBuilder.Register(&UpdateService{}, &UpdateServiceList{})
}
48 changes: 22 additions & 26 deletions ...ncinnati/v1beta1/zz_generated.deepcopy.go → api/v1/zz_generated.deepcopy.go
100644 → 100755

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

Loading