kind: "BuildConfig"
apiVersion: "v1"
metadata:
name: "xx-backend-build"
spec:
source:
type: "Git"
git:
uri: "https://github.com/suchan-redhat/golangtest.git"
sourceSecret:
name: "basicsecret"
strategy:
type: Docker
dockerStrategy:
dockerfilePath: Dockerfile
output:
to:
kind: "DockerImage"
name: "registry.xx-sunrise.openshift.com:443/sunny-demo3/aml_b2c-pilot_backend:latest"
pushSecret:
name: "dockerhub"
oc secrets new-basicauth basicsecret --username=username --password=*****
oc secrets new dockerhub ~/.docker/config.json
or
oc secrets new dockerhub ~/.dockercfg
oc secrets add serviceaccount/builder secrets/dockerhub
oc create -f bc.yaml
oc start-build xx-backend-build
kind: DeploymentConfig
apiVersion: "v1"
metadata:
name: dc-b2c-pilot-backend
labels:
solution-centre.name: snm-aml
product-team.name: aml
product.name: b2c-pilot
application.tier: backend
spec:
replicas: 1
template:
metadata:
labels:
solution-centre.name: snm-aml
product-team.name: aml
product.name: b2c-pilot
application.tier: backend
spec:
containers:
- name: b2c-pilot-backend
image: 172.30.166.216:5000/sunny-demo3/aml_b2c-pilot_backend:latest
imagePullPolicy: Always
ports:
- containerPort: 5000
protocol: TCP
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: 172.30.166.216:5000/sunny-demo3/aml_b2c-pilot_backend:latest
oc create -f dc.yaml
apiVersion: v1
kind: Service
metadata:
name: svc-b2c-pilot-backend
labels:
solution-centre.name: snm-aml
product-team.name: aml
product.name: b2c-pilot
application.tier: backend
spec:
ports:
- port: 5000
protocol: TCP
selector:
solution-centre.name: snm-aml
product-team.name: aml
product.name: b2c-pilot
application.tier: backend
oc create -f svc.yaml
apiVersion: v1
kind: Route
metadata:
name: route-b2c-pilot-backend
spec:
host: svc-b2c-pilot-backend-sunny-demo3.4d25.xx-sunrise.openshiftapps.com
to:
kind: Service
name: svc-b2c-pilot-backend
host: svc-b2c-pilot-backend-sunny-demo3.4d25.xx-sunrise.openshiftapps.com
oc create -f route.yaml
oc policy add-role-to-user edit system:serviceaccount:<project name>:default -n <project name>
oc project <project name>
oc describe serviceaccount default
oc describe secret <default token name>
copy the token part