diff --git a/charts/bookkeeper-operator/templates/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml b/charts/bookkeeper-operator/templates/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml index f2840c3c..acf86267 100644 --- a/charts/bookkeeper-operator/templates/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml +++ b/charts/bookkeeper-operator/templates/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml @@ -256,6 +256,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the @@ -393,6 +394,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the @@ -530,6 +532,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the diff --git a/cmd/manager/main.go b/cmd/manager/main.go index f3bea0e2..45188211 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -31,6 +31,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth/oidc" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" + logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" "sigs.k8s.io/controller-runtime/pkg/runtime/signals" ) @@ -55,6 +56,7 @@ func printVersion() { func main() { flag.Parse() + logf.SetLogger(logf.ZapLogger(false)) printVersion() diff --git a/deploy/crds/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml b/deploy/crds/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml index 24607a93..33861a40 100644 --- a/deploy/crds/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml +++ b/deploy/crds/bookkeeper.pravega.io_bookkeeperclusters_crd.yaml @@ -255,6 +255,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the @@ -392,6 +393,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the @@ -529,6 +531,7 @@ spec: required: - kind - name + nullable: true type: object resources: description: 'Resources represents the minimum resources the diff --git a/doc/operator-upgrade.md b/doc/operator-upgrade.md index e5bf0c70..b34dba14 100644 --- a/doc/operator-upgrade.md +++ b/doc/operator-upgrade.md @@ -28,6 +28,9 @@ To install cert-manager check [this](https://cert-manager.io/docs/installation/k ``` ./pre-upgrade.sh [BOOKKEEPER_OPERATOR_RELEASE_NAME][BOOKKEEPER_OPERATOR_NAMESPACE] ``` +where: +- `[BOOKKEEPER_OPERATOR_RELEASE_NAME]` is the release name of the bookkeeper operator deployment +- `[BOOKKEEPER_OPERATOR_NAMESPACE]` is the namespace in which the bookkeeper operator has been deployed (this is an optional parameter and its default value is `default`) ### Triggering the upgrade diff --git a/go.sum b/go.sum index 3566589c..bde0f2f9 100644 --- a/go.sum +++ b/go.sum @@ -266,6 +266,7 @@ github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/zapr v0.1.0 h1:h+WVe9j6HAA01niTJPA/kKH0i7e0rLZBCwauQFcRE54= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= +github.com/go-logr/zapr v0.1.1 h1:qXBXPDdNncunGs7XeEpsJt8wCjYBygluzfdLO0G5baE= github.com/go-logr/zapr v0.1.1/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -1065,11 +1066,13 @@ go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/automaxprocs v1.2.0/go.mod h1:YfO3fm683kQpzETxlTGZhGIVmXAhaw3gxeBADbpZtnU= go.uber.org/multierr v0.0.0-20180122172545-ddea229ff1df/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v0.0.0-20180814183419-67bc79d13d15/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -1077,6 +1080,7 @@ go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/pkg/apis/bookkeeper/v1alpha1/bookkeepercluster_types.go b/pkg/apis/bookkeeper/v1alpha1/bookkeepercluster_types.go index 1febbe8f..ac7ce1b0 100644 --- a/pkg/apis/bookkeeper/v1alpha1/bookkeepercluster_types.go +++ b/pkg/apis/bookkeeper/v1alpha1/bookkeepercluster_types.go @@ -132,12 +132,7 @@ type BookkeeperClusterList struct { Items []BookkeeperCluster `json:"items"` } -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// BookkeeperCluster is the Schema for the BookkeeperClusters API -// +k8s:openapi-gen=true // Generate CRD using kubebuilder - // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:shortName=bk @@ -146,7 +141,10 @@ type BookkeeperClusterList struct { // +kubebuilder:printcolumn:name="Desired Members",type=integer,JSONPath=`.status.replicas`,description="The number of desired bookkeeper members" // +kubebuilder:printcolumn:name="Ready Members",type=integer,JSONPath=`.status.readyReplicas`,description="The number of ready bookkeeper members" // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// BookkeeperCluster is the Schema for the BookkeeperClusters API type BookkeeperCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/scripts/pre-upgrade.sh b/scripts/pre-upgrade.sh index b345539f..a607c365 100755 --- a/scripts/pre-upgrade.sh +++ b/scripts/pre-upgrade.sh @@ -1,16 +1,18 @@ #! /bin/bash set -ex -if [ "$#" -ne 2 ]; then +if [[ "$#" -lt 1 || "$#" -gt 2 ]]; then echo "Error : Invalid number of arguments" Usage: "./pre-upgrade.sh " exit 1 fi name=$1 -namespace=$2 +namespace=${2:-default} kubectl annotate Service bookkeeper-webhook-svc meta.helm.sh/release-name=$name -n $namespace --overwrite kubectl annotate Service bookkeeper-webhook-svc meta.helm.sh/release-namespace=$namespace -n $namespace --overwrite kubectl label Service bookkeeper-webhook-svc app.kubernetes.io/managed-by=Helm -n $namespace --overwrite +#deleting the mutatingwebhookconfiguration created by the previous operator +kubectl delete mutatingwebhookconfiguration bookkeeper-webhook-config diff --git a/tools/operatorUpgrade.sh b/tools/operatorUpgrade.sh index b4d0591a..19f96e4f 100755 --- a/tools/operatorUpgrade.sh +++ b/tools/operatorUpgrade.sh @@ -44,6 +44,9 @@ sed -i "s/value:.*/value: $op_name "/ ./manifest_files/patch.yaml sed -i "/imagePullPolicy:.*/{n;s/name.*/name: $op_name/}" ./manifest_files/patch.yaml +#deleting the mutatingwebhookconfiguration created by the previous operator +kubectl delete mutatingwebhookconfiguration bookkeeper-webhook-config + #updating the operator using patch file kubectl patch deployment $op_name --namespace ${namespace} --type merge --patch "$(cat ./manifest_files/patch.yaml)"