Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
  •  
  •  
  •  
164 changes: 164 additions & 0 deletions .github/workflows/Ichi-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: spinnaker-operator
on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Fetch full history
run: git fetch --prune --tags --unshallow

- name: Set up Go 1.18.2
uses: actions/setup-go@v2
with:
go-version: 1.18.2

- name: Determine build type
id: build_type
run: |
echo "github.ref: ${{ github.ref }}"
echo "github.base_ref: ${{ github.base_ref }}"
echo "github.head_ref: ${{ github.head_ref }}"
echo "branch: $(git rev-parse --abbrev-ref HEAD)"

# On PRs to release branches, build RC releases for target release branch
if [[ "x${{ github.base_ref }}" =~ ^xrelease-* ]]
then
echo "Building release candidate"
build_type=rc
branch_override=${{ github.base_ref }}
registry=docker.io

# On any build running on master branch, build RC versions
elif [[ ${{ github.ref }} = "refs/heads/master" ]]
then
echo "Building release candidate"
build_type=rc
registry=docker.io

# On any build running on release branches, build final release
elif [[ ${{ github.ref }} =~ ^refs/heads/release-* ]]
then
echo "Building final release"
build_type=release
registry=docker.io

else
echo "Building snapshot"
build_type=snapshot
registry=armory-docker-local.jfrog.io
fi

make_args="VERSION_TYPE=$build_type REGISTRY=$registry REGISTRY_ORG=armory BRANCH_OVERRIDE=$branch_override"
version=$(make version $make_args)
echo "Version: $version"

# Make sure the version can be used as a tag
git tag v$version
git tag -d v$version

echo "##[set-output name=build_type;]$build_type"
echo "##[set-output name=registry;]$registry"
echo "##[set-output name=version;]$version"
echo "##[set-output name=make_args;]$make_args"

# We need to do this for at least a few versions so that we don't force
# users to manually fix the CRDs when migrating from v1beta1 to v1.
- name: Modify spinsvc CRD to assist with migration
uses: mikefarah/yq@v4.25.1
with:
cmd: yq -i '.spec.preserveUnknownFields = false' deploy/crds/spinnaker.io_spinnakerservices.yaml

- name: Build
run: |
go mod vendor && go mod tidy
make build ${{ steps.build_type.outputs.make_args }}
make docker-build ${{ steps.build_type.outputs.make_args }}

- name: Package
run: |
make docker-package ${{ steps.build_type.outputs.make_args }}

- name: Login to docker registry
run: |
if [[ ${{ steps.build_type.outputs.registry }} = "docker.io" ]]
then
echo "Logging in to dockerhub"
docker login -u ${{ secrets.DOCKERHUB_USER }} -p "${{ secrets.DOCKERHUB_PASSWORD }}" docker.io
else
echo "Logging in to jfrog"
docker login -u ${{ secrets.JFROG_USER }} -p "${{ secrets.JFROG_PASSWORD }}" armory-docker-local.jfrog.io
fi

- name: Push
run: |
make docker-push ${{ steps.build_type.outputs.make_args }}
if [[ ${{ github.ref }} = "refs/heads/master" ]]
then
make docker-push-dev ${{ steps.build_type.outputs.make_args }}
fi

- name: Push git tag
if: steps.build_type.outputs.build_type == 'rc' || steps.build_type.outputs.build_type == 'release'
run: |
git tag v${{ steps.build_type.outputs.version }}
git push origin v${{ steps.build_type.outputs.version }}

- name: Install Minikube
id: minikube
with:
minikube-version: 1.26.1
driver: docker
kubernetes-version: v1.24.3
uses: medyagh/setup-minikube@latest

- name: Install load balancer
run: |
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml
kubectl apply -f integration_tests/kind/metallb-configmap.yaml
until [ "$(kubectl get pods --all-namespaces --no-headers | grep -cEv '([0-9]+)/\1')" -ne 0 ]; do
sleep 5s
done

- name: Run tests
env:
S3_BUCKET: ${{ secrets.INTEGRATION_TEST_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.INTEGRATION_TEST_S3_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.INTEGRATION_TEST_S3_PASSWORD }}
AWS_DEFAULT_REGION: ${{ secrets.INTEGRATION_TEST_S3_BUCKET_REGION }}
AWS_EC2_METADATA_DISABLED: true
OPERATOR_IMAGE: ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }}
run: |
minikube image load ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }}
halyard=$(cat halyard-version | head -1)
export HALYARD_IMAGE="armory/halyard:$halyard"
make integration-test

- name: Create Release
if: steps.build_type.outputs.build_type == 'release'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.build_type.outputs.version }}
release_name: v${{ steps.build_type.outputs.version }}
draft: false
prerelease: false

- name: Upload manifests
if: steps.build_type.outputs.build_type == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/manifests.tgz
asset_name: manifests.tgz
asset_content_type: application/zip
11 changes: 9 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ jobs:
git tag v${{ steps.build_type.outputs.version }}
git push origin v${{ steps.build_type.outputs.version }}

- uses: engineerd/setup-kind@v0.5.0
- name: Install Minikube
id: minikube
with:
minikube-version: 1.26.1
driver: docker
kubernetes-version: v1.24.3
uses: medyagh/setup-minikube@latest

- name: Install load balancer
if: steps.build_type.outputs.build_type == 'rc' || steps.build_type.outputs.build_type == 'release'
run: |
Expand All @@ -133,7 +140,7 @@ jobs:
AWS_EC2_METADATA_DISABLED: true
OPERATOR_IMAGE: ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }}
run: |
kind load docker-image ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }}
minikube image load ${{ steps.build_type.outputs.registry }}/armory/spinnaker-operator:${{ steps.build_type.outputs.version }}
halyard=$(cat halyard-version | head -1)
export HALYARD_IMAGE="armory/halyard:$halyard"
make integration-test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ docker-test: Makefile ## Runs "make test" in a docker container

.PHONY: integration-test
integration-test: build-dirs Makefile ## Run integration tests. See requirements in integration_tests/README.md
@go test -tags=integration -mod=vendor -timeout=40m -run IntegrationTests/Operator= ./integration_tests/...
@go test -tags=integration -mod=vendor -timeout=60m -run IntegrationTests/Operator= ./integration_tests/...

.PHONY: docker-package
docker-package: Makefile ## Builds the docker image to distribute
Expand Down
8 changes: 4 additions & 4 deletions build-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ FROM python:3.7-alpine3.15
ENV OPERATOR=/usr/local/bin/spinnaker-operator \
USER_UID=1001 \
USER_NAME=spinnaker-operator \
AWS_AIM_AUTHENTICATOR_VERSION=0.4.0 \
KUBECTL_RELEASE=1.17.7 \
AWS_CLI_VERSION=1.18.109 \
AWS_AIM_AUTHENTICATOR_VERSION=0.5.9 \
KUBECTL_RELEASE=1.22.0 \
AWS_CLI_VERSION=1.25.40 \
OPERATOR_HOME=/opt/spinnaker-operator \
GOOGLE_CLOUD_SDK_VERSION=313.0.1 \
GOOGLE_CLOUD_SDK_VERSION=401.0.0 \
PATH="$PATH:/usr/local/bin/:/opt/google-cloud-sdk/bin/:/usr/local/bin/aws-iam-authenticator"

EXPOSE 8383
Expand Down
2 changes: 1 addition & 1 deletion build-tools/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ read -r major minor patch rc <<< "${v//./ }" && patch=$(echo "$patch" | sed 's|[

case $VERSION_TYPE in
snapshot)
if [ "x$(git status --porcelain)" != "x" ] ; then u=".uncommitted"; fi
# if [ "x$(git status --porcelain)" != "x" ] ; then u=".uncommitted"; fi
br=$(echo ".$BRANCH" | sed 's|[-/_]|.|g')
commit=$(git rev-parse --short HEAD)
if [[ "x$rc" = "x" ]]
Expand Down
7 changes: 5 additions & 2 deletions deploy/crds/spinnaker.io_spinnakeraccounts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,18 @@ spec:
description: AuthInfo holds the auth information
properties:
as:
description: Impersonate is the username to imperonate. The
description: Impersonate is the username to impersonate. The
name matches the flag.
type: string
as-groups:
description: ImpersonateGroups is the groups to
imperonate.
impersonate.
items:
type: string
type: array
as-uid:
description: ImpersonateUID is the uid to impersonate.
type: string
as-user-extra:
additionalProperties:
items:
Expand Down
5 changes: 5 additions & 0 deletions deploy/crds/spinnaker.io_spinnakerservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ spec:
name: apiUrl
priority: 1
type: string
- description: REGISTRATION ID
jsonPath: .status.registrationId
name: registrationId
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -183,6 +187,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
description: Service profiles will be parsed as YAML
type: object
x-kubernetes-preserve-unknown-fields: true
service-settings:
additionalProperties:
type: object
Expand Down
50 changes: 26 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/armory/spinnaker-operator
require (
github.com/armory/go-yaml-tools v0.0.0-20200316192928-75770481ad01
github.com/aws/aws-sdk-go v1.31.9
github.com/cenkalti/backoff/v4 v4.1.2
github.com/cenkalti/backoff/v4 v4.1.3
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.0
Expand All @@ -13,16 +13,16 @@ require (
github.com/operator-framework/operator-sdk v0.19.4
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.8.0
gomodules.xyz/jsonpatch/v2 v2.2.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/code-generator v0.23.5
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
sigs.k8s.io/controller-runtime v0.11.2
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/yaml v1.3.0
)

Expand All @@ -32,7 +32,7 @@ require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/fatih/color v1.9.0 // indirect
Expand All @@ -49,7 +49,6 @@ require (
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-hclog v0.12.2 // indirect
Expand All @@ -72,47 +71,50 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pierrec/lz4 v2.3.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
google.golang.org/api v0.54.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/component-base v0.23.5 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/component-base v0.24.2 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-state-metrics v1.7.2 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
)

require (
github.com/coreos/prometheus-operator v0.38.1-0.20200424145508-7e176fda06cc // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.23.5
k8s.io/apimachinery => k8s.io/apimachinery v0.22.8
k8s.io/client-go => k8s.io/client-go v0.22.8
k8s.io/api => k8s.io/api v0.24.3
k8s.io/apimachinery => k8s.io/apimachinery v0.24.3
k8s.io/client-go => k8s.io/client-go v0.24.3
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190311093542-50b561225d70
k8s.io/component-base => k8s.io/component-base v0.20.15
)
Expand Down
Loading